update for HEAD-2003091401
[reactos.git] / subsys / system / explorer / winefile / plugins / ex_shutdwn.c
1 //
2 // Explorer Shutdown PlugIn
3 // 
4 // Alexander Ciobanu
5 // alex@prodidactica.md
6 //
7
8 #include <windows.h>
9 #include <stdio.h>
10
11 #include "ex_bar.h"
12
13 HWND ShwButton;
14 HWND Wnd;
15
16 int ex_x1;
17 int ex_y1;
18 int ex_dx;
19 int ex_dy;
20
21 // Initialize the plugin
22 //
23 static int InitializePlugIn(HWND ExplorerHandle)
24 {
25   fprintf(stderr,"EX_SHUTDWN : INITIALIZE PLUGIN call\n");
26
27   ShwButton = CreateWindow(
28     TEXT("BUTTON"),TEXT("+"),WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
29       ex_dx+ex_x1-33, 4, 25, ex_dy-14, ExplorerHandle, NULL, 
30      (HINSTANCE) GetWindowLong(ExplorerHandle, GWL_HINSTANCE),NULL);
31
32   return 1;
33 }
34
35 // Get Information about the plugin
36 //
37 static char* PlugInInfo(int InfoNmbr)
38 {
39   static char Info[256];
40
41   fprintf(stderr,"EX_SHUTDWN : INFORMATION PLUGIN call\n");
42
43   switch(InfoNmbr)
44   {
45     case 0:                                   // PlugIn Name
46      strcpy(Info,"ReactOSShutdown");
47      break;
48
49     case 1:                                   // Version
50      strcpy(Info,"0.1");
51      break;
52
53     case 2:                                   // Vendor name
54      strcpy(Info,"ReactOS team");
55      break;
56
57     default:                                  // Default : Error
58      strcpy(Info,"-");
59      break;
60  
61   }
62
63   return Info;
64 }
65
66 // Reload plugin's configuration
67 //
68 static int ReloadPlugInConfiguration()
69 {
70   fprintf(stderr,"EX_SHUTDWN : RELOAD PLUGIN COFIGURATION call\n");
71   return 1;
72 }
73
74 // Quit plugin
75 //
76 static int QuitPlugIn()
77 {
78   fprintf(stderr,"EX_SHUTDWN : QUIT PLUGIN call\n");
79   return 1;
80 }
81
82 // Callback procedure for plugin
83 //
84 static int PlugInMessageProc(HWND PlgnHandle, UINT Msg, WPARAM wParam, LPARAM lParam)
85 {
86   
87  // The plugin must decide whatever the handle passed is created by it !
88  // Sorry for bad english :-)
89  //
90  switch(Msg)
91   {
92    case WM_COMMAND:
93         if ((HWND)lParam==ShwButton)
94           {
95             printf("Pressed ShutDown Button : \n");
96             DestroyWindow(PlgnHandle);
97           }
98     break;
99   }
100
101   return 1;
102 }
103
104 static int ExplorerInfo(EXBARINFO* info)
105 {
106   fprintf(stderr,"EX_SHUTDWN : EXPLORER INFO PLUGIN call\n");
107   ex_x1=info->x;
108   ex_y1=info->y;
109   ex_dx=info->dx;
110   ex_dy=info->dy;
111
112   return 1;
113 }
114
115 #ifdef _PLUGIN
116 BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
117 {
118   fprintf(stderr,"EX_SHUTDWN PlugIn loaded succesefully\n");
119   return TRUE;
120 }
121 #endif
122
123
124 struct PluginCalls plugincalls_Shutdown = {
125         InitializePlugIn,
126         QuitPlugIn,
127         ReloadPlugInConfiguration,
128         PlugInInfo,
129         ExplorerInfo,
130         PlugInMessageProc
131 };
132