Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.5 KiB

  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. #include <afxwin.h>
  13. #ifdef MINIMAL
  14. // Stub out non-critical CRT initialization functions
  15. extern "C" void _setenvp() { }
  16. extern "C" void _setargv() { }
  17. // Define a window class derived from CWnd
  18. class CHelloWindow : public CWnd
  19. {
  20. public:
  21. CHelloWindow()
  22. {
  23. CreateEx(WS_EX_CLIENTEDGE,
  24. AfxRegisterWndClass(0, ::LoadCursor(NULL, IDC_ARROW), (HBRUSH)(COLOR_WINDOW+1)),
  25. _T("Hello World!"), WS_OVERLAPPEDWINDOW,
  26. CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, 0);
  27. }
  28. };
  29. #else
  30. // Define a window class derived from CFrameWnd
  31. class CHelloWindow : public CFrameWnd
  32. {
  33. public:
  34. CHelloWindow()
  35. { Create(NULL, _T("Hello World!"), WS_OVERLAPPEDWINDOW, rectDefault); }
  36. };
  37. #endif
  38. // Define an application class derived from CWinApp
  39. class CHelloApp : public CWinApp
  40. {
  41. public:
  42. virtual BOOL InitInstance()
  43. {
  44. m_pMainWnd = new CHelloWindow();
  45. m_pMainWnd->ShowWindow(m_nCmdShow);
  46. m_pMainWnd->UpdateWindow();
  47. return TRUE;
  48. }
  49. };
  50. CHelloApp HelloApp; // HelloApp's constructor initializes and runs the app