Test.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // Test.cpp : 定义应用程序的类行为。
  2. //
  3. #include "stdafx.h"
  4. #include "Test.h"
  5. #include "TestDlg.h"
  6. #include "CalendarEx.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #endif
  10. // CTestApp
  11. BEGIN_MESSAGE_MAP(CTestApp, CWinAppEx)
  12. ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
  13. END_MESSAGE_MAP()
  14. // CTestApp 构造
  15. CTestApp::CTestApp()
  16. {
  17. // TODO: 在此处添加构造代码,
  18. // 将所有重要的初始化放置在 InitInstance 中
  19. }
  20. // 唯一的一个 CTestApp 对象
  21. CTestApp theApp;
  22. // CTestApp 初始化
  23. BOOL CTestApp::InitInstance()
  24. {
  25. // 如果一个运行在 Windows XP 上的应用程序清单指定要
  26. // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
  27. //则需要 InitCommonControlsEx()。否则,将无法创建窗口。
  28. INITCOMMONCONTROLSEX InitCtrls;
  29. InitCtrls.dwSize = sizeof(InitCtrls);
  30. // 将它设置为包括所有要在应用程序中使用的
  31. // 公共控件类。
  32. InitCtrls.dwICC = ICC_WIN95_CLASSES;
  33. InitCommonControlsEx(&InitCtrls);
  34. CWinAppEx::InitInstance();
  35. AfxEnableControlContainer();
  36. TCHAR szSolar[MAX_PATH] = {0};
  37. CalendarEx::LuanrToSolarDate(2015, 2, 26, szSolar);
  38. CalendarEx::LuanrToSolarDate(2016, 12, 20, szSolar);
  39. // 标准初始化
  40. // 如果未使用这些功能并希望减小
  41. // 最终可执行文件的大小,则应移除下列
  42. // 不需要的特定初始化例程
  43. // 更改用于存储设置的注册表项
  44. // TODO: 应适当修改该字符串,
  45. // 例如修改为公司或组织名
  46. SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
  47. CTestDlg dlg;
  48. m_pMainWnd = &dlg;
  49. INT_PTR nResponse = dlg.DoModal();
  50. if (nResponse == IDOK)
  51. {
  52. // TODO: 在此放置处理何时用
  53. // “确定”来关闭对话框的代码
  54. }
  55. else if (nResponse == IDCANCEL)
  56. {
  57. // TODO: 在此放置处理何时用
  58. // “取消”来关闭对话框的代码
  59. }
  60. // 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
  61. // 而不是启动应用程序的消息泵。
  62. return FALSE;
  63. }