/* ZazouMiniWebServer Copyright (C) 2003-2009 Xavier Garreau This file is part of ZazouMiniWebServer. ZazouMiniWebServer is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. ZazouMiniWebServer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with ZazouMiniWebServer; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include "stdafx.h" #include #include #include "ZazouMiniWebServerMonitor.h" #include "ZMWSConsole.h" #include "ZMWSMonitorSplash.h" #include "ZMWSMonitorPlugins.h" #define MAX_LOADSTRING 100 #define ZWMS_MESSAGE WM_USER // Variables globales : // ToDo: A mettre dans une structure ? static HINSTANCE g_hInst; // instance actuelle static HWND g_hWnd; // notre fenêtre static CHAR g_szTitle[MAX_LOADSTRING]; // Le texte de la barre de titre static CHAR g_szWindowClass[MAX_LOADSTRING]; // le nom de la classe de fenêtre principale CBaseZMWSConfig zmws_base_config; // La configuration du serveur static UINT ZMWSSTOPMESSAGE; // Pré-déclarations des fonctions incluses dans ce module de code : BOOL InitInstance (HINSTANCE, int); LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK AboutDlgProc (HWND, UINT, WPARAM, LPARAM); void AddTrayIcon (); int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { NOTIFYICONDATA nid; MSG msg; HACCEL hAccelTable; // Initialise les chaînes globales LoadString(hInstance, IDS_APP_TITLE, g_szTitle, MAX_LOADSTRING); LoadString(hInstance, IDC_ZAZOUMINIWEBSERVERMONITOR, g_szWindowClass, MAX_LOADSTRING); // Effectue l'initialisation de l'application : if (!InitInstance (hInstance, nCmdShow)) { return FALSE; } ShowSplash(hInstance, g_hWnd, 2000); hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_ZAZOUMINIWEBSERVERMONITOR); // Ajoute l'icône au tray AddTrayIcon (); // Lance le serveur LPSTR cmdLine = GetCommandLine(); LPSTR cmdOpts = lpCmdLine; while (cmdOpts[strlen(cmdOpts)-1]==' ') cmdOpts[strlen(cmdOpts)-1]='\0'; size_t lenLine = strlen(cmdLine); size_t lenOpts = strlen(cmdOpts); int argc = 1; size_t i; if (lenOpts) { ++argc; for (i=0; i