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.

127 lines
3.6 KiB

  1. // DlgDevice.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ConfigTest.h"
  5. #ifdef _DEBUG
  6. #define new DEBUG_NEW
  7. #undef THIS_FILE
  8. static char THIS_FILE[] = __FILE__;
  9. #endif
  10. typedef unsigned long ULONG_PTR, *PULONG_PTR;
  11. typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
  12. #include "..\..\..\inc\fxsapip.h"
  13. #include "DlgDevice.h"
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CDlgDevice dialog
  16. CDlgDevice::CDlgDevice(HANDLE hFax, DWORD dwDeviceID, CWnd* pParent /*=NULL*/)
  17. : CDialog(CDlgDevice::IDD, pParent), m_hFax (hFax), m_dwDeviceID (dwDeviceID)
  18. {
  19. //{{AFX_DATA_INIT(CDlgDevice)
  20. m_cstrCSID = _T("");
  21. m_cstrDescription = _T("");
  22. m_cstrDeviceID = _T("0");
  23. m_cstrDeviceName = _T("");
  24. m_cstrProviderGUID = _T("");
  25. m_m_cstrProviderName = _T("");
  26. m_ReceiveMode = FAX_DEVICE_RECEIVE_MODE_OFF;
  27. m_dwRings = 0;
  28. m_bSend = FALSE;
  29. m_cstrTSID = _T("");
  30. //}}AFX_DATA_INIT
  31. }
  32. void CDlgDevice::DoDataExchange(CDataExchange* pDX)
  33. {
  34. CDialog::DoDataExchange(pDX);
  35. //{{AFX_DATA_MAP(CDlgDevice)
  36. DDX_Text(pDX, IDC_CSID, m_cstrCSID);
  37. DDX_Text(pDX, IDC_DESCRIPTION, m_cstrDescription);
  38. DDX_Text(pDX, IDC_DEVID, m_cstrDeviceID);
  39. DDX_Text(pDX, IDC_DEVNAME, m_cstrDeviceName);
  40. DDX_Text(pDX, IDC_PROVGUID, m_cstrProviderGUID);
  41. DDX_Text(pDX, IDC_PROVNAME, m_m_cstrProviderName);
  42. DDX_Check(pDX, IDC_RECEIVE, (int&)m_ReceiveMode);
  43. DDX_Text(pDX, IDC_RINGS, m_dwRings);
  44. DDX_Check(pDX, IDC_SEND, m_bSend);
  45. DDX_Text(pDX, IDC_TSID, m_cstrTSID);
  46. //}}AFX_DATA_MAP
  47. }
  48. BEGIN_MESSAGE_MAP(CDlgDevice, CDialog)
  49. //{{AFX_MSG_MAP(CDlgDevice)
  50. ON_BN_CLICKED(IDC_REFRESH, OnRefresh)
  51. ON_BN_CLICKED(IDC_WRITE, OnWrite)
  52. //}}AFX_MSG_MAP
  53. END_MESSAGE_MAP()
  54. /////////////////////////////////////////////////////////////////////////////
  55. // CDlgDevice message handlers
  56. BOOL CDlgDevice::OnInitDialog()
  57. {
  58. CDialog::OnInitDialog();
  59. OnRefresh();
  60. return TRUE; // return TRUE unless you set the focus to a control
  61. // EXCEPTION: OCX Property Pages should return FALSE
  62. }
  63. void CDlgDevice::OnRefresh()
  64. {
  65. PFAX_PORT_INFO_EX pDevice;
  66. if (!FaxGetPortEx (m_hFax, m_dwDeviceID, &pDevice))
  67. {
  68. CString cs;
  69. cs.Format ("Failed while calling FaxGetPortEx (%ld)", GetLastError());
  70. AfxMessageBox (cs, MB_OK | MB_ICONHAND);
  71. return;
  72. }
  73. m_cstrCSID = pDevice->lptstrCsid;
  74. m_cstrDescription = pDevice->lptstrDescription;
  75. m_cstrDeviceID.Format ("%08x", pDevice->dwDeviceID);
  76. m_cstrDeviceName = pDevice->lpctstrDeviceName;
  77. m_cstrProviderGUID = pDevice->lpctstrProviderGUID;
  78. m_m_cstrProviderName = pDevice->lpctstrProviderName;
  79. m_ReceiveMode = pDevice->ReceiveMode;
  80. m_dwRings = pDevice->dwRings;
  81. m_bSend = pDevice->bSend;
  82. m_cstrTSID = pDevice->lptstrTsid;
  83. UpdateData (FALSE);
  84. FaxFreeBuffer (LPVOID(pDevice));
  85. }
  86. void CDlgDevice::OnWrite()
  87. {
  88. UpdateData ();
  89. FAX_PORT_INFO_EX Device;
  90. Device.dwSizeOfStruct = sizeof (FAX_PORT_INFO_EX);
  91. Device.lptstrCsid = LPTSTR(LPCTSTR(m_cstrCSID));
  92. Device.lptstrDescription = LPTSTR(LPCTSTR(m_cstrDescription));
  93. Device.ReceiveMode = m_ReceiveMode;
  94. Device.dwRings = m_dwRings;
  95. Device.bSend = m_bSend;
  96. Device.lptstrTsid = LPTSTR(LPCTSTR(m_cstrTSID));
  97. Device.lpctstrDeviceName = NULL;
  98. Device.lpctstrProviderName = NULL;
  99. Device.lpctstrProviderGUID = NULL;
  100. if (!FaxSetPortEx (m_hFax, m_dwDeviceID, &Device))
  101. {
  102. CString cs;
  103. cs.Format ("Failed while calling FaxSetPortEx (%ld)", GetLastError());
  104. AfxMessageBox (cs, MB_OK | MB_ICONHAND);
  105. return;
  106. }
  107. }