Intro to Windows Programming
Intro to Windows Programming. Basic Ideas. Program Entry Point. Int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) Acts as an entry point just as a main function would act in a C program. Common Header Files. WINDEF.H – Basic type definitions.
Intro to Windows Programming
E N D
Presentation Transcript
Intro to Windows Programming Basic Ideas
Program Entry Point • Int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) • Acts as an entry point just as a main function would act in a C program.
Common Header Files • WINDEF.H – Basic type definitions. • WINNT.H – Type definitions for Unicode support • WINBASE.H – Kernel functions. • WINUSER.H – User interface functions • WINGDI.H – Graphics device interface functions.
Message Box function • int WINAPI messageBox (HWND,LPCSTR,LPCSTR, UINT) • Acts as a way do display a message onto the screen.
Different String Functions • ILength • pString • IComp • They can do a variety of things such as calculate string lengths, copy strings, concatenate strings, and compare strings.
Handles • HINSTANCE – Handle to an “instance” – the program itself • HWND – Handle to the window • HDC – Handle to a device context • The type of the object allows your program to know how to use the handle
Data Structures • MSG – Message structure • WNDCLASS – Window class structure • PAINTSTRUCTURE – Paint structure • RECT – Rectangle structure • First two data structures are used in WinMain and the second two are used in WndProc
Other Messages • wParm – a 32-bit message parameter dependent on the particcular message • lParam – same as above • Pt – mouse coordinates at the time the message was placed in the message queue