Consider a simple program like below,
INCLUDE \masm32\include\masm32rt.inc
.DATA
caption DB "Caption", 0
text DB "Message", 0
.CODE
start:
INVOKE MessageBox, NULL, ADDR text, ADDR caption, MB_OK
INVOKE ExitProcess, NULL
END start
It's a Windows program, but we don't have to create the window, register the class, or process messages. Why?
Quote from: bf2 on October 24, 2011, 07:31:22 PMIt's a Windows program, but we don't have to create the window, register the class, or process messages. Why?
Because this is done by the function
MessageBox :U
Hi bf2,
You can consider the MessageBox function as a code template built to display a predefined dialog box needing only the four parameters you pass.
MessageBox does have a registered class, WndProc, and message loop - just like any other window
the operating system provides them all for you :U
the same is true for all dialogs, buttons, and other controls
sometimes, even text or icons have a window if they are in a "static" control
even the desktop is a window
it may seem like a lot of resources for just a button :P
but - the OS has to take care of all apples - no oranges
This is probably in the "needless detail" category, but it's possible to use a private class for a dialog, instead of the standard system-defined class, and for a modeless dialog the application must provide a message loop.