xref: /reactos/base/applications/shutdown/gui.c (revision 3e1f4074)
1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS shutdown/logoff utility
4  * FILE:            base/applications/shutdown/gui.c
5  * PURPOSE:         Shows a GUI used for managing multiple remote shutdown/restarts
6  * PROGRAMMERS:     Lee Schroeder
7  */
8 
9 #include "precomp.h"
10 
11 INT_PTR CALLBACK ShutdownGuiProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
12 {
13     switch(msg)
14     {
15         case WM_INITDIALOG:
16             break;
17 
18         case WM_COMMAND:
19             switch(LOWORD(wparam))
20             {
21                 case IDC_OK:
22                     EndDialog(hwnd, IDC_OK);
23                     break;
24                 case IDC_CANCEL:
25                     EndDialog(hwnd, IDC_CANCEL);
26                     break;
27             }
28             break;
29 
30         case WM_CLOSE:
31             EndDialog(hwnd, 0);
32             break;
33 
34         default:
35             return FALSE;
36     }
37 
38     return TRUE;
39 }
40 
41 /*
42  * NOTE: Until the ability to shutdown computers remotely, the GUI feature
43  * can't be fully implemented.
44  */
45 BOOL ShutdownGuiMain(struct CommandLineOptions opts)
46 {
47     INT_PTR result = DialogBoxW(GetModuleHandle(NULL),
48                                 MAKEINTRESOURCEW(IDD_GUI),
49                                 NULL,
50                                 ShutdownGuiProc);
51 
52     switch (result)
53     {
54         case IDC_OK:
55             MessageBoxW(NULL, L"This function is unimplemented.", L"Unimplemented", MB_OK);
56             break;
57 
58         case IDC_CANCEL:
59             /* Exits the program */
60             break;
61 
62         default:
63             MessageBoxW(NULL, L"Dialog Error!", L"Message", MB_OK);
64             return FALSE;
65     }
66 
67     return TRUE;
68 }
69 
70 /* EOF */
71