home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / dbmsg / oledb / tablecopy / wizard.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-12  |  3.3 KB  |  129 lines

  1. //-----------------------------------------------------------------------------
  2. // Microsoft OLE DB TABLECOPY Sample
  3. // Copyright (C) 1995-1998 Microsoft Corporation
  4. //
  5. // @doc
  6. //
  7. // @module WIZARD.CPP
  8. //
  9. //-----------------------------------------------------------------------------
  10.  
  11.  
  12. /////////////////////////////////////////////////////////////////
  13. // Includes
  14. //
  15. /////////////////////////////////////////////////////////////////
  16. #include "common.h"
  17. #include "tablecopy.h"
  18. #include "wizard.h"
  19. #include "progress.h"
  20.  
  21.  
  22.  
  23. /////////////////////////////////////////////////////////////////////
  24. // CDialogBase::CDialogBase
  25. //
  26. /////////////////////////////////////////////////////////////////////
  27. CDialogBase::CDialogBase(HWND hWnd, HINSTANCE hInst)
  28. {
  29.     ASSERT(hInst);
  30.     
  31.     m_hWnd    = hWnd;
  32.     m_hInst = hInst;
  33. }
  34.  
  35. /////////////////////////////////////////////////////////////////////
  36. // CDialogBase::~CDialogBase
  37. //
  38. /////////////////////////////////////////////////////////////////////
  39. CDialogBase::~CDialogBase()
  40. {
  41.     Destroy();
  42. }
  43.  
  44.  
  45. /////////////////////////////////////////////////////////////////////
  46. // ULONG CDialogBase::Destroy
  47. //
  48. /////////////////////////////////////////////////////////////////////
  49. ULONG CDialogBase::Destroy()
  50. {
  51.     if(m_hWnd)
  52.     {
  53.         EndDialog(m_hWnd, 0);
  54.         m_hWnd = NULL;
  55.     }
  56.  
  57.     return 0;
  58. }
  59.  
  60.  
  61. ////////////////////////////////////////////////////////////////
  62. // CWizard::CWizard
  63. //
  64. /////////////////////////////////////////////////////////////////
  65. CWizard::CWizard(HWND hWnd, HINSTANCE hInst)
  66.     : CDialogBase(hWnd, hInst)
  67. {
  68.     m_pCTableCopy = new CTableCopy(this);
  69.     m_pCProgress = new CProgress(hWnd, hInst);
  70.  
  71.     m_iPrevStep = WIZ_STEP1;
  72.     m_rgDialogSteps[WIZ_STEP1] = new CS1Dialog(hWnd, hInst, m_pCTableCopy);
  73.     m_rgDialogSteps[WIZ_STEP2] = new CS2Dialog(hWnd, hInst, m_pCTableCopy);
  74.     m_rgDialogSteps[WIZ_STEP3] = new CS3Dialog(hWnd, hInst, m_pCTableCopy);
  75.     m_rgDialogSteps[WIZ_STEP4] = new CS4Dialog(hWnd, hInst, m_pCTableCopy);
  76.     m_rgDialogSteps[WIZ_TYPES] = new CTypesDialog(hWnd, hInst, m_pCTableCopy);
  77. }
  78.  
  79.  
  80. ////////////////////////////////////////////////////////////////
  81. // CWizard::~CWizard
  82. //
  83. /////////////////////////////////////////////////////////////////
  84. CWizard::~CWizard()
  85. {
  86.     delete m_pCTableCopy;
  87.     delete m_pCProgress;
  88.  
  89.     delete m_rgDialogSteps[WIZ_STEP1];
  90.     delete m_rgDialogSteps[WIZ_STEP2];
  91.     delete m_rgDialogSteps[WIZ_STEP3];
  92.     delete m_rgDialogSteps[WIZ_STEP4];
  93.     delete m_rgDialogSteps[WIZ_TYPES];
  94. }
  95.  
  96.  
  97. ////////////////////////////////////////////////////////////////
  98. // CWizard::Display
  99. //
  100. /////////////////////////////////////////////////////////////////
  101. ULONG CWizard::Display()
  102. {
  103.     return DisplayStep(WIZ_STEP1);
  104. }
  105.  
  106.  
  107. ////////////////////////////////////////////////////////////////
  108. // ULONG CWizard::DisplayStep
  109. //
  110. /////////////////////////////////////////////////////////////////
  111. ULONG CWizard::DisplayStep(ULONG iStep)
  112. {
  113.     ASSERT(iStep >= WIZ_STEP1 && iStep < END_WIZ);
  114.     return m_rgDialogSteps[iStep]->Display();
  115. }
  116.  
  117.  
  118. ////////////////////////////////////////////////////////////////
  119. // ULONG CWizard::DestroyPrevStep
  120. //
  121. /////////////////////////////////////////////////////////////////
  122. ULONG CWizard::DestroyPrevStep(ULONG iCurStep)
  123. {
  124.     if(iCurStep != m_iPrevStep)
  125.         m_rgDialogSteps[m_iPrevStep]->Destroy();
  126.     m_iPrevStep = iCurStep;
  127.     return 0;
  128. }
  129.