Lesson 1 Windows 程序内部运行机制。
1 . MSG
typedef struct tagMSG { HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; DWORD time; POINT pt; } MSG, *PMSG;
2. WinMain函数 windows 应用程序的入口点
int WINAPI WinMain( HINSTANCE hInstance, // handle to current instance HINSTANCE hPrevInstance, // handle to previous instance LPSTR lpCmdLine, // command line int nCmdShow // show state );
3.窗口的创建
a.设计一个窗口类
b.注册窗口类
ATOM RegisterClass(CONST WNDCLASS *lpWndClass // class data);
c.创建窗口
HWND CreateWindow( LPCTSTR lpClassName, // registered class name LPCTSTR lpWindowName, // window name DWORD dwStyle, // window style int x, // horizontal position of window int y, // vertical position of window int nWidth, // window width int nHeight, // window height HWND hWndParent, // handle to parent or owner window HMENU hMenu, // menu handle or child identifier HINSTANCE hInstance, // handle to application instance LPVOID lpParam // window-creation data );
d.显示及更新窗口
ShowWindow 与 updateWindow
e.消息循环while(getMessage()) TranslateMessage 与 DispatchMessage
f.callback windowProc()函数的编写