-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhsdlg.c
51 lines (35 loc) · 1.38 KB
/
hsdlg.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
#include "defs.h"
LOCAL INT_PTR CALLBACK HighScoresDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
int i;
WCHAR szBuffer[MAX_STRING];
size_t len;
switch (uMsg)
{
case WM_INITDIALOG:
for (i = 0; i < 10; i++)
{
StringCchLengthW (g_hsHighScores[i].szName, MAX_STRING, &len);
StringCchPrintfW (szBuffer, MAX_STRING, (len == 0) ? L"--" : L"%s", g_hsHighScores[i].szName);
SetDlgItemText (hDlg, IDC_HIGHSCORESNAME0 + i, szBuffer);
StringCchPrintfW (szBuffer, MAX_STRING, L"%d", g_hsHighScores[i].nLevel);
SetDlgItemText (hDlg, IDC_HIGHSCORESLEVEL0 + i, szBuffer);
StringCchPrintfW (szBuffer, MAX_STRING, L"%d", g_hsHighScores[i].nScore);
SetDlgItemText (hDlg, IDC_HIGHSCORESSCORE0 + i, szBuffer);
}
return TRUE;
case WM_COMMAND:
switch (LOWORD (wParam))
{
case IDOK:
case IDCANCEL: // Cancel button in upper right corner of dialog window.
EndDialog (hDlg, wParam);
return TRUE;
}
}
return FALSE;
}
void ShowHighScoresDialog (void)
{
DialogBox (NULL, MAKEINTRESOURCE (IDD_HIGHSCORES), g_hwndMain, HighScoresDlgProc);
}