-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathABOUT.C
152 lines (117 loc) · 4.54 KB
/
ABOUT.C
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*-----------------------------------------------------------------------------
This is a part of the Microsoft Source Code Samples.
Copyright (C) 1995 Microsoft Corporation.
All rights reserved.
This source code is only intended as a supplement to
Microsoft Development Tools and/or WinHelp documentation.
See these sources for detailed information regarding the
Microsoft samples programs.
MODULE: About.c
PURPOSE: Implement the About dialog box for the program.
FUNCTIONS:
CmdAbout - Creates the About dialog in response to menu selection
AboutDlgProc - Processes messages for the About dialog
InitAboutDlg - Initialzes about dialog controls
-----------------------------------------------------------------------------*/
#include <windows.h>
#include "mttty.h"
/*
Prototypes for functions called only in this file
*/
BOOL CALLBACK AboutDlgProc( HWND, UINT, WPARAM, LPARAM );
UINT InitAboutDlg( HWND );
/*-----------------------------------------------------------------------------
FUNCTION: CmdAbout( HWND )
PARAMETERS:
hwnd - Owner of the window
PURPOSE: Creates the modal About dialog
-----------------------------------------------------------------------------*/
BOOL CmdAbout(HWND hwnd)
{
DialogBox(ghInst, MAKEINTRESOURCE(IDD_ABOUT), hwnd, AboutDlgProc);
return 0;
}
/*-----------------------------------------------------------------------------
FUNCTION: InitAboutDlg( HWND )
PURPOSE: Initializes the modal About dialog
PARMATETERS:
hDlg - Dialog window handle
COMMENTS: Sets the icon animation timer and the version info.
HISTORY: Date: Author: Comment:
10/27/95 AllenD Wrote it
-----------------------------------------------------------------------------*/
UINT InitAboutDlg(HWND hDlg)
{
UINT uTimer;
TCHAR * szFormat = _T("Microsoft Windows %s\r\nVersion %d.%d\r\nBuild %d ");
#ifdef CAN_USE_GETVERSIONINFOEX
TCHAR szVersion[256];
#endif
/*
create timer and set initial icon id
*/
uTimer = SetTimer(hDlg, 1, 100, NULL);
if (uTimer == 0)
ErrorReporter(_T("SetTimer"));
#ifdef CAN_USE_GETVERSIONINFOEX
StringCchPrintf(szVersion, 256, szFormat,
gOSV.dwPlatformId == VER_PLATFORM_WIN32_NT ? _T("NT") : _T("95"),
gOSV.dwMajorVersion,
gOSV.dwMinorVersion,
LOWORD( gOSV.dwBuildNumber ) );
if (_tcslen(gOSV.szCSDVersion))
_tcscat_s(szVersion, 256, gOSV.szCSDVersion);
SetDlgItemText(hDlg, IDC_OSVERSIONINFO, szVersion);
#else
SetDlgItemText(hDlg, IDC_OSVERSIONINFO, _T("API used to display OS information has been deprecated by MSFT"));
#endif
return uTimer;
}
/*-----------------------------------------------------------------------------
FUNCTION: AboutDlgProc(HWND, UINT, WPARAM, LPARAM)
PURPOSE: Dialog procedure for the "About Box"
PARAMETERS:
hdlg - dialog window handle
uMessage - window message
wparam - message parameter (depends on message value)
lparam - message prarmeter (depends on message value)
HISTORY: Date: Author: Comment:
10/27/95 AllenD Wrote it
-----------------------------------------------------------------------------*/
BOOL CALLBACK AboutDlgProc(HWND hdlg, UINT uMessage, WPARAM wparam, LPARAM lparam)
{
static UINT uTimer;
static WORD wCurrentIconId;
switch(uMessage)
{
case WM_INITDIALOG:
uTimer = InitAboutDlg(hdlg);
wCurrentIconId = IDI_APPICON;
break;
case WM_TIMER:
/*
when timer goes off, then change to next icon
*/
{
HICON hIcon;
switch(wCurrentIconId)
{
case IDI_APPICON: wCurrentIconId = IDI_APPICON2; break;
case IDI_APPICON2: wCurrentIconId = IDI_APPICON3; break;
case IDI_APPICON3: wCurrentIconId = IDI_APPICON4; break;
case IDI_APPICON4: wCurrentIconId = IDI_APPICON; break;
}
hIcon = LoadIcon(ghInst, MAKEINTRESOURCE(wCurrentIconId));
SendMessage(GetDlgItem(hdlg, IDC_PICTURE), STM_SETICON, (WPARAM) hIcon, 0);
}
break;
case WM_COMMAND:
if (LOWORD(wparam) == IDOK) {
KillTimer(hdlg, uTimer);
EndDialog(hdlg, TRUE);
return TRUE;
}
break;
}
return FALSE;
}