Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Detects updates to the planet adding dialog.
- BOOL CALLBACK dialogAddProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
- switch (Message) {
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case btnOK: // OK button
- if (!addPlanetSend())
- MessageBox(hwnd, "Please enter all fields!", "Error", 0);
- else
- ShowWindow(dialogAdd, SW_HIDE);
- break;
- case btnCancel: // Cancel button
- ShowWindow(dialogAdd, SW_HIDE);
- break;
- }
- break;
- case WM_CLOSE: // Window is closed
- ShowWindow(dialogAdd, SW_HIDE);
- return TRUE;
- }
- return FALSE;
- }
- BOOL CALLBACK dialogMainProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
- switch (Message) {
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case btnAdd: // Add planet button
- ShowWindow(dialogAdd, SW_SHOW);
- break;
- case btnRemove: // Remove planets button
- removePlanets(hwnd);
- break;
- case btnOpen: // Open from file button
- openPlanets(hwnd);
- break;
- case btnSave: // Save to file button
- savePlanets();
- break;
- case btnSend: // Send to server button
- sendPlanets(hwnd);
- break;
- case dlgAdd: // Receive form valus from the other dialog
- addPlanetReceive(hwnd, (createPlanetCommand*)lParam);
- break;
- }
- break;
- case WM_INITDIALOG: // Startup
- threadCreate(watchServerPlanets, hwnd);
- break;
- case WM_DESTROY: // Window is destroyed
- PostQuitMessage(0);
- return TRUE;
- case WM_CLOSE: // Window is closed
- DestroyWindow(hwnd);
- return TRUE;
- }
- return FALSE;
- }
Advertisement
Add Comment
Please, Sign In to add comment