Source code of Windows XP (NT5)
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.

89 lines
1.9 KiB

  1. // StatusTestDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "Driver.h"
  5. #import "\bin\McsDctWorkerObjects.tlb" no_namespace, named_guids
  6. #include "Status.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CStatusTestDlg property page
  14. IMPLEMENT_DYNCREATE(CStatusTestDlg, CPropertyPage)
  15. CStatusTestDlg::CStatusTestDlg() : CPropertyPage(CStatusTestDlg::IDD)
  16. {
  17. //{{AFX_DATA_INIT(CStatusTestDlg)
  18. m_Status = 0;
  19. //}}AFX_DATA_INIT
  20. }
  21. CStatusTestDlg::~CStatusTestDlg()
  22. {
  23. }
  24. void CStatusTestDlg::DoDataExchange(CDataExchange* pDX)
  25. {
  26. CPropertyPage::DoDataExchange(pDX);
  27. //{{AFX_DATA_MAP(CStatusTestDlg)
  28. DDX_Text(pDX, IDC_STATUS, m_Status);
  29. //}}AFX_DATA_MAP
  30. }
  31. BEGIN_MESSAGE_MAP(CStatusTestDlg, CPropertyPage)
  32. //{{AFX_MSG_MAP(CStatusTestDlg)
  33. ON_BN_CLICKED(IDC_GET_STATUS, OnGetStatus)
  34. ON_BN_CLICKED(IDC_SET_STATUS, OnSetStatus)
  35. //}}AFX_MSG_MAP
  36. END_MESSAGE_MAP()
  37. /////////////////////////////////////////////////////////////////////////////
  38. // CStatusTestDlg message handlers
  39. void CStatusTestDlg::OnGetStatus()
  40. {
  41. UpdateData(TRUE);
  42. CWaitCursor w;
  43. HRESULT hr = pStatus->get_Status(&m_Status);
  44. if ( FAILED(hr) )
  45. {
  46. CString r;
  47. r.Format(L"GetStatus failed, hr=%lx",hr);
  48. MessageBox(r);
  49. }
  50. UpdateData(FALSE);
  51. }
  52. void CStatusTestDlg::OnSetStatus()
  53. {
  54. UpdateData(TRUE);
  55. CWaitCursor w;
  56. HRESULT hr = pStatus->put_Status(m_Status);
  57. if ( FAILED(hr) )
  58. {
  59. CString r;
  60. r.Format(L"PutStatus failed, hr=%lx",hr);
  61. MessageBox(r);
  62. }
  63. UpdateData(FALSE);
  64. }
  65. BOOL CStatusTestDlg::OnSetActive()
  66. {
  67. HRESULT hr = pStatus.CreateInstance(CLSID_StatusObj);
  68. if (FAILED(hr) )
  69. {
  70. CString r;
  71. r.Format(L"Failed to create StatusObj, CoCreateInstance returned %lx",hr);
  72. MessageBox(r);
  73. }
  74. return CPropertyPage::OnSetActive();
  75. }