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

Post your working scripts, libraries and tools
just me
Posts: 5082
Joined: 02 Oct 2013, 08:51
Location: Germany

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

23 Sep 2014, 00:34

huyaowen wrote:Could the normal msgbox recognize the parameters(on top,icon,timeout and so on)?
Yes, as long as you use icons and in particular button combinations supported by both functions.

jNizM wrote:something to add for Task Dialogs
Like I said, this is a MsgBox replacement. If you want to use the whole functionalities of the task dialog, you should try TheGood's script mentioned in the first post. The only missing feature seems to be ANSI support.
just me
Posts: 5082
Joined: 02 Oct 2013, 08:51
Location: Germany

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

23 Sep 2014, 02:48

Hi huyaowen,

it's done. But due to the differences between message boxes and task dialogs it seem's to have limited usefulness. That's why for a start I don't want to update the first post. I ask you to test it and report whether it meets your expectations.

To use the new option, you have to call TaskDialogUseMsgBoxOnXP(True) once and look at the Remarks: section of the inline documentation for restrictions.

Code: [Select all] [Download] (TaskDialog.ahk)GeSHi © Codebox Plus

Moved to first post -> advanced version.
Last edited by just me on 24 Sep 2014, 02:41, edited 1 time in total.
User avatar
huyaowen
Posts: 100
Joined: 28 Jul 2014, 01:15

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

23 Sep 2014, 04:24

ok,thank you just me.
i will get a careful test on XP back home
User avatar
huyaowen
Posts: 100
Joined: 28 Jul 2014, 01:15

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

23 Sep 2014, 09:51

wow~wonderful~
it's OK,thanks a lot.
just me
Posts: 5082
Joined: 02 Oct 2013, 08:51
Location: Germany

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

24 Sep 2014, 02:43

huyaowen wrote:it's OK,thanks a lot.

Thanks for testing. I've updated the first post.
User avatar
huyaowen
Posts: 100
Joined: 28 Jul 2014, 01:15

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

24 Sep 2014, 03:57

Now,TaskDialog() works well but Vista.
You can update the title.
User avatar
huyaowen
Posts: 100
Joined: 28 Jul 2014, 01:15

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

24 Sep 2014, 08:02

How long the Main content display is determined by the Extra content.
If the Extra content is longer than Main.Main can show the whole.otherwise.English characters only in a row of 46, Chinese characters will show a lot, but will be divided into two rows.
Could I set the width of the Dialog, so that when the Extra content is very short,also the Main content as far as possible to one line display.

ffff.jpg
ffff.jpg (89.77 KiB) Viewed 2122 times
just me
Posts: 5082
Joined: 02 Oct 2013, 08:51
Location: Germany

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

24 Sep 2014, 15:43

Well, I'll add a parameter.
just me
Posts: 5082
Joined: 02 Oct 2013, 08:51
Location: Germany

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

25 Sep 2014, 02:57

Hi huyaowen,

after some testing on Win 8.1 the width of the task dialog's client area calculated by the ' task dialog manager' seems to be determined as follows:
  • The minimum width is 360 pixels.
  • If the width of the button bar exceeds this value, this width (at most 557 pixels here) bar will be used.
  • If the flag TDF_SIZE_TO_CONTENT is set and the width of the Extra part exceeds both former values, this width will be used but will be limited to 556 pixels.
  • If a width is specified, it will be used unconditionally as long it doesn't go below the minimum width of 360 pixels. In consequence of this the button bar might be wrapped into two lines.

The new Width parameter seems to work as expected here. But I have no other systems I could test on. May I ask you again to make some additional tests?

Code: [Select all] [Download] GeSHi © Codebox Plus

Moved to first post!
Last edited by just me on 26 Sep 2014, 00:50, edited 1 time in total.
User avatar
huyaowen
Posts: 100
Joined: 28 Jul 2014, 01:15

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

25 Sep 2014, 08:19

nice work.
I have test on win2000,winXP,winserver2003 and win7.it can display the beautiful dialog only on win7.Other operating systems are shown right normal msgbox.
The Width parameter works well as expected on win7.
QQ截图20140925211624.jpg


ps.English characters only show in one line with suspension points(...).Why not show 2 lines?
sssss.jpg
just me
Posts: 5082
Joined: 02 Oct 2013, 08:51
Location: Germany

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

25 Sep 2014, 10:43

huyaowen wrote:ps.English characters only show in one line with suspension points(...).Why not show 2 lines?

Just put some spaces into the string.
User avatar
huyaowen
Posts: 100
Joined: 28 Jul 2014, 01:15

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

25 Sep 2014, 22:52

Thousands of thanks send to you.
just me
Posts: 5082
Joined: 02 Oct 2013, 08:51
Location: Germany

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

26 Sep 2014, 00:51

Thanks for testing again. I've updated the first post.
User avatar
huyaowen
Posts: 100
Joined: 28 Jul 2014, 01:15

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

15 Dec 2014, 07:46

A creator for TaskDialog.


Code: [Select all] [Expand] [Download] (TaskDialogCreator.ahk)GeSHi © Codebox Plus

