DavidNorgren

Untitled

Feb 25th, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.58 KB | None | 0 0
  1. // Detects updates to the planet adding dialog.
  2. BOOL CALLBACK dialogAddProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
  3.     switch (Message) {
  4.         case WM_COMMAND:
  5.             switch (LOWORD(wParam)) {
  6.                 case btnOK: // OK button
  7.                     if (!addPlanetSend())
  8.                         MessageBox(hwnd, "Please enter all fields!", "Error", 0);
  9.                     else
  10.                         ShowWindow(dialogAdd, SW_HIDE);
  11.                     break;
  12.                 case btnCancel: // Cancel button
  13.                     ShowWindow(dialogAdd, SW_HIDE);
  14.                     break;
  15.             }
  16.             break;
  17.         case WM_CLOSE: // Window is closed
  18.             ShowWindow(dialogAdd, SW_HIDE);
  19.             return TRUE;
  20.     }
  21.     return FALSE;
  22. }
  23.  
  24. BOOL CALLBACK dialogMainProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
  25.     switch (Message) {
  26.         case WM_COMMAND:
  27.             switch (LOWORD(wParam)) {
  28.                 case btnAdd: // Add planet button
  29.                     ShowWindow(dialogAdd, SW_SHOW);
  30.                     break;
  31.                 case btnRemove: // Remove planets button
  32.                     removePlanets(hwnd);
  33.                     break;
  34.                 case btnOpen: // Open from file button
  35.                     openPlanets(hwnd);
  36.                     break;
  37.                 case btnSave: // Save to file button
  38.                     savePlanets();
  39.                     break;
  40.                 case btnSend: // Send to server button
  41.                     sendPlanets(hwnd);
  42.                     break;
  43.                 case dlgAdd: // Receive form valus from the other dialog
  44.                     addPlanetReceive(hwnd, (createPlanetCommand*)lParam);
  45.                     break;
  46.             }
  47.  
  48.             break;
  49.         case WM_INITDIALOG: // Startup
  50.             threadCreate(watchServerPlanets, hwnd);
  51.             break;
  52.         case WM_DESTROY: // Window is destroyed
  53.             PostQuitMessage(0);
  54.             return TRUE;
  55.         case WM_CLOSE: // Window is closed
  56.             DestroyWindow(hwnd);
  57.             return TRUE;
  58.     }
  59.     return FALSE;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment