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.

156 lines
3.4 KiB

  1. // StatusDlg.h : Declaration of the CStatusDlg
  2. #ifndef __STATUSDLG_H_
  3. #define __STATUSDLG_H_
  4. #include "resource.h" // main symbols
  5. #include <atlhost.h>
  6. #include <atlapp.h>
  7. #include <atlmisc.h>
  8. #include <atlctrls.h>
  9. #define MSG_STATUS WM_USER+100
  10. extern HWND g_StatusDlg;
  11. #define DLGTIMER 100
  12. ////////////////////////////////////////////////////////////////////////////
  13. // CStatusDlg
  14. class CStatusDlg :
  15. public CAxDialogImpl<CStatusDlg>
  16. {
  17. private:
  18. BOOL bDeclined;
  19. public:
  20. CStatusDlg():bDeclined(FALSE)
  21. {
  22. }
  23. ~CStatusDlg()
  24. {
  25. }
  26. enum { IDD = IDD_STATUSDLG };
  27. BEGIN_MSG_MAP(CStatusDlg)
  28. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  29. MESSAGE_HANDLER(WM_TIMER, OnTimer)
  30. MESSAGE_HANDLER(MSG_STATUS, OnStatusMsg)
  31. COMMAND_ID_HANDLER(IDOK, OnOK)
  32. COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
  33. REFLECT_NOTIFICATIONS() // reflect messages back to static ctrls
  34. END_MSG_MAP()
  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. CenterWindow(::GetDesktopWindow());
  42. g_StatusDlg = m_hWnd;
  43. return 1; // Let the system set the focus
  44. }
  45. LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  46. {
  47. KillTimer(DLGTIMER);
  48. EndDialog(IDOK);
  49. return 0;
  50. }
  51. LRESULT OnStatusMsg(UINT uMsg, WPARAM nStatus, LPARAM lParam, BOOL& bHandled)
  52. {
  53. INT nResID = 0;
  54. CButton btnCancel = GetDlgItem(IDCANCEL);
  55. switch(nStatus)
  56. {
  57. case RA_IM_COMPLETE:
  58. nResID = IDS_RA_IM_COMPLETE;
  59. break;
  60. case RA_IM_WAITFORCONNECT:
  61. {
  62. nResID = IDS_RA_IM_WAITFORCONNECT;
  63. btnCancel.EnableWindow(FALSE);
  64. SetTimer(DLGTIMER,2000);
  65. }
  66. break;
  67. case RA_IM_APPSHUTDOWN:
  68. nResID = IDS_RA_IM_APPSHUTDOWN;
  69. break;
  70. case RA_IM_SENDINVITE:
  71. nResID = IDS_RA_IM_SENDINVITE;
  72. break;
  73. case RA_IM_ACCEPTED:
  74. {
  75. nResID = IDS_RA_IM_ACCEPTED;
  76. btnCancel.EnableWindow(FALSE);
  77. CStatic statMsg(GetDlgItem(IDC_STAMSG));
  78. statMsg.ShowWindow(SW_HIDE);
  79. }
  80. break;
  81. case RA_IM_DECLINED:
  82. {
  83. nResID = IDS_RA_IM_DECLINED;
  84. bDeclined = TRUE;
  85. CStatic statMsg(GetDlgItem(IDC_STAMSG));
  86. statMsg.ShowWindow(SW_HIDE);
  87. }
  88. break;
  89. case RA_IM_NOAPP:
  90. nResID = IDS_RA_IM_NOAPP;
  91. break;
  92. case RA_IM_TERMINATED:
  93. {
  94. if (bDeclined != TRUE)
  95. nResID = IDS_RA_IM_TERMINATED;
  96. }
  97. break;
  98. case RA_IM_CANCELLED:
  99. nResID = IDS_RA_IM_CANCELLED;
  100. break;
  101. case RA_IM_CONNECTTOEXPERT:
  102. nResID = IDS_RA_IM_CONNECTTOEXPERT;
  103. break;
  104. }
  105. if (nResID)
  106. {
  107. CString strRes;
  108. if (strRes.LoadString(nResID))
  109. {
  110. CStatic status(GetDlgItem(IDC_STATUS));
  111. status.SetWindowText(strRes);
  112. }
  113. }
  114. if (nStatus == RA_IM_COMPLETE)
  115. EndDialog(IDOK);
  116. return 0;
  117. }
  118. LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
  119. {
  120. EndDialog(wID);
  121. return 0;
  122. }
  123. LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
  124. {
  125. CString strRes;
  126. if (strRes.LoadString(RA_IM_CANCELLED))
  127. {
  128. CStatic status(GetDlgItem(IDC_STATUS));
  129. status.SetWindowText(strRes);
  130. }
  131. EndDialog(wID);
  132. return 0;
  133. }
  134. };
  135. #endif //__STATUSDLG_H_