/* * wndframe.cpp * * # ウィンドウベースのアプリケーションスケルトン */ #include const char szClassName[]="app name"; LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM); int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { // ウィンドウクラスの登録 WNDCLASSEX wc; wc.cbClsExtra = 0; wc.cbSize = sizeof(WNDCLASSEX); wc.cbWndExtra = 0; wc.hbrBackground = (HBRUSH)(COLOR_INFOBK+1); wc.hCursor = ::LoadCursor(NULL,MAKEINTRESOURCE(IDC_ARROW)); wc.hIcon = NULL; wc.hIconSm = NULL; wc.hInstance = hInstance; wc.lpfnWndProc = (WNDPROC)WndProc; wc.lpszClassName = szClassName; wc.lpszMenuName = NULL; wc.style = CS_HREDRAW|CS_VREDRAW; ::RegisterClassEx(&wc); // ウィンドウの表示 HWND hWnd= ::CreateWindow(szClassName,szClassName, WS_OVERLAPPEDWINDOW&~WS_MAXIMIZEBOX, 100,100,400,300, NULL,NULL,hInstance,0); if ( hWnd==NULL ) return 0; ::ShowWindow(hWnd,nCmdShow); // メッセージループ MSG msg; while ( ::GetMessage(&msg,NULL,0,0) ) { ::TranslateMessage(&msg); ::DispatchMessage(&msg); } return 0; } // ウィンドウプロシージャ LRESULT CALLBACK WndProc(HWND in_hWnd, UINT in_Message, WPARAM in_wParam, LPARAM in_lParam) { switch ( in_Message ) { case WM_DESTROY: ::PostQuitMessage(0); break; default: return ::DefWindowProc(in_hWnd, in_Message,in_wParam,in_lParam); } return 0; }