ReactOS  0.4.15-dev-2977-ge996662
solitaire.cpp
Go to the documentation of this file.
1 #include "solitaire.h"
2 
3 #include <winreg.h>
4 #include <commctrl.h>
5 #include <tchar.h>
6 
7 #include "resource.h"
8 
10 
16 
25 
30 long lScore;
32 
34 
35 typedef struct _CardBack
36 {
43 
45 
46 void MakePath(TCHAR *szDest, UINT nDestLen, const TCHAR *szExt)
47 {
48  TCHAR *ptr;
49 
50  ptr = szDest + GetModuleFileName(GetModuleHandle(0), szDest, nDestLen) - 1;
51  while(*ptr-- != '.');
52  lstrcpy(ptr + 1, szExt);
53 }
54 
56 {
57  DWORD dwDisposition;
58  DWORD dwSize;
59  DWORD dwBack;
60  HKEY hKey;
61 
63  _T("Software\\ReactOS\\Solitaire"),
64  0,
65  NULL,
67  KEY_READ,
68  NULL,
69  &hKey,
70  &dwDisposition))
71  return;
72 
73  dwSize = sizeof(DWORD);
75  _T("Options"),
76  NULL,
77  NULL,
78  (LPBYTE)&dwOptions,
79  &dwSize);
80 
81  dwSize = sizeof(DWORD);
83  _T("Back"),
84  NULL,
85  NULL,
86  (LPBYTE)&dwBack,
87  &dwSize);
88  SolWnd.SetBackCardIdx(dwBack);
89 
91 }
92 
94 {
95  DWORD dwDisposition;
96  DWORD dwBack;
97  HKEY hKey;
98 
100  _T("Software\\ReactOS\\Solitaire"),
101  0,
102  NULL,
104  KEY_WRITE,
105  NULL,
106  &hKey,
107  &dwDisposition))
108  return;
109 
111  _T("Options"),
112  0,
113  REG_DWORD,
114  (CONST BYTE *)&dwOptions,
115  sizeof(DWORD));
116 
117  dwBack = SolWnd.GetBackCardIdx();
119  _T("Back"),
120  0,
121  REG_DWORD,
122  (CONST BYTE *)&dwBack,
123  sizeof(DWORD));
124 
125  RegCloseKey(hKey);
126 }
127 
128 // Returns 0 for no points, 1 for Standard and 2 for Vegas
129 int GetScoreMode(void)
130 {
132  {
133  return SCORE_NONE;
134  }
135 
137  {
138  return SCORE_STD;
139  }
140 
142  {
143  return SCORE_VEGAS;
144  }
145 
146  return 0;
147 }
148 
149 void UpdateStatusBar(void)
150 {
151  TCHAR szStatusText[128];
152  TCHAR szTempText[64];
153 
154  ZeroMemory(szStatusText, sizeof(szStatusText));
155 
156  if (GetScoreMode() != SCORE_NONE)
157  {
158  _stprintf(szStatusText, szScore, lScore);
159  _tcscat(szStatusText, _T(" "));
160  }
161 
163  {
164  _stprintf(szTempText, szTime, dwTime);
165  _tcscat(szStatusText, szTempText);
166  }
167 
169 }
170 
171 void SetPlayTimer(void)
172 {
174  {
175  if (!PlayTimer)
176  {
178  }
179  }
180 }
181 
183 {
184  if (enable)
185  {
187  }
188  else
189  {
191  }
192 }
193 
194 //
195 // Main entry point
196 //
197 int WINAPI _tWinMain(HINSTANCE hInst, HINSTANCE hPrev, LPTSTR szCmdLine, int iCmdShow)
198 {
199  HWND hwnd;
200  MSG msg;
201  WNDCLASS wndclass;
203  HACCEL hAccelTable;
204 
205  hInstance = hInst;
206 
207  // Load application title
208  LoadString(hInst, IDS_SOL_NAME, szAppName, sizeof(szAppName) / sizeof(szAppName[0]));
209  // Load MsgBox() texts here to avoid loading them many times later
210  LoadString(hInst, IDS_SOL_ABOUT, MsgAbout, sizeof(MsgAbout) / sizeof(MsgAbout[0]));
211  LoadString(hInst, IDS_SOL_QUIT, MsgQuit, sizeof(MsgQuit) / sizeof(MsgQuit[0]));
212  LoadString(hInst, IDS_SOL_WIN, MsgWin, sizeof(MsgWin) / sizeof(MsgWin[0]));
213  LoadString(hInst, IDS_SOL_DEAL, MsgDeal, sizeof(MsgDeal) / sizeof(MsgDeal[0]));
214 
215  LoadString(hInst, IDS_SOL_SCORE, szScore, sizeof(szScore) / sizeof(TCHAR));
216  LoadString(hInst, IDS_SOL_TIME, szTime, sizeof(szTime) / sizeof(TCHAR));
217 
218  //Window class for the main application parent window
219  wndclass.style = 0;//CS_HREDRAW | CS_VREDRAW;
220  wndclass.lpfnWndProc = WndProc;
221  wndclass.cbClsExtra = 0;
222  wndclass.cbWndExtra = 0;
223  wndclass.hInstance = hInst;
225  wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
226  wndclass.hbrBackground = (HBRUSH)NULL;
228  wndclass.lpszClassName = szAppName;
229 
230  RegisterClass(&wndclass);
231 
232  ice.dwSize = sizeof(ice);
233  ice.dwICC = ICC_BAR_CLASSES;
234  InitCommonControlsEx(&ice);
235 
236  srand((unsigned)GetTickCount());//timeGetTime());
237 
238 // InitCardLib();
239 
240  LoadSettings();
241 
243 
244  //Construct the path to our help file
245  MakePath(szHelpPath, MAX_PATH, _T(".hlp"));
246 
247  hwnd = CreateWindow(szAppName, // window class name
248  szAppName, // window caption
250  ,//|WS_CLIPCHILDREN, // window style
251  CW_USEDEFAULT, // initial x position
252  CW_USEDEFAULT, // initial y position
253  0, // The real size will be computed in WndProc through WM_GETMINMAXINFO
254  0, // The real size will be computed in WndProc through WM_GETMINMAXINFO
255  NULL, // parent window handle
256  NULL, // use window class menu
257  hInst, // program instance handle
258  NULL); // creation parameters
259  if (hwnd == NULL)
260  return 1;
261 
262  hwndMain = hwnd;
263 
265 
266  UpdateStatusBar();
267 
268  ShowWindow(hwnd, iCmdShow);
270 
272 
273  while(GetMessage(&msg, NULL,0,0))
274  {
275  if(!TranslateAccelerator(hwnd, hAccelTable, &msg))
276  {
279  }
280  }
281 
282  SaveSettings();
283 
284  return msg.wParam;
285 }
286 
287 
289 {
290  HWND hCtrl;
291 
292  switch (uMsg)
293  {
294  case WM_INITDIALOG:
295  // For now, the Help dialog item is disabled because of lacking of HTML Help support
297 
300 
301  CheckDlgButton(hDlg,
304 
305  CheckDlgButton(hDlg,
308 
309  CheckDlgButton(hDlg,
312 
313  hCtrl = GetDlgItem(hDlg, IDC_OPT_KEEPSCORE);
314 
315  if (GetScoreMode() == SCORE_NONE)
316  {
318  EnableWindow(hCtrl, FALSE);
319  }
320  else if (GetScoreMode() == SCORE_STD)
321  {
323  EnableWindow(hCtrl, FALSE);
324  }
325  else if (GetScoreMode() == SCORE_VEGAS)
326  {
328  EnableWindow(hCtrl, TRUE);
329  }
330  return TRUE;
331 
332  case WM_COMMAND:
333  switch(LOWORD(wParam))
334  {
335  case IDC_OPT_NOSCORE:
336  case IDC_OPT_STANDARD:
337  case IDC_OPT_VEGAS:
338  hCtrl = GetDlgItem(hDlg, IDC_OPT_KEEPSCORE);
339  if (wParam == IDC_OPT_VEGAS)
340  EnableWindow(hCtrl, TRUE);
341  else
342  EnableWindow(hCtrl, FALSE);
343  return TRUE;
344 
345  case IDOK:
349 
352  else
354 
357  else
359 
362  else
364 
366  {
369  }
370  else if (IsDlgButtonChecked(hDlg, IDC_OPT_VEGAS) == BST_CHECKED)
371  {
374  }
376  {
379  }
380 
381  UpdateStatusBar();
382 
383  EndDialog(hDlg, TRUE);
384  return TRUE;
385 
386  case IDCANCEL:
387  EndDialog(hDlg, FALSE);
388  return TRUE;
389  }
390  break;
391  }
392  return FALSE;
393 }
394 
396 {
397  DWORD dwOldOptions = dwOptions;
398  RECT rcMain, rcStatus;
399 
400  int iOldScoreMode = GetScoreMode();
401 
403  {
404  if (((dwOldOptions & OPTION_THREE_CARDS) != (dwOptions & OPTION_THREE_CARDS)) ||
405  ((dwOldOptions & OPTION_SHOW_TIME) != (dwOptions & OPTION_SHOW_TIME)) ||
406  (iOldScoreMode != GetScoreMode()))
407  NewGame();
408 
409  if ((dwOldOptions & OPTION_SHOW_STATUS) != (dwOptions & OPTION_SHOW_STATUS))
410  {
411  int nWidth, nHeight, nStatusHeight;
412 
413  GetClientRect(hwndMain, &rcMain);
414  nHeight = rcMain.bottom - rcMain.top;
415  nWidth = rcMain.right - rcMain.left;
416 
418  {
419  RECT rc;
420 
422  GetWindowRect(hwndStatus, &rcStatus);
423  nStatusHeight = rcStatus.bottom - rcStatus.top;
424  MoveWindow(SolWnd, 0, 0, nWidth, nHeight-nStatusHeight, TRUE);
425  MoveWindow(hwndStatus, 0, nHeight-nStatusHeight, nWidth, nHeight, TRUE);
426 
427  // Force the window to process WM_GETMINMAXINFO again
428  GetWindowRect(hwndMain, &rc);
429  SetWindowPos(hwndMain, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER);
430  }
431  else
432  {
434  MoveWindow(SolWnd, 0, 0, nWidth, nHeight, TRUE);
435  }
436  }
437  }
438 }
439 
440 
443  UINT msg,
444  WPARAM wParam,
445  LPARAM lParam)
446 {
448  GWLP_USERDATA);
449  static WNDPROC hOldProc = NULL;
450 
451  if (!hOldProc && pCardBack)
452  hOldProc = pCardBack->hOldProc;
453 
454  switch (msg)
455  {
456  case WM_PAINT:
457  {
458  HDC hdc;
459  PAINTSTRUCT ps;
460  HPEN hPen, hOldPen;
461  HBRUSH hBrush, hOldBrush;
462  RECT rc;
463 
464  hdc = BeginPaint(hwnd, &ps);
465 
466  if (pCardBack->bSelected)
467  {
468  hPen = CreatePen(PS_SOLID, 2, RGB(0,0,0));
469  }
470  else
471  {
473  hPen = CreatePen(PS_SOLID, 2, Face);
474  }
475 
476  GetClientRect(hwnd, &rc);
477  hBrush = (HBRUSH)GetStockObject(NULL_BRUSH);
478  hOldPen = (HPEN)SelectObject(hdc, hPen);
479  hOldBrush = (HBRUSH)SelectObject(hdc, hBrush);
480 
481  Rectangle(hdc,
482  rc.left+1,
483  rc.top+1,
484  rc.right,
485  rc.bottom);
486 
487  StretchBlt(hdc,
488  2,
489  2,
493  pCardBack->hdcNum * __cardwidth,
494  0,
495  __cardwidth,
496  __cardheight,
497  SRCCOPY);
498 
499  SelectObject(hdc, hOldPen);
500  SelectObject(hdc, hOldBrush);
501 
502  EndPaint(hwnd, &ps);
503 
504  break;
505  }
506 
507  case WM_LBUTTONDOWN:
508  pCardBack->bSelected = pCardBack->bSelected ? FALSE : TRUE;
509  break;
510  }
511 
512  return CallWindowProc(hOldProc,
513  hwnd,
514  msg,
515  wParam,
516  lParam);
517 }
518 
519 
521  UINT uMsg,
522  WPARAM wParam,
523  LPARAM lParam)
524 {
525  static PCARDBACK pCardBacks = NULL;
526 
527  switch (uMsg)
528  {
529  case WM_INITDIALOG:
530  {
531  INT i, c;
532  SIZE_T size = sizeof(CARDBACK) * NUM_CARDBACKS;
533 
534  pCardBacks = (PCARDBACK)HeapAlloc(GetProcessHeap(),
535  0,
536  size);
537 
538  for (i = 0, c = CARDBACK_START; c <= CARDBACK_END; i++, c++)
539  {
540  pCardBacks[i].hSelf = GetDlgItem(hDlg, c);
541  pCardBacks[i].bSelected = FALSE;
542  pCardBacks[i].hdcNum = CARDBACK_RES_START + i;
543  pCardBacks[i].imgNum = i + 1;
544  pCardBacks[i].hOldProc = (WNDPROC)SetWindowLongPtr(pCardBacks[i].hSelf,
545  GWLP_WNDPROC,
547 
548  SetWindowLongPtr(pCardBacks[i].hSelf,
550  (LONG_PTR)&pCardBacks[i]);
551  }
552 
553  return TRUE;
554  }
555 
556  case WM_COMMAND:
557  if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
558  {
559  INT i, num = 0;
560  for (i = 0; i < NUM_CARDBACKS; i++)
561  {
562  if (pCardBacks[i].bSelected)
563  {
564  num = pCardBacks[i].imgNum;
565  }
566  }
567 
568  EndDialog(hDlg, LOWORD(wParam) == IDOK ? num : FALSE);
569  HeapFree(GetProcessHeap(), 0, pCardBacks);
570  return TRUE;
571  }
572 
573  if (HIWORD(wParam) == STN_CLICKED)
574  {
575  INT i;
576  RECT rc;
577  for (i = 0; i < NUM_CARDBACKS; i++)
578  {
579  if (pCardBacks[i].hSelf == (HWND)lParam)
580  {
581  pCardBacks[i].bSelected = TRUE;
582  }
583  else
584  pCardBacks[i].bSelected = FALSE;
585 
586  GetClientRect(pCardBacks[i].hSelf, &rc);
587  InvalidateRect(pCardBacks[i].hSelf, &rc, TRUE);
588  }
589 
590  break;
591  }
592  }
593 
594  return FALSE;
595 }
596 
597 
599 {
600  INT cardBack;
601 
602  if ((cardBack = DialogBox(hInstance,
604  hwnd,
605  CardBackDlgProc)))
606  {
607  SolWnd.SetBackCardIdx(CARDBACK_RES_START + (cardBack - 1));
608  SolWnd.Redraw();
609  }
610 }
611 
612 //-----------------------------------------------------------------------------
614 {
615  static int nWidth, nHeight, nStatusHeight;
616 
617  switch(iMsg)
618  {
619  case WM_CREATE:
620  {
621  int parts[] = { 150, -1 };
622  RECT rcStatus;
623 
624  // For now, the Help dialog item is disabled because of lacking of HTML Help support
626 
628 
629  //SendMessage(hwndStatus, SB_SIMPLE, (WPARAM)TRUE, 0);
630 
633 
634  SolWnd.Create(hwnd, 0, WS_CHILD | WS_VISIBLE, 0, 0, 100, 100);
635 
636  CreateSol();
637 
638  // The status bar height is fixed and needed later in WM_SIZE and WM_GETMINMAXINFO
639  // Force the window to process WM_GETMINMAXINFO again
640  GetWindowRect(hwndStatus, &rcStatus);
641  nStatusHeight = rcStatus.bottom - rcStatus.top;
642 
643  // Hide status bar if options say so
644  if (!(dwOptions & OPTION_SHOW_STATUS))
645  {
647  }
648 
649  SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOZORDER);
650 
651  NewGame();
652 
654 
655  return 0;
656  }
657 
658  case WM_DESTROY:
659  PostQuitMessage(0);
660  return 0;
661 
662  case WM_TIMER:
663  if (!fGameStarted)
664  {
666  PlayTimer = 0;
667  }
668  else if (dwOptions & OPTION_SHOW_TIME)
669  {
670  if (((dwTime + 1) % 10 == 0) && (GetScoreMode() == SCORE_STD))
671  {
672  lScore = lScore >= 2 ? lScore - 2 : 0;
673  }
674 
675  dwTime++;
676  }
677 
678  UpdateStatusBar();
679  return 0;
680 
681  case WM_SIZE:
682  nWidth = LOWORD(lParam);
683  nHeight = HIWORD(lParam);
684 
686  {
687  MoveWindow(SolWnd, 0, 0, nWidth, nHeight - nStatusHeight, TRUE);
688  MoveWindow(hwndStatus, 0, nHeight - nStatusHeight, nWidth, nStatusHeight, TRUE);
689  }
690  else
691  {
692  MoveWindow(SolWnd, 0, 0, nWidth, nHeight, TRUE);
693  }
694  //parts[0] = nWidth - 256;
695  //SendMessage(hwndStatus, SB_SETPARTS, 2, (LPARAM)parts);
696  return 0;
697 
698  case WM_GETMINMAXINFO:
699  {
700  MINMAXINFO *mmi;
701 
702  mmi = (MINMAXINFO *)lParam;
706  Y_BORDER +
707  __cardheight +
709  6 * yRowStackCardOffset +
710  __cardheight +
711  Y_BORDER +
712  (dwOptions & OPTION_SHOW_STATUS ? nStatusHeight : 0);
713  return 0;
714  }
715 
716  case WM_COMMAND:
717  switch(LOWORD(wParam))
718  {
719  case IDM_GAME_NEW:
720  //simulate a button click on the new button..
721  NewGame();
722  return 0;
723 
724  case IDM_GAME_UNDO:
725  Undo();
726  return 0;
727 
728  case IDM_GAME_DECK:
730  return 0;
731 
732  case IDM_GAME_OPTIONS:
734  return 0;
735 
736  case IDM_HELP_CONTENTS:
737  WinHelp(hwnd, szHelpPath, HELP_CONTENTS, 0);//HELP_KEY, (DWORD)"How to play");
738  return 0;
739 
740  case IDM_HELP_ABOUT:
742  return 0;
743 
744  case IDM_GAME_EXIT:
745  PostMessage(hwnd, WM_CLOSE, 0, 0);
746  return 0;
747  }
748 
749  return 0;
750 
751  case WM_CLOSE:
752  if (fGameStarted == false)
753  {
755  return 0;
756  }
757  else
758  {
759  int ret;
760 
762  if (ret == IDYES)
763  {
766  }
767  }
768  return 0;
769  }
770 
771  return DefWindowProc (hwnd, iMsg, wParam, lParam);
772 }
773 
774 
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define RegQueryValueEx
Definition: winreg.h:524
POINT ptMinTrackSize
Definition: winuser.h:3605
#define CallWindowProc
Definition: winuser.h:5710
DWORD dwOptions
Definition: solitaire.cpp:24
#define OPTION_SHOW_STATUS
Definition: solitaire.h:10
#define IDS_SOL_ABOUT
Definition: resource.h:44
HWND hSelf
Definition: solitaire.cpp:37
UINT GetBackCardIdx()
Definition: cardwindow.cpp:738
#define IDD_CARDBACK
Definition: resource.h:28
#define TranslateAccelerator
Definition: winuser.h:5835
#define Y_BORDER
Definition: solitaire.h:53
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDM_GAME_OPTIONS
Definition: resource.h:13
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define OPTION_KEEP_SCORE
Definition: solitaire.h:13
#define IDC_OPT_SHOWTIME
Definition: resource.h:22
#define DispatchMessage
Definition: winuser.h:5740
BOOL WINAPI TranslateMessage(_In_ const MSG *)
INT imgNum
Definition: solitaire.cpp:40
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define IDOK
Definition: winuser.h:824
#define HELP_CONTENTS
Definition: winuser.h:2380
#define MF_BYCOMMAND
Definition: winuser.h:202
#define IDS_SOL_QUIT
Definition: resource.h:45
#define IDR_ACCELERATOR1
Definition: resource.h:7
long y
Definition: polytest.cpp:48
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
#define CreateWindow
Definition: winuser.h:5729
#define IDYES
Definition: winuser.h:829
void SetUndoMenuState(bool enable)
Definition: solitaire.cpp:182
TCHAR szTime[64]
Definition: solitaire.cpp:19
#define RGB(r, g, b)
Definition: precomp.h:62
long x
Definition: polytest.cpp:48
HWND hwndMain
Definition: solitaire.cpp:12
TCHAR MsgWin[128]
Definition: solitaire.cpp:22
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define X_BORDER
Definition: solitaire.h:49
long lScore
Definition: solitaire.cpp:30
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
#define IDC_OPT_STATUSBAR
Definition: resource.h:23
static const D3D_BLOB_PART parts[]
Definition: blob.c:76
BOOL Create(HWND hwndParent, DWORD dwExStyle, DWORD dwStyle, int x, int y, int width, int height)
Definition: cardwindow.cpp:109
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define NULL_BRUSH
Definition: wingdi.h:900
#define HELP_QUIT
Definition: winuser.h:2389
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
HMENU hGameMenu
Definition: solitaire.cpp:15
#define IDR_MENU1
Definition: resource.h:6
static HDC
Definition: imagelist.c:92
#define CALLBACK
Definition: compat.h:35
BOOL WINAPI UpdateWindow(_In_ HWND)
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
void __cdecl srand(_In_ unsigned int _Seed)
LONG top
Definition: windef.h:307
#define IDM_GAME_DECK
Definition: resource.h:12
#define OPTION_SCORE_VEGAS
Definition: solitaire.h:15
#define IDC_OPT_NOSCORE
Definition: resource.h:26
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
int cbClsExtra
Definition: winuser.h:3140
#define ZeroMemory
Definition: winbase.h:1664
int yRowStackCardOffset
Definition: solcreate.cpp:10
LPCSTR lpszMenuName
Definition: winuser.h:3146
VOID SaveSettings(VOID)
Definition: solitaire.cpp:93
#define IDM_HELP_ABOUT
Definition: resource.h:385
UINT_PTR WPARAM
Definition: windef.h:207
TCHAR MsgAbout[128]
Definition: solitaire.cpp:21
HBRUSH hbrBackground
Definition: winuser.h:3145
#define WS_CHILD
Definition: pedump.c:617
#define CARDBACK_RES_START
Definition: solitaire.h:19
UINT_PTR PlayTimer
Definition: solitaire.cpp:31
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1232
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
void CreateSol()
Definition: solcreate.cpp:12
int32_t INT_PTR
Definition: typedefs.h:64
#define Y_ROWSTACK_BORDER
Definition: solitaire.h:55
LONG right
Definition: windef.h:308
BOOL WINAPI DestroyWindow(_In_ HWND)
#define IDD_OPTIONS
Definition: resource.h:19
#define DWORD
Definition: nt_native.h:44
int32_t INT
Definition: typedefs.h:58
#define SetWindowLongPtr
Definition: treelist.c:70
DWORD WINAPI GetSysColor(_In_ int)
BOOL WINAPI StretchBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
HDC __hdcCardBitmaps
Definition: cardlib.cpp:18
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define IDS_SOL_DEAL
Definition: resource.h:47
void NewGame(void)
Definition: solgame.cpp:18
void Redraw(void)
Definition: cardwindow.cpp:553
int GetScoreMode(void)
Definition: solitaire.cpp:129
#define DialogBox
Definition: winuser.h:5736
#define PS_SOLID
Definition: wingdi.h:585
int cbWndExtra
Definition: winuser.h:3141
#define LoadAccelerators
Definition: winuser.h:5785
#define IDT_PLAYTIMER
Definition: solitaire.h:33
#define CARDBACK_OPTIONS_HEIGHT
Definition: solitaire.h:21
#define COLOR_3DFACE
Definition: winuser.h:919
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
#define MB_YESNO
Definition: winuser.h:811
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SCORE_NONE
Definition: solitaire.h:44
#define IDC_OPT_DRAWONE
Definition: resource.h:20
#define CreateStatusWindow
Definition: commctrl.h:1933
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
INT_PTR CALLBACK CardBackDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: solitaire.cpp:520
HWND hwndStatus
Definition: solitaire.cpp:13
static PVOID ptr
Definition: dispmode.c:27
HCURSOR hCursor
Definition: winuser.h:3144
TCHAR szHelpPath[MAX_PATH]
Definition: solitaire.cpp:9
#define CW_USEDEFAULT
Definition: winuser.h:225
HINSTANCE hInstance
Definition: solitaire.cpp:14
#define GWLP_USERDATA
Definition: treelist.c:63
#define X_ROWSTACK_BORDER
Definition: solitaire.h:51
#define MB_ICONQUESTION
Definition: winuser.h:783
#define IDS_SOL_NAME
Definition: resource.h:43
LONG_PTR LPARAM
Definition: windef.h:208
#define IDS_SOL_WIN
Definition: resource.h:46
#define IDC_OPT_DRAWTHREE
Definition: resource.h:21
int WINAPI _tWinMain(HINSTANCE hInst, HINSTANCE hPrev, LPTSTR szCmdLine, int iCmdShow)
Definition: solitaire.cpp:197
WNDPROC hOldProc
Definition: solitaire.cpp:38
#define SW_SHOW
Definition: winuser.h:769
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define IDI_SOLITAIRE
Definition: resource.h:4
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define DefWindowProc
Definition: ros2win.h:31
#define WM_DESTROY
Definition: winuser.h:1591
#define PostMessage
Definition: winuser.h:5807
DWORD dwTime
Definition: solitaire.cpp:26
#define CCS_BOTTOM
Definition: commctrl.h:2244
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
char TCHAR
Definition: xmlstorage.h:189
#define NUM_ROW_STACKS
Definition: solitaire.h:38
#define ICC_BAR_CLASSES
Definition: commctrl.h:60
#define _T(x)
Definition: vfdio.h:22
VOID ShowDeckOptionsDlg(HWND hwnd)
Definition: solitaire.cpp:598
#define IDM_HELP_CONTENTS
Definition: resource.h:15
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:595
#define SM_CYCAPTION
Definition: winuser.h:953
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define STN_CLICKED
Definition: winuser.h:2076
#define IDS_SOL_SCORE
Definition: resource.h:48
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define SBARS_SIZEGRIP
Definition: commctrl.h:1923
#define WM_SIZE
Definition: winuser.h:1593
void SetPlayTimer(void)
Definition: solitaire.cpp:171
DWORD dwPrevMode
Definition: solitaire.cpp:29
#define WM_TIMER
Definition: winuser.h:1724
#define MF_ENABLED
Definition: winuser.h:128
#define WM_CLOSE
Definition: winuser.h:1603
#define MAX_PATH
Definition: compat.h:34
#define WINAPI
Definition: msvc.h:6
const GLubyte * c
Definition: glext.h:8905
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
struct _CardBack CARDBACK
int WINAPI GetSystemMetrics(_In_ int)
#define CARDBACK_START
Definition: solitaire.h:16
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint num
Definition: glext.h:9618
LRESULT CALLBACK CardImageWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: solitaire.cpp:442
#define IDC_OPT_KEEPSCORE
Definition: resource.h:27
#define GetModuleFileName
Definition: winbase.h:3687
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define OPTION_THREE_CARDS
Definition: solitaire.h:11
BOOL bSelected
Definition: solitaire.cpp:41
#define WM_PAINT
Definition: winuser.h:1602
#define MB_ICONINFORMATION
Definition: winuser.h:796
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
int ret
HDC hdc
Definition: main.c:9
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
#define SB_SETTEXT
Definition: commctrl.h:1949
#define IDS_SOL_TIME
Definition: resource.h:49
#define MessageBox
Definition: winuser.h:5797
#define NUM_CARDBACKS
Definition: solitaire.h:18
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1722
LPCSTR lpszClassName
Definition: winuser.h:3147
#define BST_UNCHECKED
Definition: winuser.h:199
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
unsigned char BYTE
Definition: xxhash.c:193
#define LoadCursor
Definition: winuser.h:5787
int __cardwidth
Definition: cardlib.cpp:25
#define GWLP_WNDPROC
Definition: treelist.c:66
VOID ShowGameOptionsDlg(HWND hwnd)
Definition: solitaire.cpp:395
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
TCHAR szAppName[128]
Definition: solitaire.cpp:17
UINT style
Definition: winuser.h:3138
LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: solitaire.cpp:613
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2881
void SetBackCardIdx(UINT uBackIdx)
Definition: cardwindow.cpp:728
#define _stprintf
Definition: utility.h:124
#define IDM_GAME_EXIT
Definition: resource.h:14
ULONG_PTR SIZE_T
Definition: typedefs.h:80
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define CARDBACK_END
Definition: solitaire.h:17
#define IDM_GAME_NEW
Definition: resource.h:10
HINSTANCE hInst
Definition: dxdiag.c:13
GLboolean enable
Definition: glext.h:11120
#define GetModuleHandle
Definition: winbase.h:3683
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
bool fGameStarted
Definition: solgame.cpp:15
HINSTANCE hInstance
Definition: winuser.h:3142
FxAutoRegKey hKey
#define lstrcpy
Definition: winbase.h:3730
INT_PTR CALLBACK OptionsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: solitaire.cpp:288
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
void Undo(void)
Definition: solundo.cpp:53
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
TCHAR szScore[64]
Definition: solitaire.cpp:18
#define GetMessage
Definition: winuser.h:5765
#define SB_SETPARTS
Definition: commctrl.h:1954
#define BST_CHECKED
Definition: winuser.h:197
#define IDC_OPT_STANDARD
Definition: resource.h:24
WNDPROC lpfnWndProc
Definition: winuser.h:3139
#define msg(x)
Definition: auth_time.c:54
#define IDC_ARROW
Definition: winuser.h:682
DWORD dwWasteCount
Definition: solitaire.cpp:27
#define OPTION_SCORE_STD
Definition: solitaire.h:14
#define SendMessage
Definition: winuser.h:5818
_TCHAR * _tcscat(_TCHAR *s, const _TCHAR *append)
Definition: tcscat.h:8
int __cardheight
Definition: cardlib.cpp:26
#define WM_CREATE
Definition: winuser.h:1590
DWORD dwAppStartTime
Definition: solitaire.cpp:11
TCHAR MsgDeal[128]
Definition: solitaire.cpp:23
#define SCORE_STD
Definition: solitaire.h:45
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define OPTION_SHOW_TIME
Definition: solitaire.h:12
#define c
Definition: ke_i.h:80
#define HIWORD(l)
Definition: typedefs.h:247
LONG bottom
Definition: windef.h:309
#define SCORE_VEGAS
Definition: solitaire.h:46
#define SWP_NOMOVE
Definition: winuser.h:1229
#define SM_CYMENU
Definition: winuser.h:966
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
#define RegisterClass
Definition: winuser.h:5811
void UpdateStatusBar(void)
Definition: solitaire.cpp:149
#define LoadIcon
Definition: winuser.h:5788
#define GetWindowLongPtr
Definition: treelist.c:73
#define MF_GRAYED
Definition: winuser.h:129
#define IDC_OPT_VEGAS
Definition: resource.h:25
#define IDCANCEL
Definition: winuser.h:825
#define IDM_GAME_UNDO
Definition: resource.h:11
LONG_PTR LRESULT
Definition: windef.h:209
#define CARDBACK_OPTIONS_WIDTH
Definition: solitaire.h:20
#define WS_VISIBLE
Definition: pedump.c:620
#define REG_DWORD
Definition: sdbapi.c:596
HMENU WINAPI GetMenu(_In_ HWND)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
TCHAR MsgQuit[128]
Definition: solitaire.cpp:20
DWORD dwWasteTreshold
Definition: solitaire.cpp:28
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define WM_GETMINMAXINFO
Definition: winuser.h:1622
#define SBT_NOBORDERS
Definition: commctrl.h:1971
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:594
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define CONST
Definition: pedump.c:81
VOID LoadSettings(VOID)
Definition: solitaire.cpp:55
#define SRCCOPY
Definition: wingdi.h:332
#define RegSetValueEx
Definition: winreg.h:533
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define LoadString
Definition: winuser.h:5794
#define RegCreateKeyEx
Definition: winreg.h:501
HICON hIcon
Definition: winuser.h:3143
CardWindow SolWnd
Definition: solitaire.cpp:33
struct _CardBack * PCARDBACK
INT hdcNum
Definition: solitaire.cpp:39
void MakePath(TCHAR *szDest, UINT nDestLen, const TCHAR *szExt)
Definition: solitaire.cpp:46
#define WinHelp
Definition: winuser.h:5839