TaskDialog() - the other 'MsgBox' for Win Vista+

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
huyaowen
Posts: 109
Joined: 28 Jul 2014, 01:15

Re: TaskDialog() - the other 'MsgBox' for Win Vista+

19 Dec 2014, 20:10

Think about all the options if possiable. :P
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: TaskDialog() - the other 'MsgBox' for Win Vista+

24 Dec 2014, 15:48

It's nice having some easy options that look like they were built in the last decade. :D
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: TaskDialog() - the other 'MsgBox' for Win Vista+

25 Dec 2014, 11:55

Could somebody post an example using a custom icon? I think this is a cool feature but I'm not following how to implement it.
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
just me
Posts: 9459
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: TaskDialog() - the other 'MsgBox' for Win Vista+

26 Dec 2014, 05:03

Code: Select all

#NoEnv
#Include TaskDialog.ahk
HICON := LoadIcon("Shell32.dll", 14)
Main  := "This is the main instruction."
Extra := "This is the content text providing extra informations."
Title := "Custom Icon"
MsgBox, 262144, %A_ScriptName%, % TaskDialog(Main, Extra, Title, , HICON)
ExitApp

LoadIcon(FullFilePath, IconNumber := 1, LargeIcon := 1) {
   HIL := IL_Create(1, 1, !!LargeIcon)
   IL_Add(HIL, FullFilePath, IconNumber)
   HICON := DllCall("Comctl32.dll\ImageList_GetIcon", "Ptr", HIL, "Int", 0, "UInt", 0, "UPtr")
   IL_Destroy(HIL)
   Return HICON
}
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: TaskDialog() - the other 'MsgBox' for Win Vista+

26 Dec 2014, 06:35

@just me Thank you! I sure never would have got that on my own! :crazy:
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: TaskDialog() - the other 'MsgBox' for Win Vista+

26 Dec 2014, 09:45

I played around with that and it is pretty cool! Is there a way to either
1) show the color w/o the associated icon
2) use the color with the custom icon

When I say "color" I'm referring to the color displayed in the top part of the taskDialog as in the following call:

Code: Select all

TaskDialog(Main, Extra,      , 0x3F, "Red", , HGUI)
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
just me
Posts: 9459
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: TaskDialog() - the other 'MsgBox' for Win Vista+

27 Dec 2014, 03:55

"Red", "Green", etc. are names for system-defined icons which are not documented in task dialog reference on the MSDN but accepted by task dialogs. The whole drawing is done by the "control" and there's no parameter to pass a background color. I don't have a clue why background colors are drawn for those icons.
ozzii
Posts: 481
Joined: 30 Oct 2013, 06:04

Re: TaskDialog() - the other 'MsgBox' for Win Vista+

27 Dec 2014, 06:43

@huyaowen
An idea for the taskdialog creator.
Maybe a possibility to customize the icon?
What do you think? So This will be even more complete.
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: TaskDialog() - the other 'MsgBox' for Win Vista+

28 Dec 2014, 21:56

I was playing with this just so I'd understand how to use it and have a go-to with examples. People new to programming might find it helpful so I thought I'd post it. These are merely examples of calling the function.

Code: Select all

#SingleInstance, Force
#NoEnv

RAlt::Reload
RControl::
Time_Out:=2  ;set to zero for none
gosub Adjust_Widths
gosub Various_Buttons
gosub Builtin_Icons
gosub Backgrounds
gosub Custom_Icons
return
;*******************************************************
Adjust_Widths:
;**********************adjusting width*********************************
loop, 10{
Width:=350+(A_Index*25)
TaskDialog("Main: A_Index="A_Index, "Extra: Width=" Width,"Title: Ajusting Width",  , ,Width,,Time_Out)
}
return

;*******************************************************
Various_Buttons:
;**********************buttons*********************************
TaskDialog("Main: Words for buttons", "Extra: Showing all buttons possible"        ,"Title: Buttons-using text"    ,"Yes,No,Cancel,Retry,Close",,,400,Time_Out)
TaskDialog("Main: Yes=1, No=4, Cancel=8, Retry=16, Close=32", "Extra: 1+4=5"       ,"Title: Buttons-using addition",                          5,,,400,Time_Out)
TaskDialog("Main: Yes=1, No=4, Cancel=8, Retry=16, Close=32", "Extra: 1+4+8=13"    ,"Title: Buttons-using addition",                         13,,,400,Time_Out)
TaskDialog("Main: Yes=1, No=4, Cancel=8, Retry=16, Close=32", "Extra: 1+4+8+32=45" ,"Title: Buttons-using addition",                         45,,,400,Time_Out)
return

