home *** CD-ROM | disk | FTP | other *** search
/ MORE WinGames / WINGAMES.iso / chess / review.c < prev    next >
C/C++ Source or Header  |  1991-06-16  |  3KB  |  103 lines

  1. /*
  2.   C source for GNU CHESS
  3.  
  4.   Revision: 1990-12-27
  5.  
  6.   Modified by Daryl Baker for use in MS WINDOWS environment
  7.  
  8.   This file is part of CHESS.
  9.  
  10.   CHESS is distributed in the hope that it will be useful, but WITHOUT ANY
  11.   WARRANTY.  No author or distributor accepts responsibility to anyone for
  12.   the consequences of using it or for whether it serves any particular
  13.   purpose or works at all, unless he says so in writing.  Refer to the CHESS
  14.   General Public License for full details.
  15.  
  16.   Everyone is granted permission to copy, modify and redistribute CHESS, but
  17.   only under the conditions described in the CHESS General Public License.
  18.   A copy of this license is supposed to have been given to you along with
  19.   CHESS so you can know your rights and responsibilities.  It should be in a
  20.   file named COPYING.  Among other things, the copyright notice and this
  21.   notice must be preserved on all copies.
  22. */
  23.  
  24. #define NOATOM 
  25. #define NOCLIPBOARD
  26. #define NOCREATESTRUCT
  27. #define NOFONT
  28. #define NOREGION
  29. #define NOSOUND
  30. #define NOWH
  31. #define NOWINOFFSETS
  32. #define NOCOMM
  33. #define NOKANJI
  34.  
  35. #include <windows.h>
  36. #include "gnuchess.h"
  37. #include "defs.h"
  38. #include "chess.h"
  39.  
  40. extern char mvstr[4][6];
  41.  
  42. BOOL FAR PASCAL ReviewDlgProc ( HWND hDlg, unsigned message,
  43.                                WORD wParam, LONG lParam);
  44.  
  45.  
  46. int ReviewDialog ( HWND hWnd, HANDLE hInst)
  47. {
  48.    FARPROC lpProcReview;
  49.    int status;
  50.  
  51.    lpProcReview = MakeProcInstance(ReviewDlgProc, hInst);
  52.     status = DialogBoxParam (hInst, MAKEINTRESOURCE(REVIEW),   hWnd,  lpProcReview, 0);
  53.    FreeProcInstance(lpProcReview);
  54.    return status;
  55. }
  56.  
  57. BOOL FAR PASCAL ReviewDlgProc ( HWND hDlg, unsigned message,
  58.                                WORD wParam, LONG lParam)
  59. {
  60.  
  61.    int i,f,t;
  62.    char tmp[50];
  63.  
  64.    switch (message) {
  65.        case WM_INITDIALOG:           /* message: initialize dialog box */
  66.  
  67.         for (i = 1; i <= GameCnt; i++) {
  68.             f = GameList[i].gmove >> 8;
  69.             t = (GameList[i].gmove & 0xFF);
  70.             algbr (f, t, false);
  71.             wsprintf (tmp, "%4d-%c\t%5s\t%-5d\t%-2d\t%-5d",
  72.                (i+1)/2, (i%2 ? 'w' : 'b'),
  73.                (char far *)mvstr[0],
  74.                GameList[i].score, GameList[i].depth,
  75.                GameList[i].time);
  76.             SendDlgItemMessage (hDlg, 100, LB_ADDSTRING, 0, (LONG) (LPSTR) tmp);
  77.          }
  78.          SendDlgItemMessage (hDlg, 100, WM_SETREDRAW, TRUE, 0);
  79.          return (TRUE);
  80.  
  81.       case WM_SYSCOMMAND:
  82.          if ( (wParam&0xfff0) == SC_CLOSE ) {
  83.                  EndDialog(hDlg, NULL);
  84.                  return TRUE;
  85.          }
  86.          break;
  87.  
  88.  
  89.        case WM_COMMAND:              /* message: received a command */
  90.          switch (wParam) {
  91.          
  92.             case IDOK:
  93.                  EndDialog(hDlg, 1);
  94.                  return TRUE;
  95.                break;
  96.  
  97.          }
  98.           break;
  99.     }
  100.  
  101.     return (FALSE);                  /* Didn't process a message    */
  102. }
  103.