升龙物业 老版本 ocx IPO, 加密狗 转值班电话

FirstStep.cpp 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. // FirstStep.cpp : 定义应用程序的类行为。
  2. //
  3. #include "stdafx.h"
  4. #include "FirstStep.h"
  5. #include "FirstStepDlg.h"
  6. #include "DialogDsn.h"
  7. #include "ConfigLoader.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #endif
  11. // CFirstStepApp
  12. BEGIN_MESSAGE_MAP(CFirstStepApp, CWinApp)
  13. ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
  14. END_MESSAGE_MAP()
  15. // CFirstStepApp 构造
  16. CFirstStepApp::CFirstStepApp()
  17. {
  18. // 支持重新启动管理器
  19. m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
  20. // TODO: 在此处添加构造代码,
  21. // 将所有重要的初始化放置在 InitInstance 中
  22. }
  23. // 唯一的一个 CFirstStepApp 对象
  24. CFirstStepApp theApp;
  25. // CFirstStepApp 初始化
  26. BOOL CFirstStepApp::InitInstance()
  27. {
  28. // 禁止多个实例的同时运行
  29. HANDLE hMutexOneInstance = ::CreateMutex(NULL, TRUE, _T(AfxGetAppName()));
  30. if(::GetLastError() == ERROR_ALREADY_EXISTS)
  31. {
  32. if(hMutexOneInstance) // Release the mutex
  33. {
  34. ::ReleaseMutex(hMutexOneInstance);
  35. }
  36. HWND hWndPrevious = ::GetWindow(::GetDesktopWindow(), GW_CHILD);
  37. while(::IsWindow(hWndPrevious))
  38. {
  39. // 检查窗口是否有预设的标记? 有,则是我们寻找的主窗口
  40. if(::GetProp(hWndPrevious, m_pszAppName))
  41. {
  42. // 主窗口已最小化,则恢复其大小
  43. if(::IsIconic(hWndPrevious)) ::ShowWindow(hWndPrevious, SW_RESTORE);
  44. ::SetForegroundWindow(hWndPrevious); // 将主窗激活
  45. ::SetForegroundWindow(::GetLastActivePopup(hWndPrevious)); // 将主窗的对话框激活
  46. return FALSE;
  47. } // end if
  48. hWndPrevious = ::GetWindow(hWndPrevious, GW_HWNDNEXT); // 继续寻找下一个窗口
  49. } // end while
  50. } // end if
  51. // 如果一个运行在 Windows XP 上的应用程序清单指定要
  52. // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
  53. //则需要 InitCommonControlsEx()。否则,将无法创建窗口。
  54. INITCOMMONCONTROLSEX InitCtrls;
  55. InitCtrls.dwSize = sizeof(InitCtrls);
  56. // 将它设置为包括所有要在应用程序中使用的
  57. // 公共控件类。
  58. InitCtrls.dwICC = ICC_WIN95_CLASSES;
  59. InitCommonControlsEx(&InitCtrls);
  60. CWinApp::InitInstance();
  61. AfxEnableControlContainer();
  62. // 创建 shell 管理器,以防对话框包含
  63. // 任何 shell 树视图控件或 shell 列表视图控件。
  64. CShellManager *pShellManager = new CShellManager;
  65. // 标准初始化
  66. // 如果未使用这些功能并希望减小
  67. // 最终可执行文件的大小,则应移除下列
  68. // 不需要的特定初始化例程
  69. // 更改用于存储设置的注册表项
  70. // TODO: 应适当修改该字符串,
  71. // 例如修改为公司或组织名
  72. SetRegistryKey(_T("FirstStep"));
  73. CDialogDsn DsnDlg;
  74. if(DsnDlg.DoModal() != IDOK)
  75. {
  76. AfxMessageBox(_T("数据源设置失败!"));
  77. return FALSE;
  78. }
  79. CConfigLoader::GetInstance().load();
  80. CFirstStepDlg dlg;
  81. m_pMainWnd = &dlg;
  82. INT_PTR nResponse = dlg.DoModal();
  83. if (nResponse == IDOK)
  84. {
  85. // TODO: 在此放置处理何时用
  86. // “确定”来关闭对话框的代码
  87. }
  88. else if (nResponse == IDCANCEL)
  89. {
  90. // TODO: 在此放置处理何时用
  91. // “取消”来关闭对话框的代码
  92. }
  93. // 删除上面创建的 shell 管理器。
  94. if (pShellManager != NULL)
  95. {
  96. delete pShellManager;
  97. }
  98. // 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
  99. // 而不是启动应用程序的消息泵。
  100. return FALSE;
  101. }