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.

85 lines
2.3 KiB

  1. // QueueState.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ConfigTest.h"
  5. #include "QueueState.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. typedef unsigned long ULONG_PTR, *PULONG_PTR;
  12. typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
  13. #include "..\..\..\inc\fxsapip.h"
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CQueueState dialog
  16. CQueueState::CQueueState(HANDLE hFax, CWnd* pParent /*=NULL*/)
  17. : CDialog(CQueueState::IDD, pParent), m_hFax (hFax)
  18. {
  19. //{{AFX_DATA_INIT(CQueueState)
  20. m_bInboxBlocked = FALSE;
  21. m_bOutboxBlocked = FALSE;
  22. m_bOutboxPaused = FALSE;
  23. //}}AFX_DATA_INIT
  24. }
  25. void CQueueState::DoDataExchange(CDataExchange* pDX)
  26. {
  27. CDialog::DoDataExchange(pDX);
  28. //{{AFX_DATA_MAP(CQueueState)
  29. DDX_Check(pDX, IDC_INCOMING_BLOCKED, m_bInboxBlocked);
  30. DDX_Check(pDX, IDC_OUTBOX_BLOCKED, m_bOutboxBlocked);
  31. DDX_Check(pDX, IDC_OUTBOX_PAUSED, m_bOutboxPaused);
  32. //}}AFX_DATA_MAP
  33. }
  34. BEGIN_MESSAGE_MAP(CQueueState, CDialog)
  35. //{{AFX_MSG_MAP(CQueueState)
  36. ON_BN_CLICKED(IDC_WRITE, OnWrite)
  37. ON_BN_CLICKED(IDC_READ, OnRead)
  38. //}}AFX_MSG_MAP
  39. END_MESSAGE_MAP()
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CQueueState message handlers
  42. void CQueueState::OnWrite()
  43. {
  44. UpdateData ();
  45. DWORD dwState = (m_bInboxBlocked ? FAX_INCOMING_BLOCKED : 0) |
  46. (m_bOutboxBlocked ? FAX_OUTBOX_BLOCKED : 0) |
  47. (m_bOutboxPaused ? FAX_OUTBOX_PAUSED : 0);
  48. if (!FaxSetQueue (m_hFax, dwState))
  49. {
  50. CString cs;
  51. cs.Format ("Failed while calling FaxSetQueue (%ld)", GetLastError());
  52. AfxMessageBox (cs, MB_OK | MB_ICONHAND);
  53. return;
  54. }
  55. }
  56. void CQueueState::OnRead()
  57. {
  58. DWORD dwState;
  59. if (!FaxGetQueueStates (m_hFax, &dwState))
  60. {
  61. CString cs;
  62. cs.Format ("Failed while calling FaxGetQueueStates (%ld)", GetLastError());
  63. AfxMessageBox (cs, MB_OK | MB_ICONHAND);
  64. return;
  65. }
  66. m_bInboxBlocked = (dwState & FAX_INCOMING_BLOCKED) ? TRUE : FALSE;
  67. m_bOutboxBlocked = (dwState & FAX_OUTBOX_BLOCKED) ? TRUE : FALSE;
  68. m_bOutboxPaused = (dwState & FAX_OUTBOX_PAUSED) ? TRUE : FALSE;
  69. UpdateData (FALSE);
  70. }