在基于C语言的窗口创建过程中,遵循设计窗口、注册窗口、创建窗口、显示和更新窗口、消息循环及窗口过程函数六个步骤。
不同于传统的C语言编程,在基于窗口的程序中,通常入口是 WinMain()
不同于传统的C语言编程,在基于窗口的程序中,通常入口是 WinMain()
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
MSG msg;
WNDCLASSA wndclass;
g_hInstance = hInstance;
g_hWnd = NULL;
g_keyboard = NULL;
g_mouse = NULL;
g_timer = NULL;
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC | CS_DBLCLKS;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH) GetStockObject (BLACK_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszCl