正在加载图片...
4 WIndows编程基础 [例 Ex Hellowin]一个完整的 Windows应用程序。 #include <windows.h> LRESULT CALLBACK Wnd Proc(HWND, UINT, WPARAM, LPARAM);∥/窗口过程 nt WiNAPi Win Main(HINSTANCE hInstance, hinSTaNCe hPrevinstance, LPSTR pCmdLine, int nCmdShow) HWND hwnd i ∥/窗口句柄 MSG msg i ∥/消息 WNDCLASS wndclass ∥/窗口类 wndclass style =CS_HREDRAWI CS-VREDRAW i wndclass. IpfnWndProc= WndProc wndclass. cbClsExtra 0 wndclass. cbWndExtra=0i wndclass hInstance= hInstance wndclass hIcon= LoadIcon(NULL, IDI_ APPLICATION); wndclass h Cursor= Load Cursor(NULL, IDC_ARROW)i wndclass hbr Background= (HBRUSH) GetstockObject(WHITE_BRUSH) wndclass. IpszMenuName= NUL wndclass. IpszclassName=“" Hellowin”; ∥/窗口类名 if (!RegisterClass( &wndclass)) /注册窗口 MessageBox(NUL,"窗口注册失败!"," Hellowin",0); return 04.1Windows编程基础 [例Ex_HelloWin] 一个完整的Windows应用程序。 #include <windows.h> LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); // 窗口过程 int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HWND hwnd ; // 窗口句柄 MSG msg ; // 消息 WNDCLASS wndclass ; // 窗口类 wndclass.style = CS_HREDRAW | CS_VREDRAW ; wndclass.lpfnWndProc= WndProc ; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra= 0 ; wndclass.hInstance= hInstance ; wndclass.hIcon= LoadIcon (NULL, IDI_APPLICATION) ; wndclass.hCursor= LoadCursor (NULL, IDC_ARROW) ; wndclass.hbrBackground= (HBRUSH) GetStockObject (WHITE_BRUSH) ; wndclass.lpszMenuName= NULL ; wndclass.lpszClassName= “HelloWin”; // 窗口类名 if (!RegisterClass (&wndclass)) // 注册窗口 { MessageBox (NULL, "窗口注册失败!", "HelloWin", 0) ; return 0 ; }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有