Maximize MenuMinimize Menu

 

 

Trajecto's Win32 API Programming Tutorial for Pocket PC

All about MessageBox

The MessageBox function is prototyped as

int MessageBox (HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType);

 

Study the tables below to fully customize your own message boxes

 

MessageBox Parameters
ParameterPurpose
HWND hWnd Handle to the top-level parent window
LPCTSTR lpText Text that appears in the window
LPCTSTR lpCaption Title bar text
UINT uType Flag that specifies the MessageBox appearance (see table below)

 

Default MessageBox Flags
FlagsButton or Icon
For Buttons:  
MB_OKOK
MB_OKCANCELOK and Cancel
MB_RETRYCANCELRetry and Cancel
MB_YESNOYes and No
MB_YESNOCANCELYes, No and Cancel
MB_ABORTRETRYIGNOREAbort, Retry and Ignore
For Icons:  
MB_ICONEXCLAMATION, MB_ICONWARNING
Exclamation point
MB_ICONINFORMATION, MB_ICONASTERISK Lower case i within a circle
MB_ICONQUESTIONQuestion mark
MB_YESNOYes and No
MB_ICONSTOP, MB_ICONERROR, MB_ICON_HANDStop sign
MB_DEFBUTTON1First button
MB_DEFBUTTON2Second button
MB_DEFBUTTON3Third button
For Windows Styles: 
MB_SETFOREGROUNDBring the message box to the foreground
MB_TOPMOSTMake the message box the top-most window
The return value from MessageBox indicates the button pressed by the user.
IDOKOK button pressed
IDYESYes button pressed
IDNONo button pressed
IDCANCELCancel button pressed or escape key pressed
IDABORTAbort button pressed
IDRETRYRetry button pressed
IDIGNOREIgnore button pressed

 

SAMPLES

MB_OK

MB_ICONEXCLAMATION

MB_ICONINFORMATION

MB_YESNO

MB_ICONSTOP

MB_YESNOCANCEL

 

Radiosity Games
See our new game site


©Copyright TrajectoryLabs.com. All Rights Reserved.