home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / general / helloapp / helloapp.cpp next >
C/C++ Source or Header  |  1998-03-26  |  2KB  |  60 lines

  1. // helloapp.cpp : Minimal MFC Windows app.
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1998 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include <afxwin.h>
  14.  
  15. #ifdef MINIMAL
  16.  
  17. // Stub out non-critical CRT initialization functions
  18. extern "C" void _setenvp() { }
  19. extern "C" void _setargv() { }
  20.  
  21. // Define a window class derived from CWnd
  22. class CHelloWindow : public CWnd
  23. {
  24. public:
  25.     CHelloWindow()
  26.     {
  27.         CreateEx(WS_EX_CLIENTEDGE,
  28.             AfxRegisterWndClass(0, ::LoadCursor(NULL, IDC_ARROW), (HBRUSH)(COLOR_WINDOW+1)),
  29.             _T("Hello World!"), WS_OVERLAPPEDWINDOW,
  30.             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, 0);
  31.     }
  32. };
  33.  
  34. #else
  35.  
  36. // Define a window class derived from CFrameWnd
  37. class CHelloWindow : public CFrameWnd
  38. {
  39. public:
  40.     CHelloWindow()
  41.         { Create(NULL, _T("Hello World!"), WS_OVERLAPPEDWINDOW, rectDefault); }
  42. };
  43.  
  44. #endif
  45.  
  46. // Define an application class derived from CWinApp
  47. class CHelloApp : public CWinApp
  48. {
  49. public:
  50.     virtual BOOL InitInstance()
  51.     {
  52.         m_pMainWnd = new CHelloWindow();
  53.         m_pMainWnd->ShowWindow(m_nCmdShow);
  54.         m_pMainWnd->UpdateWindow();
  55.         return TRUE;
  56.     }
  57. };
  58.  
  59. CHelloApp HelloApp;  // HelloApp's constructor initializes and runs the app
  60.