Last edited by huyaowen on 16 Dec 2014, 02:18, edited 1 time in total.
lblb
Posts: 124
Joined: 30 Sep 2013, 11:31

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

15 Dec 2014, 14:02

Hi just me,

This is a great script. Could you clarify a bit what the XP option means? In the Remarks section you wrote

Depending on the settings of TaskDialogUseMsgBoxOnXP() the function can display a MsgBox instead of
; the task dialog on Win XP. In that case you should only use icons and in particular button combinations
; also supported by the MsgBox command:
; Icon: 1/"WARN", 2/"ERROR", 3/"INFO", "QUESTION"
; Buttons: 1/"OK", 9/"OK|CANCEL", 6/"YES|NO", 14/"YES|NO|CANCEL", 24/"RETRY|CANCEL"
; Other icons won't be shown, other button combinations won't show all specified buttons.


I understand that task dialogs are not available in XP. Since I don't have an XP system to test on, I have a few questions:

1) With "depending on the settings the function can display a msgbox instead of the task dialog" do you mean that there is a setting to display a task dialog in XP?
2) And what are these settings, setting TaskDialogUseMsgBoxOnXP() to true or false? And what happens if it's set to false?
3) Do we absolutely need to use TaskDialogUseMsgBoxOnXP()? If no and we don't use it, what happens in XP when a task dialog is called?
4) For the msgbox that would show up in XP, you mention a few values for icons and buttons but does it allow the use of the full list of Options in the Msgbox help file (http://www.autohotkey.com/docs/commands/MsgBox.htm)? What do you mean by "Other icons won't be shown, other button combinations won't show all specified buttons"?

Thanks in advance for your clarifications and for your great work on this.

Edit: Also, would it be possible to add the capacity to handle the footer (Verification check box, Footer text, Footer icon)? I'd be especially interested to be able to use a "Do not show again" check box.
http://msdn.microsoft.com/en-us/library ... 41(v=vs.85).aspx
just me
Posts: 5082
Joined: 02 Oct 2013, 08:51
Location: Germany

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

16 Dec 2014, 03:20

Hi lblb,

1) With "depending on the settings the function can display a msgbox instead of the task dialog" do you mean that there is a setting to display a task dialog in XP?
No. Task dialogs aren't supported on Win XP.

2) And what are these settings, setting TaskDialogUseMsgBoxOnXP() to true or false? ...
Yes.
...And what happens if it's set to false?

Code: [Select all] [Download] GeSHi © Codebox Plus

         MsgBox, 16, %A_ThisFunc%, You need at least Win Vista / Server 2008 to use %A_ThisFunc%().
ErrorLevel := "You need at least Win Vista / Server 2008 to use " . A_ThisFunc . "()."
Return 0

3) Do we absolutely need to use TaskDialogUseMsgBoxOnXP()? If no and we don't use it, what happens in XP when a task dialog is called?
see 2).

4) For the msgbox that would show up in XP, you mention a few values for icons and buttons but does it allow the use of the full list of Options in the Msgbox help file (http://www.autohotkey.com/docs/commands/MsgBox.htm)? What do you mean by "Other icons won't be shown, other button combinations won't show all specified buttons"?
Only icons and buttons/button combinations which are supported by both task dialogs and message boxes should be used. Buttons/icons unique to message boxes cannot be passed to the TaskDialog function, buttons/icons unique to task dialogs won't be shown in message boxes. BTW: The help file hosted on autohotkey.com is outdated.

Edit: Also, would it be possible to add the capacity to handle the footer (Verification check box, Footer text, Footer icon)? I'd be especially interested to be able to use a "Do not show again" check box.
http://msdn.microsoft.com/en-us/library ... 41(v=vs.85).aspx
Yes, but this wouldn't be a 'message box replacement' any more and wouldn't work on Win XP on any means.
lblb
Posts: 124
Joined: 30 Sep 2013, 11:31

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

16 Dec 2014, 13:25

Hi just me,
Thanks a lot for answering all my questions, much appreciated. I've tried both TheGood's and Nepter's implementations and yours is the only one that works on ANSI AHK, which I have to use for compatibility reasons. Thanks again for all your work on this.
User avatar
huyaowen
Posts: 100
Joined: 28 Jul 2014, 01:15

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

17 Dec 2014, 21:42

do you wanna add the 2 issues?


Image
Attachments
3.jpg
do you wanna add the 2 issues?
3.jpg (21.89 KiB) Viewed 1864 times
Last edited by huyaowen on 18 Dec 2014, 19:58, edited 1 time in total.
lblb
Posts: 124
Joined: 30 Sep 2013, 11:31

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

18 Dec 2014, 18:55

Hi huyaowen,
yes, it would be great to add the two sections at the bottom. Any idea how to do it? By the way, your creator above works great, very useful.
just me
Posts: 5082
Joined: 02 Oct 2013, 08:51
Location: Germany

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

19 Dec 2014, 04:28

Well, I'm on the way! ;)

Return to “Scripts and Functions”

Who is online

Users browsing this forum: JasonDavisFL, TheHacker and 17 guests