- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Message box with a return code
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
I need to display a message box message box with a prompt for the user to press a "Yes" button or a "No" button.
Can someone show me how this is done in InstallShield? Also how do I get the value passed back when the message box is closed?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Try below
MessageBoxEx("Are you sure?","My message box header",MB_YESNO | MB_ICONEXCLAMATION );
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
You can use InstallScript AskYesNo method (returns value 1 when Yes button is clicked and 0 for No button).
OR
You can also use InstallScript MessageBox method with appropriate styles supported by Windows MessageBox API for type field using logical OR operator (|).
For example, to show Yes and No buttons with warning icon, you could use corresponding constants defined in msdn documentation of MessageBox API(https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox). You can also check same link for return values.
MB_YESNO 0x00000004L
MB_ICONWARNING 0x00000030L
MessageBox("Test", 0x00000004 | 0x00000030);
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Thank you Varaprasad. I would have used the AskYesNo message box style, but there is not a parameter to set the title in the header?
I am now using MessageBoxEx to display the Yes No message box. It works great, but I can't figure out how to also place an Icon in the message box. Can you tell me how to do that? I notice that the AskYesNo message box has a question mark icon in it. I would like a warning icon in the MessageBoxEx if possible. Anyway that you know that I can do that?
Example: MessageBoxEx works great, how do I place an Icon in it?
if(MessageBoxEx("Are you sure?","My message box header",,MB_YESNO) = YES) then
// Do something
endif;
I tried AskYesNo, but can't set the header title:
if(AskYesNo("Are you sure?",YES) = YES) then
// Do Something
endif;
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Also I tried using SetDialogTitle before calling the message boxes, but it does not work, because I don't have the id of the message box? So that did not work.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Try below
MessageBoxEx("Are you sure?","My message box header",MB_YESNO | MB_ICONEXCLAMATION );