1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/** (c) Nullsoft, Inc. C O N F I D E N T I A L
** Filename:
** Project:
** Description:
** Author:
** Created:
**/
#include "Main.h"
#define SPLASH_TIMER 34
//#define MODAL_SPLASHSCREEN
static INT_PTR CALLBACK splashFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
static int wait;
void splashDlg(int wait_in_ms)
{
wait = wait_in_ms;
#ifdef MODAL_SPLASHSCREEN
DialogBox(hMainInstance, MAKEINTRESOURCE(IDD_SPLASH), NULL, splashFunc);
#else
CreateDialogW(hMainInstance, MAKEINTRESOURCE(IDD_SPLASH), NULL, splashFunc);
#endif
}
static INT_PTR CALLBACK splashFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
RECT r;
switch (uMsg)
{
case WM_INITDIALOG:
GetWindowRect(GetDlgItem(hwndDlg, IDC_SPLASHIMG), &r);
SetWindowPos(hwndDlg, 0, 0, 0, r.right - r.left, r.bottom - r.top, SWP_NOMOVE | SWP_NOZORDER);
SetTimer(hwndDlg, SPLASH_TIMER, wait, NULL);
return 0;
case WM_KEYDOWN:
case WM_LBUTTONDOWN: case WM_RBUTTONDOWN:
#ifdef MODAL_SPLASHSCREEN
EndDialog(hwndDlg, 0);
#else
DestroyWindow(hwndDlg);
#endif
return 0;
case WM_TIMER:
if (wParam == SPLASH_TIMER)
{
#ifdef MODAL_SPLASHSCREEN
EndDialog(hwndDlg, 1);
#else
DestroyWindow(hwndDlg);
#endif
}
return 0;;
}
return 0;
}
|