AutoUpdate.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // AllSrvUpdate.h : Declaration of the CAutoUpdate
  2. #ifndef __ALLSRVUPDATE_H_
  3. #define __ALLSRVUPDATE_H_
  4. #include "resource.h" // main symbols
  5. #include <atlhost.h>
  6. /////////////////////////////////////////////////////////////////////////////
  7. // CAutoUpdate
  8. class CAutoUpdate :
  9. public CDialogImpl<CAutoUpdate>
  10. // public CSimpleDialog<IDD_ALLSRVUPDATE>
  11. {
  12. // Message Map
  13. public:
  14. BEGIN_MSG_MAP(CAutoUpdate)
  15. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  16. MESSAGE_HANDLER(WM_DESTROY, OnDestroyWindow)
  17. COMMAND_ID_HANDLER(IDOK, OnOK)
  18. COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
  19. END_MSG_MAP()
  20. // Construction / Destruction
  21. public:
  22. CAutoUpdate() :
  23. m_bUpdatingService(false),
  24. m_nExitCode(1)
  25. {
  26. m_szPostUpdateEXE[0] = 0;
  27. }
  28. ~CAutoUpdate()
  29. {
  30. }
  31. // Operations
  32. public:
  33. int Init(int argc, char* argv[]);
  34. int Run();
  35. // Handler prototypes:
  36. // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  37. // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  38. // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  39. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  40. {
  41. m_ProgressFileList = GetDlgItem(IDC_PROGRESS_FILELIST);
  42. m_ProgressAnalyze = GetDlgItem(IDC_PROGRESS_ANALYZE );
  43. m_ProgressDownload = GetDlgItem(IDC_PROGRESS_DOWNLOAD);
  44. m_staticFileName = GetDlgItem(IDC_STATIC_FILENAME );
  45. m_staticFileName.SetWindowText("");
  46. return 1; // Let the system set the focus
  47. }
  48. LRESULT OnDestroyWindow(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  49. {
  50. PostQuitMessage(m_nExitCode);
  51. return 0;
  52. }
  53. LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
  54. {
  55. m_pAutoDownload->Abort();
  56. // DestroyWindow();
  57. // PostQuitMessage(1);
  58. // m_nExitCode = 0;
  59. // DestroyWindow();
  60. //EndDialog(wID);
  61. return 0;
  62. }
  63. LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
  64. {
  65. m_pAutoDownload->Abort();
  66. // m_pAutoDownload->Abort();
  67. // DestroyWindow();
  68. // PostQuitMessage(1);
  69. // m_nExitCode = 1;
  70. // DestroyWindow();
  71. //EndDialog(wID);
  72. return 0;
  73. }
  74. // Enumerations
  75. public:
  76. enum {IDD = IDD_AUTOUPDATE};
  77. CWindow m_ProgressFileList;
  78. CWindow m_ProgressAnalyze;
  79. CWindow m_ProgressDownload;
  80. CWindow m_staticFileName;
  81. char m_szPostUpdateEXE[MAX_PATH];
  82. // Data Members
  83. protected:
  84. int m_nExitCode;
  85. bool m_bUpdatingService;
  86. IAutoDownload * m_pAutoDownload;
  87. };
  88. /////////////////////////////////////////////////////////////////////////////
  89. #endif //__ALLSRVUPDATE_H_