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.

233 lines
6.8 KiB

  1. // ArchiveMsgDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ConfigTest.h"
  5. #include "ArchiveMsgDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CArchiveMsgDlg dialog
  13. CArchiveMsgDlg::CArchiveMsgDlg(HANDLE hFax,
  14. FAX_ENUM_MESSAGE_FOLDER Folder,
  15. DWORDLONG dwlMsgId,
  16. CWnd* pParent /*=NULL*/)
  17. : CDialog(CArchiveMsgDlg::IDD, pParent),
  18. m_Folder (Folder),
  19. m_dwlMsgId (dwlMsgId),
  20. m_hFax (hFax)
  21. {
  22. //{{AFX_DATA_INIT(CArchiveMsgDlg)
  23. m_cstrBillingCode = _T("*");
  24. m_cstrCallerId = _T("");
  25. m_cstrCSID = _T("*");
  26. m_cstrDeviceName = _T("*");
  27. m_cstrDocumentName = _T("*");
  28. m_cstrTransmissionEndTime = _T("*");
  29. m_cstrFolderName = _T("*");
  30. m_cstrMsgId = _T("*");
  31. m_cstrOrigirnalSchedTime = _T("*");
  32. m_cstrNumPages = _T("*");
  33. m_cstrPriority = _T("*");
  34. m_cstrRecipientName = _T("*");
  35. m_cstrRecipientNumber = _T("*");
  36. m_cstrRetries = _T("*");
  37. m_cstrRoutingInfo = _T("*");
  38. m_cstrSenderName = _T("*");
  39. m_cstrSenderNumber = _T("*");
  40. m_cstrSendingUser = _T("*");
  41. m_cstrTransmissionStartTime = _T("*");
  42. m_cstrSubject = _T("*");
  43. m_cstrSumbissionTime = _T("*");
  44. m_cstrTSID = _T("*");
  45. m_cstrJobType = _T("*");
  46. m_cstrMsgSize = _T("*");
  47. //}}AFX_DATA_INIT
  48. }
  49. void CArchiveMsgDlg::DoDataExchange(CDataExchange* pDX)
  50. {
  51. CDialog::DoDataExchange(pDX);
  52. //{{AFX_DATA_MAP(CArchiveMsgDlg)
  53. DDX_Text(pDX, IDC_BILLING, m_cstrBillingCode);
  54. DDX_Text(pDX, IDC_CALLERID, m_cstrCallerId);
  55. DDX_Text(pDX, IDC_CSID_VAL, m_cstrCSID);
  56. DDX_Text(pDX, IDC_DEVICE, m_cstrDeviceName);
  57. DDX_Text(pDX, IDC_DOCUMENT, m_cstrDocumentName);
  58. DDX_Text(pDX, IDC_END_TIME, m_cstrTransmissionEndTime);
  59. DDX_Text(pDX, IDC_FOLDER, m_cstrFolderName);
  60. DDX_Text(pDX, IDC_ID, m_cstrMsgId);
  61. DDX_Text(pDX, IDC_ORIGTIME, m_cstrOrigirnalSchedTime);
  62. DDX_Text(pDX, IDC_PAGES, m_cstrNumPages);
  63. DDX_Text(pDX, IDC_PRIORITY, m_cstrPriority);
  64. DDX_Text(pDX, IDC_R_NAME, m_cstrRecipientName);
  65. DDX_Text(pDX, IDC_R_NUMBER, m_cstrRecipientNumber);
  66. DDX_Text(pDX, IDC_RETRIES, m_cstrRetries);
  67. DDX_Text(pDX, IDC_ROUTINGINFO, m_cstrRoutingInfo);
  68. DDX_Text(pDX, IDC_S_NAME, m_cstrSenderName);
  69. DDX_Text(pDX, IDC_S_NUMBER, m_cstrSenderNumber);
  70. DDX_Text(pDX, IDC_SEND_USER, m_cstrSendingUser);
  71. DDX_Text(pDX, IDC_START_TIME, m_cstrTransmissionStartTime);
  72. DDX_Text(pDX, IDC_SUBJECT, m_cstrSubject);
  73. DDX_Text(pDX, IDC_SUBMITTIME, m_cstrSumbissionTime);
  74. DDX_Text(pDX, IDC_TSID_VAL, m_cstrTSID);
  75. DDX_Text(pDX, IDC_TYPE, m_cstrJobType);
  76. DDX_Text(pDX, IDS_SIZE, m_cstrMsgSize);
  77. //}}AFX_DATA_MAP
  78. }
  79. BEGIN_MESSAGE_MAP(CArchiveMsgDlg, CDialog)
  80. //{{AFX_MSG_MAP(CArchiveMsgDlg)
  81. ON_BN_CLICKED(IDREMOVE, OnRemove)
  82. //}}AFX_MSG_MAP
  83. END_MESSAGE_MAP()
  84. /////////////////////////////////////////////////////////////////////////////
  85. // CArchiveMsgDlg message handlers
  86. void CArchiveMsgDlg::OnRemove()
  87. {
  88. if (!FaxRemoveMessage (m_hFax,
  89. m_dwlMsgId,
  90. m_Folder))
  91. {
  92. CString cs;
  93. cs.Format ("Failed while calling FaxRemoveMessage (%ld)",
  94. GetLastError ());
  95. AfxMessageBox (cs, MB_OK | MB_ICONHAND);
  96. }
  97. else
  98. {
  99. EndDialog (99);
  100. }
  101. }
  102. void
  103. CArchiveMsgDlg::SetNumber (
  104. CString &cstrDest,
  105. DWORD dwValue,
  106. BOOL bAvail)
  107. {
  108. if (!bAvail)
  109. {
  110. cstrDest = "N/A";
  111. }
  112. else
  113. {
  114. cstrDest.Format ("%ld", dwValue);
  115. }
  116. }
  117. void
  118. CArchiveMsgDlg::SetTime (
  119. CString &cstrDest,
  120. SYSTEMTIME dwTime,
  121. BOOL bAvail)
  122. {
  123. if (!bAvail)
  124. {
  125. cstrDest = "N/A";
  126. }
  127. else
  128. {
  129. cstrDest.Format ("%02d:%02d:%02d", dwTime.wHour, dwTime.wMinute, dwTime.wSecond);
  130. }
  131. }
  132. BOOL CArchiveMsgDlg::OnInitDialog()
  133. {
  134. CDialog::OnInitDialog();
  135. PFAX_MESSAGE pMsg;
  136. CString cs;
  137. if (!FaxGetMessage (m_hFax,
  138. m_dwlMsgId,
  139. m_Folder,
  140. &pMsg))
  141. {
  142. cs.Format ("Failed while calling FaxGetMessage (%ld)",
  143. GetLastError ());
  144. AfxMessageBox (cs, MB_OK | MB_ICONHAND);
  145. return FALSE;
  146. }
  147. m_cstrFolderName = m_Folder == FAX_MESSAGE_FOLDER_INBOX ? "Inbox" : "Sent items";
  148. m_cstrMsgId.Format ("0x%016I64x", pMsg->dwlMessageId);
  149. if (!(pMsg->dwValidityMask & FAX_JOB_FIELD_TYPE))
  150. {
  151. m_cstrJobType = "N/A";
  152. }
  153. else
  154. {
  155. if (JT_SEND == pMsg->dwJobType)
  156. {
  157. m_cstrJobType = "Send";
  158. }
  159. else if (JT_RECEIVE == pMsg->dwJobType)
  160. {
  161. m_cstrJobType = "Receive";
  162. }
  163. else
  164. {
  165. m_cstrJobType.Format ("Bad (%ld)", pMsg->dwJobType);
  166. }
  167. }
  168. SetNumber (m_cstrMsgSize, pMsg->dwSize, pMsg->dwValidityMask & FAX_JOB_FIELD_SIZE);
  169. SetNumber (m_cstrNumPages, pMsg->dwPageCount, pMsg->dwValidityMask & FAX_JOB_FIELD_PAGE_COUNT);
  170. m_cstrRecipientNumber = pMsg->lpctstrRecipientNumber;
  171. m_cstrRecipientName = pMsg->lpctstrRecipientName;
  172. m_cstrSenderNumber = pMsg->lpctstrSenderNumber;
  173. m_cstrSenderName = pMsg->lpctstrSenderName;
  174. m_cstrTSID = pMsg->lpctstrTsid;
  175. m_cstrCSID = pMsg->lpctstrCsid;
  176. m_cstrSendingUser = pMsg->lpctstrSenderUserName;
  177. m_cstrBillingCode = pMsg->lpctstrBillingCode;
  178. SetTime (m_cstrOrigirnalSchedTime, pMsg->tmOriginalScheduleTime, pMsg->dwValidityMask & FAX_JOB_FIELD_ORIGINAL_SCHEDULE_TIME);
  179. SetTime (m_cstrSumbissionTime, pMsg->tmSubmissionTime, pMsg->dwValidityMask & FAX_JOB_FIELD_SUBMISSION_TIME);
  180. SetTime (m_cstrTransmissionStartTime, pMsg->tmTransmissionStartTime, pMsg->dwValidityMask & FAX_JOB_FIELD_TRANSMISSION_START_TIME);
  181. SetTime (m_cstrTransmissionEndTime, pMsg->tmTransmissionEndTime, pMsg->dwValidityMask & FAX_JOB_FIELD_TRANSMISSION_END_TIME);
  182. m_cstrDeviceName = pMsg->lpctstrDeviceName;
  183. if (!(pMsg->dwValidityMask & FAX_JOB_FIELD_PRIORITY))
  184. {
  185. m_cstrPriority = "N/A";
  186. }
  187. else
  188. {
  189. if (FAX_PRIORITY_TYPE_LOW == pMsg->Priority)
  190. {
  191. m_cstrPriority = "Low";
  192. }
  193. else if (FAX_PRIORITY_TYPE_NORMAL == pMsg->Priority)
  194. {
  195. m_cstrPriority = "Normal";
  196. }
  197. else if (FAX_PRIORITY_TYPE_HIGH == pMsg->Priority)
  198. {
  199. m_cstrPriority = "High";
  200. }
  201. else
  202. {
  203. m_cstrPriority.Format ("Bad (%ld)", pMsg->Priority);
  204. }
  205. }
  206. SetNumber (m_cstrRetries, pMsg->dwRetries, pMsg->dwValidityMask & FAX_JOB_FIELD_RETRIES);
  207. m_cstrDocumentName = pMsg->lpctstrDocumentName;
  208. m_cstrSubject = pMsg->lpctstrSubject;
  209. m_cstrCallerId = pMsg->lpctstrCallerID;
  210. m_cstrRoutingInfo = pMsg->lpctstrRoutingInfo;
  211. FaxFreeBuffer ((LPVOID)pMsg);
  212. UpdateData (FALSE);
  213. return TRUE; // return TRUE unless you set the focus to a control
  214. // EXCEPTION: OCX Property Pages should return FALSE
  215. }