home *** CD-ROM | disk | FTP | other *** search
/ The Best of Windows 95.com 1996 September / WIN95_09963.iso / strategy / hangman.zip / Hangman32.cpp < prev    next >
C/C++ Source or Header  |  1996-01-15  |  2KB  |  88 lines

  1. // Hangman32.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "Hangman32.h"
  6.  
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12.  
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CHangman32App
  15.  
  16. BEGIN_MESSAGE_MAP(CHangman32App, CWinApp)
  17.     //{{AFX_MSG_MAP(CHangman32App)
  18.     //}}AFX_MSG_MAP
  19.     ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  20. END_MESSAGE_MAP()
  21.  
  22. /////////////////////////////////////////////////////////////////////////////
  23. // CHangman32App construction
  24.  
  25. CHangman32App::CHangman32App()
  26. {
  27.     // TODO: add construction code here,
  28.     // Place all significant initialization in InitInstance
  29.     m_doAccel = TRUE;    // Initialize boolean to process Accel Table
  30. }
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // The one and only CHangman32App object
  34.  
  35. CHangman32App theApp;
  36.  
  37. /////////////////////////////////////////////////////////////////////////////
  38. // CHangman32App initialization
  39.  
  40. BOOL CHangman32App::InitInstance()
  41. {
  42.     // Standard initialization
  43.     // If you are not using these features and wish to reduce the size
  44.     //  of your final executable, you should remove from the following
  45.     //  the specific initialization routines you do not need.
  46.  
  47. #ifdef _AFXDLL
  48.     Enable3dControls();            // Call this when using MFC in a shared DLL
  49. #else
  50.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  51. #endif
  52.  
  53.        CHangman32Dlg dlg;
  54.     m_hwndDialog = NULL;
  55.     m_pMainWnd   = &dlg;
  56.     m_AccelTable = LoadAccelerators(AfxGetInstanceHandle(),
  57.                     MAKEINTRESOURCE(IDR_ACCELERATOR1));
  58.  
  59.     int nResponse = dlg.DoModal();
  60.     if (nResponse == IDOK)
  61.     {
  62.         // TODO: Place code here to handle when the dialog is
  63.         //  dismissed with OK
  64.     }
  65.     else if (nResponse == IDCANCEL)
  66.     {
  67.         // TODO: Place code here to handle when the dialog is
  68.         //  dismissed with Cancel
  69.     }
  70.  
  71.     // Since the dialog has been closed, return FALSE so that we exit the
  72.     //  application, rather than start the application's message pump.
  73.     return FALSE;
  74. }
  75.  
  76.  
  77. BOOL CHangman32App::ProcessMessageFilter(int code, LPMSG lpMsg) 
  78. {
  79.     if(code < 0)
  80.         CWinApp::ProcessMessageFilter(code, lpMsg);
  81.     if( m_hwndDialog && m_AccelTable && m_doAccel )
  82.     {
  83.         if(::TranslateAccelerator(m_hwndDialog, m_AccelTable, lpMsg))
  84.             return(TRUE);
  85.     }    
  86.     return CWinApp::ProcessMessageFilter(code, lpMsg);
  87. }
  88.