ReactOS  0.4.12-dev-43-g63b00d8
dialog.c File Reference
#include "main.h"
Include dependency graph for dialog.c:

Go to the source code of this file.

Functions

INT_PTR CALLBACK CustomDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK CongratsDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK TimesDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Function Documentation

◆ CongratsDlgProc()

INT_PTR CALLBACK CongratsDlgProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 55 of file dialog.c.

Referenced by TestBoard().

56 {
57  static BOARD *p_board;
58 
59  switch( uMsg ) {
60  case WM_INITDIALOG:
61  p_board = (BOARD*) lParam;
62  SetDlgItemTextW( hDlg, IDC_EDITNAME, p_board->best_name[p_board->difficulty] );
63  return TRUE;
64 
65  case WM_COMMAND:
66  switch( LOWORD( wParam ) ) {
67  case IDOK:
69  p_board->best_name[p_board->difficulty],
70  sizeof( p_board->best_name[p_board->difficulty] ) / sizeof(WCHAR) );
71  EndDialog( hDlg, 0 );
72  return TRUE;
73 
74  case IDCANCEL:
75  EndDialog( hDlg, 0 );
76  return TRUE;
77  }
78  break;
79  }
80  return FALSE;
81 }
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2195
#define IDC_EDITNAME
Definition: resource.h:43
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR best_name[3][MAX_PLAYER_NAME_SIZE+1]
Definition: main.h:98
WPARAM wParam
Definition: combotst.c:138
Definition: main.h:71
BOOL WINAPI SetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPCWSTR lpString)
Definition: dialog.c:2748
DIFFICULTY difficulty
Definition: main.h:100
#define WM_COMMAND
Definition: winuser.h:1716
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2015
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

◆ CustomDlgProc()

INT_PTR CALLBACK CustomDlgProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 23 of file dialog.c.

Referenced by SetDifficulty().

24 {
25  BOOL IsRet;
26  static BOARD *p_board;
27 
28  switch( uMsg ) {
29  case WM_INITDIALOG:
30  p_board = (BOARD*) lParam;
31  SetDlgItemInt( hDlg, IDC_EDITROWS, p_board->rows, FALSE );
32  SetDlgItemInt( hDlg, IDC_EDITCOLS, p_board->cols, FALSE );
33  SetDlgItemInt( hDlg, IDC_EDITMINES, p_board->mines, FALSE );
34  return TRUE;
35 
36  case WM_COMMAND:
37  switch( LOWORD( wParam ) ) {
38  case IDOK:
39  p_board->rows = GetDlgItemInt( hDlg, IDC_EDITROWS, &IsRet, FALSE );
40  p_board->cols = GetDlgItemInt( hDlg, IDC_EDITCOLS, &IsRet, FALSE );
41  p_board->mines = GetDlgItemInt( hDlg, IDC_EDITMINES, &IsRet, FALSE );
42  CheckLevel( p_board );
43  EndDialog( hDlg, 0 );
44  return TRUE;
45 
46  case IDCANCEL:
47  EndDialog( hDlg, 1 );
48  return TRUE;
49  }
50  break;
51  }
52  return FALSE;
53 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
BOOL WINAPI SetDlgItemInt(HWND hDlg, int nIDDlgItem, UINT uValue, BOOL bSigned)
Definition: dialog.c:2712
unsigned mines
Definition: main.h:97
void CheckLevel(BOARD *p_board)
Definition: main.c:49
WPARAM wParam
Definition: combotst.c:138
#define IDC_EDITROWS
Definition: resource.h:46
Definition: main.h:71
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned rows
Definition: main.h:95
unsigned cols
Definition: main.h:96
#define WM_COMMAND
Definition: winuser.h:1716
UINT WINAPI GetDlgItemInt(HWND hDlg, int nIDDlgItem, BOOL *lpTranslated, BOOL bSigned)
Definition: dialog.c:2139
#define IDC_EDITCOLS
Definition: resource.h:45
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2015
#define IDCANCEL
Definition: winuser.h:825
#define IDC_EDITMINES
Definition: resource.h:47
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

◆ TimesDlgProc()

INT_PTR CALLBACK TimesDlgProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 83 of file dialog.c.

Referenced by MainProc(), and TestBoard().

84 {
85  static BOARD *p_board;
86  unsigned i;
87 
88  switch( uMsg ) {
89  case WM_INITDIALOG:
90  p_board = (BOARD*) lParam;
91 
92  /* set best names */
93  for( i = 0; i < 3; i++ )
94  SetDlgItemTextW( hDlg, (IDC_NAME1) + i, p_board->best_name[i] );
95 
96  /* set best times */
97  for( i = 0; i < 3; i++ )
98  SetDlgItemInt( hDlg, (IDC_TIME1) + i, p_board->best_time[i], FALSE );
99  return TRUE;
100 
101  case WM_COMMAND:
102  switch( LOWORD( wParam ) ) {
103  case IDOK:
104  case IDCANCEL:
105  EndDialog( hDlg, 0 );
106  return TRUE;
107  }
108  break;
109  }
110  return FALSE;
111 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
BOOL WINAPI SetDlgItemInt(HWND hDlg, int nIDDlgItem, UINT uValue, BOOL bSigned)
Definition: dialog.c:2712
#define IDC_TIME1
Definition: resource.h:36
WCHAR best_name[3][MAX_PLAYER_NAME_SIZE+1]
Definition: main.h:98
WPARAM wParam
Definition: combotst.c:138
GLenum GLclampf GLint i
Definition: glfuncs.h:14
Definition: main.h:71
DWORD best_time[3]
Definition: main.h:99
BOOL WINAPI SetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPCWSTR lpString)
Definition: dialog.c:2748
#define WM_COMMAND
Definition: winuser.h:1716
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2015
#define IDCANCEL
Definition: winuser.h:825
#define IDC_NAME1
Definition: resource.h:39
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82