News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

How to open two and more MsgBox(s)

Started by bawrobin, March 23, 2010, 07:14:04 AM

Previous topic - Next topic

bawrobin

Hello.
I am a newbie.
In my program I have a code:


    invoke  wsprintf,ADDR buffer,ADDR MsgText,ebx
    invoke  MessageBox,0,ADDR buffer,ADDR MsgTitle,MB_OK
    invoke  ExitProcess,0



This code open a window with MB_OK.
Please tell me how I can open one more window when running a program ?

Thank you.

bawrobin

And if you can please tell me where I can read full description of MessageBox ?

For example, there is no descrpition in: http://webster.cs.ucr.edu/Page_TechDocs/MASMDoc/

May be you can suggest a site where I can view function descriptions ?
I tried to find it at msdn.microsoft.com but I failed. May be you can show a link or something.
I think it would be interesting to all newbies. Thank you.

MichaelW

As far as I know all message boxes are modal dialogs, so an app cannot open more than one because the app that opened the message box is disabled until the message box is closed. One (possibly too difficult) way to get around this limitation would be to create your own message box as a modeless dialog.

MSDN: MessageBox Function

MSDN: About Dialog Boxes

MSDN: Using Dialog Boxes


eschew obfuscation


Slugsnack

You could potentially make a MessageBox appear modeless by putting the call in a procedure then creating a new thread there each time you want to make one appear.

hutch--

Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

MichaelW

I wasn't thinking too well when I replied. The modal/modeless behavior depends on the message box (or any other modal dialog) having an owner window. If the message box has an owner window then that window will be disabled until the message box is closed. If the message box has no owner window then it will operate independently of the app that opened it. So if you specify 0 for the hWnd parameter then you can open multiple message boxes. The problem with this method is that the message boxes will not be automatically closed when the owner window is closed. A modeless message box with an owner window would not disable the owner window, so it could create multiple message boxes, but closing the owner window would cause the system to automatically close all of the message boxes it owned. The attachment contains an example that shows the effect for a normal message box.
eschew obfuscation

RotateRight

#7
[]