Sign in to follow this  
Followers 0
GEOSoft

Msgbox

16 posts in this topic

Here is another one you can add to the Help file if you want. I stumbled upon it by accident.

MsgBox (5000,'','') I don't know what the key pressed number would be for "Help" though.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites



5000 doesn't do anything for me--I don't get any message box.... :whistle:

However, you encouraged me to look online--and I've found some I"ll add to the unofficial docs:

256 makes Second button is default

512 makes Third button is default

So try these AbortRetryIgnore, for example, dialogs:

MsgBox (2,'','') ;first button default

MsgBox (258,'','') ;second button default

MsgBox (514,'','') ;third button default

Any others?


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

I don't know what you did wrong then because this gives me a message box with Cancel/Help buttons with Cancel being default.

MsgBox (5000,'','')
Exit
That's using 3.0.91 Beta (unstable).


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

GEOsoft, it's an OS thing I believe. I don't get anything on XP.

CyberSlug, enjoy, this is straight from the MessageBox section in one of the Windows header files...

/*

* MessageBox() Flags

*/

#define MB_OK 0x00000000L

#define MB_OKCANCEL 0x00000001L

#define MB_ABORTRETRYIGNORE 0x00000002L

#define MB_YESNOCANCEL 0x00000003L

#define MB_YESNO 0x00000004L

#define MB_RETRYCANCEL 0x00000005L

#if(WINVER >= 0x0500)

#define MB_CANCELTRYCONTINUE 0x00000006L

#endif /* WINVER >= 0x0500 */

#define MB_ICONHAND 0x00000010L

#define MB_ICONQUESTION 0x00000020L

#define MB_ICONEXCLAMATION 0x00000030L

#define MB_ICONASTERISK 0x00000040L

#if(WINVER >= 0x0400)

#define MB_USERICON 0x00000080L

#define MB_ICONWARNING MB_ICONEXCLAMATION

#define MB_IConerror MB_ICONHAND

#endif /* WINVER >= 0x0400 */

#define MB_ICONINFORMATION MB_ICONASTERISK

#define MB_IConstop MB_ICONHAND

#define MB_DEFBUTTON1 0x00000000L

#define MB_DEFBUTTON2 0x00000100L

#define MB_DEFBUTTON3 0x00000200L

#if(WINVER >= 0x0400)

#define MB_DEFBUTTON4 0x00000300L

#endif /* WINVER >= 0x0400 */

#define MB_APPLMODAL 0x00000000L

#define MB_SYSTEMMODAL 0x00001000L

#define MB_TASKMODAL 0x00002000L

#if(WINVER >= 0x0400)

#define MB_HELP 0x00004000L // Help Button

#endif /* WINVER >= 0x0400 */

#define MB_NOFOCUS 0x00008000L

#define MB_SETFOREGROUND 0x00010000L

#define MB_DEFAULT_DESKTOP_ONLY 0x00020000L

#if(WINVER >= 0x0400)

#define MB_TOPMOST 0x00040000L

#define MB_RIGHT 0x00080000L

#define MB_RTLREADING 0x00100000L

#endif /* WINVER >= 0x0400 */

#ifdef _WIN32_WINNT

#if (_WIN32_WINNT >= 0x0400)

#define MB_SERVICE_NOTIFICATION 0x00200000L

#else

#define MB_SERVICE_NOTIFICATION 0x00040000L

#endif

#define MB_SERVICE_NOTIFICATION_NT3X 0x00040000L

#endif

#define MB_TYPEMASK 0x0000000FL

#define MB_ICONMASK 0x000000F0L

#define MB_DEFMASK 0x00000F00L

#define MB_MODEMASK 0x00003000L

#define MB_MISCMASK 0x0000C000L

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hmm, 0x5000 which is hexadecmial gives me the help button! So does 0x4000 which equals 16384 decimal

Here are some more (from MS Visual Studio 6.0 help file):

16384 Adds Help button to the message box

65536 Specifies the message box window as the foreground window

524288 Text is right aligned

1048576 Specifies text should appear as right-to-left reading on Hebrew and Arabic systems

Edit: Thanks Valik.

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Oops, forgot to mention this one:

6 Cancel, Try Again, Continue

I only have XP available at the moment.... Does this work on other Windows versions?

EDIT: Found info at microsoft's library

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

