4 * Copyright 2000 Joshua Thielen
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define WIN32_LEAN_AND_MEAN
27 INT_PTR CALLBACK
CustomDlgProc( HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
30 static BOARD
*p_board
;
34 p_board
= (BOARD
*) lParam
;
35 SetDlgItemInt( hDlg
, IDC_EDITROWS
, p_board
->rows
, FALSE
);
36 SetDlgItemInt( hDlg
, IDC_EDITCOLS
, p_board
->cols
, FALSE
);
37 SetDlgItemInt( hDlg
, IDC_EDITMINES
, p_board
->mines
, FALSE
);
41 switch( LOWORD( wParam
) ) {
43 p_board
->rows
= GetDlgItemInt( hDlg
, IDC_EDITROWS
, &IsRet
, FALSE
);
44 p_board
->cols
= GetDlgItemInt( hDlg
, IDC_EDITCOLS
, &IsRet
, FALSE
);
45 p_board
->mines
= GetDlgItemInt( hDlg
, IDC_EDITMINES
, &IsRet
, FALSE
);
46 CheckLevel( p_board
);
59 INT_PTR CALLBACK
CongratsDlgProc( HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
61 static BOARD
*p_board
;
65 p_board
= (BOARD
*) lParam
;
66 SetDlgItemTextW( hDlg
, IDC_EDITNAME
, p_board
->best_name
[p_board
->difficulty
] );
70 switch( LOWORD( wParam
) ) {
72 GetDlgItemTextW( hDlg
, IDC_EDITNAME
,
73 p_board
->best_name
[p_board
->difficulty
],
74 sizeof( p_board
->best_name
[p_board
->difficulty
] ) / sizeof(WCHAR
) );
87 INT_PTR CALLBACK
TimesDlgProc( HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
89 static BOARD
*p_board
;
91 int confirm_msgbox_result
;
92 WCHAR confirm_title
[256], confirm_text
[256];
96 p_board
= (BOARD
*) lParam
;
99 for( i
= 0; i
< 3; i
++ )
100 SetDlgItemTextW( hDlg
, (IDC_NAME1
) + i
, p_board
->best_name
[i
] );
103 for( i
= 0; i
< 3; i
++ )
104 SetDlgItemInt( hDlg
, (IDC_TIME1
) + i
, p_board
->best_time
[i
], FALSE
);
108 switch( LOWORD( wParam
) ) {
110 LoadStringW( NULL
, IDC_CONFIRMTITLE
, confirm_title
, sizeof(confirm_title
)/sizeof(WCHAR
) );
111 LoadStringW( NULL
, IDC_CONFIRMTEXT
, confirm_text
, sizeof(confirm_text
)/sizeof(WCHAR
) );
112 confirm_msgbox_result
= MessageBoxW( hDlg
, confirm_text
, confirm_title
, MB_OKCANCEL
| MB_DEFBUTTON2
| MB_ICONWARNING
);
113 if( confirm_msgbox_result
!= IDOK
)
116 /* reset best names and times */
117 ResetResults( p_board
);
119 /* save to registry */
120 SaveBoard( p_board
);
123 for( i
= 0; i
< 3; i
++ ) {
124 SetDlgItemTextW( hDlg
, (IDC_NAME1
) + i
, p_board
->best_name
[i
] );
125 SetDlgItemInt( hDlg
, (IDC_TIME1
) + i
, p_board
->best_time
[i
], FALSE
);
131 EndDialog( hDlg
, 0 );