Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

163 lines
5.2 KiB

  1. #pragma once
  2. #include "auinternals.h"
  3. #include "resource.h"
  4. class AUCLTTopWindows
  5. {
  6. public:
  7. AUCLTTopWindows(): m_uNum(0)
  8. {
  9. ZeroMemory(m_hwnds, sizeof(m_hwnds));
  10. }
  11. void Add(HWND hwnd) {
  12. if (NULL != hwnd)
  13. {
  14. m_hwnds[m_uNum++] = hwnd;
  15. }
  16. }
  17. BOOL Remove(HWND hwnd){
  18. if (NULL == hwnd)
  19. {
  20. return FALSE;
  21. }
  22. for (UINT u = 0 ; u < m_uNum; u++)
  23. {
  24. if (hwnd == m_hwnds[u])
  25. {
  26. m_hwnds[u] = m_hwnds[m_uNum-1];
  27. m_hwnds[m_uNum-1] = NULL;
  28. m_uNum--;
  29. return TRUE;
  30. }
  31. }
  32. return FALSE;
  33. }
  34. void Dismiss(void)
  35. {
  36. DEBUGMSG("WUAUCLT dismiss %d dialogs", m_uNum);
  37. UINT uNum = m_uNum; //extra variable needed because m_uNum will change once a dialog is dismissed
  38. HWND hwnds[ARRAYSIZE(m_hwnds)];
  39. for (UINT u = 0; u < uNum; u++)
  40. {
  41. hwnds[u] = m_hwnds[u];
  42. }
  43. for (UINT u = 0; u < uNum; u++)
  44. {
  45. #ifdef DBG
  46. // TCHAR buf[100];
  47. // GetWindowText(hwnds[u], buf, 100);
  48. // DEBUGMSG("Dismiss dialog %S", buf);
  49. #endif
  50. EndDialog(hwnds[u], S_OK);
  51. }
  52. m_uNum = 0;
  53. ZeroMemory(m_hwnds, sizeof(m_hwnds));
  54. }
  55. private:
  56. UINT m_uNum; //number of top wuauclt windows
  57. HWND m_hwnds[2]; //maximum 2 top windows at the same time
  58. };
  59. #define QUITAUClient() { PostMessage(ghMainWindow, WM_CLOSE, 0, 0); }
  60. // Global Data Items
  61. extern CAUInternals* gInternals;
  62. extern UINT guExitProcess;
  63. extern CRITICAL_SECTION gcsClient;
  64. extern LPCTSTR gtszAUSchedInstallUrl;
  65. extern LPCTSTR gtszAUPrivacyUrl;
  66. // Global UI Items
  67. extern HINSTANCE ghInstance;
  68. extern HFONT ghHeaderFont;
  69. extern HWND ghMainWindow;
  70. extern HWND ghCurrentDialog;
  71. extern HWND ghCurrentMainDlg;
  72. extern AUCLTTopWindows gTopWins;
  73. extern HMENU ghCurrentMenu;
  74. extern HMENU ghPauseMenu;
  75. extern HMENU ghResumeMenu;
  76. extern HICON ghAppIcon;
  77. extern HICON ghAppSmIcon;
  78. extern HICON ghTrayIcon;
  79. extern HHOOK ghHook;
  80. extern HACCEL ghCurrentAccel;
  81. extern HCURSOR ghCursorHand;
  82. extern HCURSOR ghCursorNormal;
  83. //extern AUCatalogItemList gItemList;
  84. struct ReminderItem
  85. {
  86. DWORD timeout;
  87. WORD stringResId;
  88. };
  89. //IMPORTANT: Change constants below if you change ReminderItems constant
  90. extern const ReminderItem ReminderTimes[];
  91. typedef enum tagTIMEOUTINDEX
  92. {
  93. TIMEOUT_INX_MIN = 0,
  94. TIMEOUT_INX_THIRTY_MINS = 0,
  95. TIMEOUT_INX_ONE_HOUR = 1,
  96. TIMEOUT_INX_TWO_HOURS = 2,
  97. TIMEOUT_INX_FOUR_HOURS = 3,
  98. TIMEOUT_INX_TOMORROW = 4,
  99. TIMEOUT_INX_THREE_DAYS = 5,
  100. TIMEOUT_INX_COUNT = 6
  101. } TIMEOUTINDEX;
  102. extern LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);
  103. extern void InitTrayIcon();
  104. extern void UninitPopupMenus();
  105. extern BOOL ShowTrayIcon();
  106. extern void ShowTrayBalloon(WORD, WORD, WORD );
  107. //extern void AddTrayToolTip(WORD tip);
  108. extern void RemoveTrayIcon();
  109. extern void ShowProgress();
  110. extern void QuitNRemind(TIMEOUTINDEX enTimeoutIndex);
  111. extern LPTSTR ResStrFromId(UINT uStrId);
  112. extern UINT ControlId2StringId(UINT uCtrlId);
  113. extern LRESULT CALLBACK AUTranslatorProc(int code, WPARAM wParam, LPARAM lParam);
  114. extern INT_PTR CALLBACK InstallDlgProc(HWND, UINT, WPARAM, LPARAM);
  115. extern INT_PTR CALLBACK SummaryDlgProc(HWND, UINT, WPARAM, LPARAM);
  116. extern INT_PTR CALLBACK DetailsDlgProc(HWND, UINT, WPARAM, LPARAM);
  117. extern INT_PTR CALLBACK ProgressDlgProc(HWND, UINT, WPARAM, LPARAM);
  118. extern INT_PTR CALLBACK SettingsDlgProc(HWND, UINT, WPARAM, LPARAM);
  119. extern INT_PTR CALLBACK InstallCompleteDlgProc(HWND, UINT, WPARAM, LPARAM);
  120. extern INT_PTR CALLBACK RestartDlgProc(HWND, UINT, WPARAM, LPARAM);
  121. extern INT_PTR CALLBACK WizardFrameProc(HWND, UINT, WPARAM, LPARAM);
  122. extern INT_PTR CALLBACK WelcomeDlgProc(HWND, UINT, WPARAM, LPARAM);
  123. extern INT_PTR CALLBACK NotificationOptionsDlgProc(HWND, UINT, WPARAM, LPARAM);
  124. extern INT_PTR CALLBACK SetupCompleteDlgProc(HWND, UINT, WPARAM, LPARAM);
  125. extern INT_PTR CALLBACK DownloadDlgProc(HWND, UINT, WPARAM, LPARAM);
  126. extern INT_PTR CALLBACK ReminderDlgProc(HWND, UINT, WPARAM, LPARAM);
  127. extern INT_PTR CALLBACK SetupCancelDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  128. inline void ShowSettingsDlg(HWND hWndOwner)
  129. {
  130. DialogBoxParam(ghInstance, MAKEINTRESOURCE(IDD_SETTINGS), hWndOwner, SettingsDlgProc, (LPARAM)ghInstance);
  131. }
  132. void SetClientExitCode(UINT uExitCode);
  133. inline UINT GetClientExitCode()
  134. {
  135. return guExitProcess;
  136. }
  137. extern LRESULT CALLBACK CustomLBWndProc(HWND, UINT, WPARAM, LPARAM);
  138. extern BOOL fDisableSelection(void);
  139. //extern void SaveSelection();
  140. //Index for the events in main loop
  141. const ISTATE_CHANGE = 0;
  142. const IMESSAGE = 1;
  143. const CNUM_EVENTS = 1;