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

  1. /*
  2.   C source for GNU CHESS
  3.  
  4.   Revision: 1990-09-30
  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 NOCOMM
  32. #define NOKANJI
  33.  
  34. #include <windows.h>
  35.  
  36. extern char szAppName[];
  37.  
  38. long FAR PASCAL ChessWndProc(HWND hWnd, unsigned message,
  39.                              WORD wParam, LONG lParam);
  40.  
  41. extern DWORD clrBackGround;
  42. extern DWORD clrBlackSquare;
  43. extern DWORD clrWhiteSquare;
  44. extern DWORD clrBlackPiece;
  45. extern DWORD clrWhitePiece;
  46.  
  47. BOOL FAR ChessInit(HANDLE hInstance)
  48. {
  49.     HANDLE hMemory;                   /* handle to allocated memory */
  50.     PWNDCLASS pWndClass;               /* structure pointer         */
  51.     BOOL bSuccess;                   /* RegisterClass() result     */
  52.  
  53.     hMemory = LocalAlloc(LHND, sizeof(WNDCLASS));
  54.     pWndClass = (PWNDCLASS) LocalLock(hMemory);
  55.  
  56.     pWndClass->style = NULL;
  57.     pWndClass->lpfnWndProc = ChessWndProc;
  58.     pWndClass->hInstance = hInstance;
  59.     pWndClass->hIcon = LoadIcon(hInstance, szAppName);
  60.     pWndClass->hCursor = LoadCursor(NULL, IDC_ARROW);
  61.     pWndClass->hbrBackground = GetStockObject(WHITE_BRUSH);
  62.     pWndClass->lpszMenuName = (LPSTR) szAppName;
  63.     pWndClass->lpszClassName = (LPSTR) szAppName;
  64.  
  65.     bSuccess = RegisterClass(pWndClass);
  66.  
  67.     LocalUnlock(hMemory);                /* Unlocks the memory    */
  68.     LocalFree(hMemory);                    /* Returns it to Windows */
  69.  
  70.     return (bSuccess);         /* Returns result of registering the window */
  71. }
  72.  
  73.