/* 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 "ZMWSMonitorSplash.h" LRESULT CALLBACK SplashDlgProc(HWND, UINT, WPARAM, LPARAM); static HWND hSplashDlg = 0; static UINT hideTempo; void ShowSplash (HINSTANCE parentInstance, HWND parenthWnd, UINT elapse) { hideTempo = elapse; hSplashDlg = CreateDialog(parentInstance, (LPCTSTR)IDD_SPLASH, parenthWnd, (DLGPROC)SplashDlgProc); if (hSplashDlg) { #ifdef ZAZOUNT ShowWindow (hSplashDlg, SW_SHOW); #else AnimateWindow (hSplashDlg, 500, AW_BLEND); #endif } } // Cache le splash void HideSplash () { if (hSplashDlg) { DestroyWindow (hSplashDlg); hSplashDlg = 0; } } // Gestionnaire de messages pour le splash LRESULT CALLBACK SplashDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { static UINT_PTR Timer = 1; // UINT_PTR est un unigned int, pas un pointeur !!! switch (message) { case WM_INITDIALOG: if (hideTempo) { Timer = SetTimer (hDlg, Timer, hideTempo, NULL); if (!Timer) { #ifdef ZAZOUNT ShowWindow (hSplashDlg, SW_HIDE); #else AnimateWindow (hSplashDlg, 500, AW_BLEND | AW_HIDE); #endif } } return TRUE; break; case WM_TIMER: if (Timer == UINT_PTR(wParam)) { KillTimer (hDlg, Timer); #ifdef ZAZOUNT ShowWindow (hSplashDlg, SW_HIDE); #else AnimateWindow (hSplashDlg, 500, AW_BLEND | AW_HIDE); #endif DestroyWindow (hDlg); return TRUE; } break; case WM_DESTROY: hSplashDlg = 0; return DefWindowProc(hDlg, message, wParam, lParam); break; default: return DefWindowProc(hDlg, message, wParam, lParam); } return FALSE; }