d.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. //Download by http://www.NewXing.com
  2. // d.cpp : Defines the class behaviors for the application.
  3. //
  4. #include "stdafx.h"
  5. #include "d.h"
  6. #include "dDlg.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CDApp
  14. BEGIN_MESSAGE_MAP(CDApp, CWinApp)
  15. //{{AFX_MSG_MAP(CDApp)
  16. // NOTE - the ClassWizard will add and remove mapping macros here.
  17. // DO NOT EDIT what you see in these blocks of generated code!
  18. //}}AFX_MSG
  19. ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  20. END_MESSAGE_MAP()
  21. /////////////////////////////////////////////////////////////////////////////
  22. // CDApp construction
  23. CDApp::CDApp()
  24. {
  25. // TODO: add construction code here,
  26. // Place all significant initialization in InitInstance
  27. }
  28. /////////////////////////////////////////////////////////////////////////////
  29. // The one and only CDApp object
  30. CDApp theApp;
  31. /////////////////////////////////////////////////////////////////////////////
  32. // CDApp initialization
  33. BOOL CDApp::InitInstance()
  34. {
  35. AfxEnableControlContainer();
  36. // Standard initialization
  37. // If you are not using these features and wish to reduce the size
  38. // of your final executable, you should remove from the following
  39. // the specific initialization routines you do not need.
  40. #ifdef _AFXDLL
  41. Enable3dControls(); // Call this when using MFC in a shared DLL
  42. #else
  43. Enable3dControlsStatic(); // Call this when linking to MFC statically
  44. #endif
  45. if(this->OSVer()!="WinXP")
  46. {
  47. typedef BOOL (WINAPI *pClassXP)(HWND,BOOL);
  48. HINSTANCE hInst=NULL;
  49. hInst=::LoadLibrary("ClassXP.dll");
  50. if (hInst)
  51. {
  52. pClassXP pFunc= (pClassXP)GetProcAddress (hInst,"ClassXP");
  53. pFunc(NULL,TRUE);
  54. }
  55. }
  56. CDDlg dlg;
  57. m_pMainWnd = &dlg;
  58. int nResponse = dlg.DoModal();
  59. if (nResponse == IDOK)
  60. {
  61. // TODO: Place code here to handle when the dialog is
  62. // dismissed with OK
  63. }
  64. else if (nResponse == IDCANCEL)
  65. {
  66. // TODO: Place code here to handle when the dialog is
  67. // dismissed with Cancel
  68. }
  69. // Since the dialog has been closed, return FALSE so that we exit the
  70. // application, rather than start the application's message pump.
  71. return FALSE;
  72. }
  73. CString CDApp::OSVer()
  74. {
  75. OSVERSIONINFOEX os;
  76. ::ZeroMemory(&os,sizeof(os));
  77. os.dwOSVersionInfoSize=sizeof(os);
  78. ::GetVersionEx(reinterpret_cast<LPOSVERSIONINFO>(&os));
  79. if(os.dwPlatformId==VER_PLATFORM_WIN32_NT && os.dwMajorVersion >=5)
  80. {
  81. if(os.dwMinorVersion==0)
  82. return "Win2000";
  83. else
  84. return "WinXP";
  85. }
  86. if(os.dwPlatformId ==VER_PLATFORM_WIN32_WINDOWS)
  87. return "Win9x";}