MsgBox (5258,'','')
Exit
Gave me OK/Cancel/Help with OK having focus which was the same for 5514

MsgBox (5256,'','')
Exit
Gave me the same as 5000

Okay I just figured it out, Cancel/Help is 8

OK/Cancel/Help is 10

Now here is a tricky (and useless) one. Help/OK/Cancel/Help is 12.

This could take forever to test. Does anyone have a method to figure out the button click number for "Help". That could be great for launching a help file.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

GeoSoft, what version of Windows are you running?

Like Larry said, the Help button does not close the MsgBox at least on Windows XP (and 2000?) so a return value is not obtained.

EDIT: I agree with what Valik says below.

For what it's worth, the values of 256 and 512 actually were missing from the help file; however, they were documented in the Contants.au3 file bundled with AutoIt 3.0.91!

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

Most of the combinations you're going to come up with are useless. All the useful ones already have pre-defined constants listed in my post above. As far as actually making the Help button work, it requires some internal stuff to be done as Larry stated.

Also, I wouldn't recommend relying on AutoIt being an exact mirror interface into the Windows API functions it's using. For convienence or ease of use, some things could of been changed.

Share this post


Link to post
Share on other sites

GeoSoft, what version of Windows are you running?

That was on 98SE. I can try them, when I have time, on the XP partition. If they are not usable there is no sense in having them listed. It just caught me by surprise when I saw it there.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

CyberSlug, if you document some of the other message box flags, remember to specify the minimum OS it works on. I think the reason Jon didn't list them all to begin with is because not all of them work on earlier versions of Windows.

Share this post


Link to post
Share on other sites

If you look at the Constants.au3 include file in the AutoIt Include folder, you'll see all the supported MsgBox styles listed. Here they are for reference:

;==============================================
; Message Box Constants
;==============================================
; Indicates the buttons displayed in the message box
$MB_OK                =    0; One push button: OK
$MB_OKCANCEL          =    1; Two push buttons: OK and Cancel
$MB_ABORTRETRYIGNORE  =    2; Three push buttons: Abort, Retry, and Ignore
$MB_YESNOCANCEL       =    3; Three push buttons: Yes, No, and Cancel
$MB_YESNO             =    4; Two push buttons: Yes and No
$MB_RETRYCANCEL       =    5; Two push buttons: Retry and Cancel

; Displays an icon in the message box
$MB_ICONHAND          =   16; Stop-sign icon
$MB_ICONQUESTION      =   32; Question-mark icon
$MB_ICONEXCLAMATION   =   48; Exclamation-point icon
$MB_ICONASTERISK      =   64; Icon consisting of an 'i' in a circle

; Indicates the default button
$MB_DEFBUTTON1        =    0; The first button is the default button
$MB_DEFBUTTON2        =  256; The second button is the default button
$MB_DEFBUTTON3        =  512; The third button is the default button

; Indicates the modality of the dialog box
$MB_APPLMODAL         =    0; Application modal
$MB_SYSTEMMODAL       = 4096; System modal
$MB_TASKMODAL         = 8192; Task modal

; Indicates the button selected in the message box
$IDOK                 =    1; OK button was selected
$IDCANCEL             =    2; Cancel button was selected
$IDABORT              =    3; Abort button was selected
$IDRETRY              =    4; Retry button was selected
$IDIGNORE             =    5; Ignore button was selected
$IDYES                =    6; Yes button was selected
$IDNO                 =    7; No button was selected

Sincerely yours,Jeremy Landesjlandes@landeserve.com

Share this post


Link to post
Share on other sites

I didn't see them listed in the MSDN docs for the MsgBox function.


Sincerely yours,Jeremy Landesjlandes@landeserve.com

Share this post


Link to post
Share on other sites

I didn't see them listed in the MSDN docs for the MsgBox function.

MSDN doesn't list all the flags. If you notice, there are a some in the header file which MSDN doesn't mention.

Share this post


Link to post
Share on other sites

Try this link

It mentions

MB_RIGHT

    The text is right-justified.

MB_RTLREADING

    Displays message and caption text using right-to-left reading order on Hebrew and Arabic systems.

MB_SETFOREGROUND

    The message box becomes the foreground window. Internally, the system calls the SetForegroundWindow function for the message box.

MB_TOPMOST

    The message box is created with the WS_EX_TOPMOST window style.


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0