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.

107 lines
2.3 KiB

  1. // AcctReplTestDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "driver.h"
  5. #import "\bin\McsVarSetMin.tlb" no_namespace, named_guids
  6. #include "AcctRepl.h"
  7. #include "VSEdit.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CAcctReplTestDlg property page
  15. IMPLEMENT_DYNCREATE(CAcctReplTestDlg, CPropertyPage)
  16. CAcctReplTestDlg::CAcctReplTestDlg() : CPropertyPage(CAcctReplTestDlg::IDD)
  17. {
  18. //{{AFX_DATA_INIT(CAcctReplTestDlg)
  19. // NOTE: the ClassWizard will add member initialization here
  20. //}}AFX_DATA_INIT
  21. }
  22. CAcctReplTestDlg::~CAcctReplTestDlg()
  23. {
  24. }
  25. void CAcctReplTestDlg::DoDataExchange(CDataExchange* pDX)
  26. {
  27. CPropertyPage::DoDataExchange(pDX);
  28. //{{AFX_DATA_MAP(CAcctReplTestDlg)
  29. // NOTE: the ClassWizard will add DDX and DDV calls here
  30. //}}AFX_DATA_MAP
  31. }
  32. BEGIN_MESSAGE_MAP(CAcctReplTestDlg, CPropertyPage)
  33. //{{AFX_MSG_MAP(CAcctReplTestDlg)
  34. ON_BN_CLICKED(IDC_EDIT_VARSET, OnEditVarset)
  35. ON_BN_CLICKED(IDC_PROCESS, OnProcess)
  36. //}}AFX_MSG_MAP
  37. END_MESSAGE_MAP()
  38. /////////////////////////////////////////////////////////////////////////////
  39. // CAcctReplTestDlg message handlers
  40. void CAcctReplTestDlg::OnEditVarset()
  41. {
  42. CVarSetEditDlg vedit;
  43. vedit.SetVarSet(pVarSet);
  44. vedit.DoModal();
  45. pVarSet = vedit.GetVarSet();
  46. }
  47. void CAcctReplTestDlg::OnProcess()
  48. {
  49. UpdateData(TRUE);
  50. CWaitCursor w;
  51. if ( pVarSet == NULL )
  52. {
  53. OnEditVarset();
  54. }
  55. if ( pVarSet != NULL )
  56. {
  57. IUnknown * pUnk = NULL;
  58. pVarSet.QueryInterface(IID_IUnknown,&pUnk);
  59. HRESULT hr = pAR->raw_Process(pUnk);
  60. if (SUCCEEDED(hr) )
  61. {
  62. MessageBox(L"AcctRepl::Process succeeded!");
  63. }
  64. else
  65. {
  66. CString str;
  67. str.Format(L"AcctRepl::Process failed, hr=%lx",hr);
  68. MessageBox(str);
  69. }
  70. pUnk->Release();
  71. }
  72. else
  73. {
  74. MessageBox(L"The varset pointer is NULL.");
  75. }
  76. }
  77. BOOL CAcctReplTestDlg::OnSetActive()
  78. {
  79. HRESULT hr = pAR.CreateInstance(CLSID_AcctRepl);
  80. if ( FAILED(hr) )
  81. {
  82. CString msg;
  83. msg.Format(L"Failed to create Account Replicator, CoCreateInstance returned %lx",hr);
  84. MessageBox(msg);
  85. }
  86. return CPropertyPage::OnSetActive();
  87. }