--- trunk/init/GPGOEInit.c 2006/03/24 13:36:54 1 +++ trunk/init/GPGOEInit.c 2006/03/24 16:43:49 2 @@ -19,35 +19,37 @@ */ #include - #include "resource.h" /*-- GPGOE DLL calls --*/ int gpgoe_initialize (void); int gpgoe_remove (void); + +/* Global hinstance for this module. */ static HINSTANCE glob_hinst = NULL; +/* Main procedure for the taskbar program. */ LRESULT CALLBACK gpgoe_main_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { NOTIFYICONDATA NID; int id; - switch (msg) - { + switch (msg) { case WM_CREATE: - NID.cbSize = sizeof(NID); + NID.cbSize = sizeof (NID); NID.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; NID.uCallbackMessage = WM_USER; NID.hWnd = hwnd; - NID.hIcon = LoadIcon(glob_hinst, MAKEINTRESOURCE(IDI_GPGOE)); - strcpy(NID.szTip, "GPG for Outlook Express"); + NID.hIcon = LoadIcon (glob_hinst, MAKEINTRESOURCE (IDI_GPGOE)); + strcpy (NID.szTip, "GPG for Outlook Express"); Shell_NotifyIcon (NIM_ADD, &NID); DestroyIcon (NID.hIcon); if (gpgoe_initialize ()) { - MessageBox (hwnd, "Couldn't register GPG OE hook", "Error", MB_ICONERROR|MB_OK); + MessageBox (hwnd, "Couldn't register GPG OE hook", + "Error", MB_ICONERROR|MB_OK); ExitProcess (0); } break; @@ -55,7 +57,7 @@ case WM_DESTROY: case WM_ENDSESSION: gpgoe_remove (); - Shell_NotifyIcon(NIM_DELETE, &NID); + Shell_NotifyIcon (NIM_DELETE, &NID); PostQuitMessage (0); ExitProcess (0); return 0; @@ -63,7 +65,7 @@ case WM_USER: switch (lparam) { case WM_LBUTTONDBLCLK: - SetForegroundWindow(hwnd); + SetForegroundWindow (hwnd); id = MessageBox (NULL, "Remove the GPG OE plug-in from the system?", "Are you sure?", MB_YESNO|MB_ICONINFORMATION); if (id == IDYES) @@ -88,10 +90,10 @@ case WM_COMMAND: if (LOWORD (wparam) == ID_INIT_QUIT) - SendMessage(hwnd, WM_DESTROY, 0, 0); + SendMessage (hwnd, WM_DESTROY, 0, 0); break; } - return DefWindowProc(hwnd, msg, wparam, lparam); + return DefWindowProc (hwnd, msg, wparam, lparam); } @@ -107,19 +109,21 @@ if (GetLastError () == ERROR_ALREADY_EXISTS) return 0; - memset(&wc, 0, sizeof(wc)); + memset (&wc, 0, sizeof(wc)); wc.hInstance = hinst; wc.lpszClassName = "GPGOE"; wc.lpfnWndProc = (WNDPROC)gpgoe_main_proc; - if (!RegisterClass(&wc)) { - MessageBox(NULL, "Couldn't register the window class", "Error", - MB_ICONERROR|MB_OK); - return 1; + if (!RegisterClass (&wc)) { + MessageBox (NULL, "Couldn't register the window class", + "Error", MB_ICONERROR|MB_OK); + return 1; } - hwnd = CreateWindow ("GPGOE", "GPGOE", 0, 0, 0, 0, 0, NULL, NULL, hinst, NULL); + hwnd = CreateWindow ("GPGOE", "GPGOE", 0, 0, 0, 0, 0, + NULL, NULL, hinst, NULL); if (!hwnd) { - MessageBox (NULL, "Couldn't create window", "Error", MB_ICONERROR|MB_OK); + MessageBox (NULL, "Couldn't create window", + "Error", MB_ICONERROR|MB_OK); return 1; } UpdateWindow (hwnd);