tagging release
[dasher.git] / trunk / Src / Win32 / Widgets / SplashScreen.cpp
blobe84937b8025ae60d381ceeee5a5f6f794455fff9
1 // SplashScreen.cpp
2 //
3 /////////////////////////////////////////////////////////////////////////////
4 //
5 // Copyright (c) 2002 David Ward
6 //
7 /////////////////////////////////////////////////////////////////////////////
9 #include "WinCommon.h"
11 #include "SplashScreen.h"
13 // Track memory leaks on Windows to the line that new'd the memory
14 #ifdef _WIN32
15 #ifdef _DEBUG
16 #define DEBUG_NEW new( _NORMAL_BLOCK, THIS_FILE, __LINE__ )
17 #define new DEBUG_NEW
18 #undef THIS_FILE
19 static char THIS_FILE[] = __FILE__;
20 #endif
21 #endif
23 /////////////////////////////////////////////////////////////////////////////
25 LRESULT CSplash::WndProc(HWND Window, UINT message, WPARAM wParam, LPARAM lParam) {
26 return TmpWndProc(Window, message, wParam, lParam);
29 LRESULT CALLBACK CSplash::TmpWndProc(HWND Window, UINT message, WPARAM wParam, LPARAM lParam) {
30 HDC hdc;
31 PAINTSTRUCT ps;
33 switch (message) {
34 case WM_CREATE:
35 return 0;
36 break;
37 case WM_PAINT:
38 hdc = BeginPaint(Window, &ps);
39 RECT rt;
40 GetClientRect(Window, &rt);
41 FillRect(hdc, &rt, (HBRUSH) GetStockObject(WHITE_BRUSH));
42 DrawText(hdc, TEXT("Dasher Initializing - Please Wait"), -1, &rt, DT_VCENTER | DT_CENTER | DT_SINGLELINE);
43 EndPaint(Window, &ps);
44 return 0;
45 break;
46 case WM_SIZE:
47 // Center & size window
48 int Width, Height;
49 Width = 300;
50 Height = 200;
51 MoveWindow(Window, GetSystemMetrics(SM_CXSCREEN) / 2 - Width / 2, GetSystemMetrics(SM_CYSCREEN) / 2 - Height / 2, Width, Height, TRUE);
52 return 0;
54 case WM_LBUTTONDOWN:
55 SendMessage(Window, WM_CLOSE, 0, 0);
56 return 0;
58 return DefWindowProc(Window, message, wParam, lParam);
61 CSplash::CSplash(HWND Parent) {
63 #ifdef DASHER_WINCE
64 WNDCLASS wndclass;
65 memset(&wndclass, 0, sizeof(WNDCLASS));
66 #else
67 WNDCLASSEX wndclass;
68 memset(&wndclass, 0, sizeof(WNDCLASSEX));
69 wndclass.cbSize = sizeof(wndclass);
71 #endif
72 wndclass.lpfnWndProc = TmpWndProc;
73 wndclass.hInstance = WinHelper::hInstApp;
74 wndclass.hbrBackground = (HBRUSH) GetStockObject(NULL_BRUSH);
75 wndclass.lpszClassName = TEXT("Splash");
77 #ifdef DASHER_WINCE
78 RegisterClass(&wndclass);
79 m_hwnd = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TOOLWINDOW, TEXT("Splash"), TEXT("Splash"), WS_POPUP | WS_VISIBLE, 0, 0, 0, 0, Parent, NULL, WinHelper::hInstApp, NULL);
81 #else
82 RegisterClassEx(&wndclass);
83 m_hwnd = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TOOLWINDOW, TEXT("Splash"), TEXT("Splash"), WS_POPUP | WS_VISIBLE, 0, 0, 0, 0, Parent, NULL, WinHelper::hInstApp, NULL);
85 #endif
87 WinWrapMap::add(m_hwnd, this);
88 UpdateWindow(m_hwnd);