ZGKJ.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. 
  2. // ZGKJ.cpp: 定义应用程序的类行为。
  3. //
  4. #include "pch.h"
  5. #include "framework.h"
  6. #include "ZGKJ.h"
  7. #include "ZGKJDlg.h"
  8. #include "Personnel.h"
  9. #include "SupportStaff.h"
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #endif
  13. // CZGKJApp
  14. BEGIN_MESSAGE_MAP(CZGKJApp, CWinApp)
  15. ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
  16. END_MESSAGE_MAP()
  17. // CZGKJApp 构造
  18. CZGKJApp::CZGKJApp()
  19. {
  20. // 支持重新启动管理器
  21. m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
  22. //sql = HtlMysql::GetInstance() ;
  23. // TODO: 在此处添加构造代码,
  24. // 将所有重要的初始化放置在 InitInstance 中
  25. }
  26. // 唯一的 CZGKJApp 对象
  27. CZGKJApp theApp;
  28. // CZGKJApp 初始化
  29. BOOL CZGKJApp::InitInstance()
  30. {
  31. CZGKJDlg startdlg;
  32. //m_pMainWnd = &startdlg;
  33. INT_PTR nResponse = startdlg.DoModal();
  34. //startdlg.ShowWindow(1);
  35. switch (Department_ID)
  36. {
  37. case 1:
  38. {
  39. Personnel personnel;
  40. personnel.DoModal();
  41. }break;
  42. case 3:
  43. {
  44. SupportStaff supportstaff;
  45. supportstaff.DoModal();
  46. }
  47. }
  48. #if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS)
  49. ControlBarCleanUp();
  50. #endif
  51. // 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
  52. // 而不是启动应用程序的消息泵。
  53. return FALSE;
  54. }
  55. char* CZGKJApp::MyTtoA(CString str)
  56. {
  57. int length = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
  58. char* pTemp = new char[length];
  59. WideCharToMultiByte(CP_ACP, 0, str, -1, pTemp, length, NULL, NULL);
  60. return pTemp;
  61. }
  62. CString CZGKJApp::MyAtoT(const char* c_str)
  63. {
  64. int len = MultiByteToWideChar(CP_ACP, 0,c_str, -1, NULL, 0);
  65. wchar_t* wideStr = new wchar_t[len];
  66. MultiByteToWideChar(CP_ACP, 0, c_str, -1, wideStr, len);
  67. CString Tstr(wideStr);
  68. delete[] wideStr;
  69. return CString(Tstr);
  70. }
  71. int CZGKJApp::MyTtoI(CString str)
  72. {
  73. int num = _ttoi(str);
  74. return num;
  75. }
  76. CString CZGKJApp::MyItoT(int num)
  77. {
  78. CString str;
  79. str.Format(_T("%d"), num);
  80. return CString(str);
  81. }