using Dev C++
,Introduction to Window
Elements
, Window Program: Message
Box
#include<windows.h>
int _stdcall WinMain
( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszCmdline,
int nCmdShow)
{
MessageBox ( 0, "Hello!", "Title", 0 ) ;
return 0;
}
, Terms Used
_stdcall – conventional prefix • MessageBox (
WinMain() – main function for HWND hWnd, /*Handle for the parent
windows prog window*/
HINSTANCE – typedef for unsigned LPCSTR lpszText, /* Text to be displayed
int */
LPCSTR lpszTitle, /*Title of the message
LPSTR – typedef for char *
box */
HINSTANCE hInstance – window ID int nButtons
HINSTANCE hPrevInstance – prev /*Bottons or icons to be displayed*/
window info );
LPSTR lpszCmdline – similar to argv Examples:
(command line arguments) • MessageBox ( 0, lpszCmdline, "Title", 0 ) ;
int nCmdShow – window type (max, • MessageBox ( 0, “Are you sure”,
normal or min) “Confirmation”, MB_YESNO ) ;
• MessageBox ( 0, “Print to the Printer”,
MessageBox() – Can be used for
“Caption”, MB_YESNOCANCEL) ;
displaying the message and pausing
• MessageBox ( 0, “icon is all about style”,
the program control just like getch()