标签:
目录:
子窗口与主窗口的交互
创建窗口要:注册窗口类型 和 创造相应窗口实例
1 //注册窗口类型 2 wndclass.style = CS_HREDRAW | CS_VREDRAW ; 3 wndclass.lpfnWndProc = WndProc ; 4 wndclass.cbClsExtra = 0 ; 5 wndclass.cbWndExtra = 0 ; 6 wndclass.hInstance = hInstance ; 7 wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ; 8 wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ; 9 wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ; 10 wndclass.lpszMenuName = NULL ; 11 wndclass.lpszClassName = szAppName ; 12 13 if (!RegisterClass (&wndclass)) 14 { 15 MessageBox (NULL, TEXT ("This program requires Windows NT!"), 16 szAppName, MB_ICONERROR) ; 17 return 0 ; 18 }
1 //创建窗口实例 2 hwnd = CreateWindow (szAppName, // window class name 3 TEXT ("The Hello Program"), // window caption 4 WS_OVERLAPPEDWINDOW, // window style 5 CW_USEDEFAULT, // initial x position 6 CW_USEDEFAULT, // initial y position 7 CW_USEDEFAULT, // initial x size 8 CW_USEDEFAULT, // initial y size 9 NULL, // parent window handle 10 NULL, // window menu handle 11 hInstance, // program instance handle 12 NULL) ; // creation parameters 13 14 ShowWindow (hwnd, iCmdShow) ; 15 UpdateWindow (hwnd) ;
标签:
原文地址:http://www.cnblogs.com/BensonLaur/p/5339846.html