WndInstalled.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #include "CFrameWnd.h"
  2. #include"MixpanelScript.h"
  3. void CFrameWnd::InitInstalledControls()
  4. {
  5. }
  6. /// <summary>
  7. /// 安装完成界面控件绑定事件
  8. /// </summary>
  9. void CFrameWnd::NotifyInstalled(TNotifyUI& msg)
  10. {
  11. if (msg.sType == _T("click"))
  12. {
  13. if (msg.pSender->GetName() == UI_BtnOpenApp)
  14. {
  15. MixpanelScript* mix = new MixpanelScript();
  16. std::string GUID = mix->GetGUID();
  17. std::string CPUID = mix->GetCPUID();
  18. mix->PostData("InstallStatus_Btn_StartSuccess", CPUID, GUID,0);
  19. OpenApp_Click();
  20. }
  21. }
  22. }
  23. LRESULT CFrameWnd::InstalledMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  24. {
  25. LRESULT lRes = 0;
  26. BOOL bHandled1 = TRUE;
  27. if (m_pm.MessageHandler(uMsg, wParam, lParam, lRes)) return lRes;
  28. return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
  29. }
  30. void CFrameWnd::OpenApp_Click()
  31. {
  32. if (IsNeedReStartSystem)
  33. {
  34. ReStartSystem();
  35. return;
  36. }
  37. wstring s = PathCore::smPath_Install + L"\\" + Product::smName_Application;
  38. auto histance = ShellExecute(NULL, L"open", s.c_str(), NULL, NULL, SW_SHOWNORMAL);
  39. assert(histance > (HINSTANCE)HINSTANCE_ERROR);
  40. ::DestroyWindow(m_hWnd);
  41. }
  42. void CFrameWnd::Thread_OpenApp( ThreadData threadData)
  43. {
  44. }
  45. void CFrameWnd::ReStartSystem()
  46. {
  47. if (IsNeedReStartSystem)
  48. {
  49. if (MSGID_OK == MessageBoxWnd::Show(m_hWnd, MessageContentType::ReStartSystem))
  50. {
  51. system("shutdown -i -r");
  52. }
  53. }
  54. }