Advertisement
Guest User

Untitled

a guest
May 2nd, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  3. {
  4.  
  5.  
  6.     switch (message)
  7.     {
  8.     case WM_NOTIFY:
  9.     {
  10.         HWND hCtrlWnd = GetDlgItem(hWnd, wParam);
  11.  
  12.         base_window *c = (base_window *)GetWindowLong((HWND)hCtrlWnd, GWLP_USERDATA);
  13.  
  14.         if (c != NULL) {
  15.             return c->WindowProc(hWnd, message, wParam, lParam);
  16.  
  17.         }
  18.  
  19.         //Handle other messages
  20.     }
  21.     break;
  22.     case WM_COMMAND:
  23.         {
  24.  
  25.             //If this window class, has a custom wndprc
  26.             base_window *c = (base_window *)GetWindowLong((HWND)lParam, GWLP_USERDATA);
  27.  
  28.             if (c != NULL) {
  29.                 return c->WindowProc(hWnd, message, wParam, lParam);
  30.  
  31.             }
  32.  
  33.             //Handle other messages
  34.             int wmId = LOWORD(wParam);
  35.  
  36.             switch (wmId)
  37.             {
  38.             case IDM_ABOUT:
  39.                 DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
  40.                 break;
  41.             case IDM_EXIT:
  42.                 DestroyWindow(hWnd);
  43.                 break;
  44.             default:
  45.                 return DefWindowProc(hWnd, message, wParam, lParam);
  46.             }
  47.         }
  48.         break;
  49.     case WM_SIZE:
  50.  
  51.         objManager.resizeWindows(hWnd, message, wParam, lParam);
  52.  
  53.         break;
  54.     case WM_DESTROY:
  55.         PostQuitMessage(0);
  56.         break;
  57.     default:
  58.         return DefWindowProc(hWnd, message, wParam, lParam);
  59.     }
  60.  
  61.     return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement