bool Myazo::InitWindowClass(void) { Handle Cursor(LoadCursor(Instance,MAKEINTRESOURCE(IDC_CURSOR1)),[](void* Obj){if(Obj) DestroyCursor((HCURSOR)Obj);}), Icon(LoadImage(Instance,MAKEINTRESOURCE(IDI_ICON1),IMAGE_ICON,32,32,0),[](void* Obj){if(Obj) DeleteObject(Obj);}), IconSmall(LoadImage(Instance,MAKEINTRESOURCE(IDI_ICON1),IMAGE_ICON,16,16,0),[](void* Obj){if(Obj) DeleteObject(Obj);}); WNDCLASSEX WndClass; ZeroMemory(&WndClass,sizeof(WndClass)); WndClass.cbSize=sizeof(WndClass); WndClass.lpfnWndProc=WndProc; WndClass.hInstance=GetModuleHandle(nullptr); WndClass.hIcon=(HICON)Icon.get(); WndClass.hIconSm=(HICON)IconSmall.get(); WndClass.hCursor=(HCURSOR)Cursor.get(); WndClass.lpszClassName=L"MyazoMainWindow"; MainWindow=DialogWindow(WndClass); if(!MainWindow.Register()) return false; WndClass.style=CS_VREDRAW|CS_HREDRAW; WndClass.hbrBackground=CreateSolidBrush(RGB(100,100,100)); WndClass.lpfnWndProc=LayerWndProc; WndClass.lpszClassName=L"MyazoLayerWindow"; LayerWindow=DialogWindow(WndClass); if(!LayerWindow.Register()) return false; WndClass.hbrBackground=(HBRUSH)COLOR_WINDOW; WndClass.lpfnWndProc=AuthWndProc; WndClass.hCursor=LoadCursor(nullptr,IDC_ARROW); WndClass.lpszClassName=L"MyazoAuthWindow"; AuthWindow=DialogWindow(WndClass); if(!AuthWindow.Register()) return false; return true; }
/////////////////////////////////////////////////////////////////////// /// Function: DialogProc /// /// Author: $author$ /// Date: 1/29/2012 /////////////////////////////////////////////////////////////////////// static BOOL CALLBACK DialogProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { BOOL result = FALSE; XosWinDialogWindow* dialogWindow; if ((dialogWindow = DialogWindow(hWnd, msg, wParam, lParam))) { dialogWindow->OnWindowMessage(hWnd, msg, wParam, lParam); return result; } switch(msg) { case WM_COMMAND: switch(LOWORD(wParam)) { case IDOK: case IDYES: case IDRETRY: case IDIGNORE: case IDNO: case IDABORT: case IDCANCEL: DestroyWindow(hWnd); break; } break; } return result; }