People talk to other people and exchange their inputs via verbal dialogs. Dialog boxes are the medium to talk to its users and collect their inputs. A dialog box usually contains one or more controls/widgets with which the user enters text, chooses options, or directs the action of the command. Dialog boxes are primarily of two types - modal and modeless.
Modal dialog creates an UI thread and pops above parent window. This dialog gets curser focus on top of parent window and completely blocks parent. Parent windows cannot get focus until dialog closes. About box of any application is a good example of modal dialog.
DialogBox function which is basically a macro creates a modal dialog box from a dialog box template resource. DialogBox does not return control until the specified callback function terminates the modal dialog box by calling the EndDialog function. The DialogBox macro uses the DialogBoxParam function.
Modeless dialog is one which opens on top of parent window but still parent can get focus and process events. Modeless dialog does not block parent window and this is needed when users need to enter frequent inputs and same time want to get the reflection in the parent window. Find/Replace dialog is a good example of modeless dialog.
CreateDialog macro creates a modeless dialog box from a dialog box template resource. The CreateDialog macro uses the CreateDialogParam function.
About our authors: Team EQA
MFC hides WinMain in its framework and includes source file on WinMain(). This explains how framework calls global CWinApp::Initinstance() from entry WinMain.
This is constructed during global C++ objects are constructed and is already available when Windows calls the WinMain function, which is supplied by the ...
Define a custom Window class structure, Register the class name, CreateWindow, Show windows and write message get and dispatch loop statements. Define the Window CallBack procedure and write the handlers.
DispatchMessage() is a API which indirectly triggers the Window CallBack procedure. Message structure members from this function are passed to the CallBack procedure. CallBack procedure should implement event handlers depending on the need of the application.
LPARAM and WPARAM are the two parameters in Window CallBack procedure. They signifies parameters of various events. They are used in handing individual events.
We need to write WinMain and need to follow all these in a Win32 application. However we need not to write much if we are writing an application with MFC ...
Learn on Youtube