;*******************************************************
Builtin_Icons:
;**********************Icons*********************************
Loop, 4
	TaskDialog("Main: WARN=1, ERROR=2, INFO=3, ", "Extra: A_Index=" A_Index      ,"Title: Main Icons",1,A_Index,,400,Time_Out)

TaskDialog("Main: Question needs the string with quotes ", "Extra: ""Question""" ,"Title: Main Icons",1,"Question",,400,Time_Out)
return

;*******************************************************
Backgrounds:
;*******************************************************
Main :="Main from "  A_ThisLabel , Title:="Title from " A_ThisLabel , Extra:="Extra from " A_ThisLabel
TaskDialog(Main,Extra,Title ,, "Blue"  ,400,HGUI,Time_Out)
TaskDialog(Main,Extra,Title ,, "Yellow",450,HGUI,Time_Out)
TaskDialog(Main,Extra,Title ,, "Red"   ,500,HGUI,Time_Out)
TaskDialog(Main,Extra,Title ,, "Green" ,550,HGUI,Time_Out)
TaskDialog(Main,Extra,Title ,, "Gray"  ,600,HGUI,Time_Out)
return

Custom_Icons:
Main :="Main from "  A_ThisLabel , Title:="Title from " A_ThisLabel , Extra:="Extra from " A_ThisLabel
LoadIcon("H:\Progs\SPSS 13\spsswin.exe",1,0)

TaskDialog(Main, Extra, Title,, LoadIcon(A_WinDir "\explorer.exe",1,0)) ; first icon, small icon
TaskDialog(Main, Extra, Title,, LoadIcon(A_WinDir "\explorer.exe",1,1)) ; first icon, large icon
TaskDialog(Main, Extra, Title,, LoadIcon(A_WinDir "\explorer.exe",2,0)) ; Second icon, small icon
TaskDialog(Main, Extra, Title,, LoadIcon(A_WinDir "\explorer.exe",3,1)) ; Third icon, large icon
;~ TaskDialog(Main, Extra, Title,, LoadIcon("H:\Progs\SPSS 13\spsswin.exe",1,0), 1) ;you can put in your own programs too...

LoadIcon(FullFilePath, IconNumber := 1, LargeIcon := 1) {
	;~ --Proived by "just me"  http://ahkscript.org/boards/viewtopic.php?f=6&t=4635&start=40#p32968  ; 
   HIL := IL_Create(1, 1, !!LargeIcon)
   IL_Add(HIL, FullFilePath, IconNumber)
   HICON := DllCall("Comctl32.dll\ImageList_GetIcon", "Ptr", HIL, "Int", 0, "UInt", 0, "UPtr")
   IL_Destroy(HIL)
   Return HICON
}
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
User avatar
joedf
Posts: 8960
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: TaskDialog() - the other 'MsgBox' for Win Vista+

28 Dec 2014, 22:10

TaskDialog Designer?
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
676576

Re: TaskDialog() - the other 'MsgBox' for Win Vista+

29 Dec 2014, 00:00

Could I show custom icon with green background?
aiAUTOHK
Posts: 1
Joined: 29 Dec 2014, 06:52

Re: TaskDialog() - the other 'MsgBox' for Win Vista+

29 Dec 2014, 06:59

thanks, good tool.
User avatar
joedf
Posts: 8960
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: TaskDialog() - the other 'MsgBox' for Win Vista+

29 Dec 2014, 09:15

Make seperate topic! ;)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
vasili111
Posts: 747
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: TaskDialog() - the other 'MsgBox' for Win Vista+

19 Jan 2015, 11:37

I think it should be added to Examples of Non-Standard GUIs (ActiveX, GDI, etc.) thread.
DRAKON-AutoHotkey: Visual programming for AutoHotkey.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 231 guests