home *** CD-ROM | disk | FTP | other *** search
- /////////////////////////////////////////////////////////////////////////////
- // %1
-
- IMPLEMENT_DYNCREATE(%1, CRecordView)
-
- %1::%1()
- : CRecordView(%1::IDD)
- {
- $$IF(OLEAUTO)
- EnableAutomation();
- $$ENDIF
- $$IF(OLECREATE)
-
- // To keep the application running as long as an OLE automation
- // object is active, the constructor calls AfxOleLockApp.
-
- AfxOleLockApp();
-
- $$ENDIF
- //{{AFX_DATA_INIT(%1)
- m_pSet = NULL;
- //}}AFX_DATA_INIT
- }
-
- %1::~%1()
- {
- $$IF(OLECREATE)
- // To terminate the application when all objects created with
- // with OLE automation, the destructor calls AfxOleUnlockApp.
-
- AfxOleUnlockApp();
- $$ENDIF
- }
- $$IF(OLEAUTO)
-
- void %1::OnFinalRelease()
- {
- // When the last reference for an automation object is released
- // OnFinalRelease is called. The base class will automatically
- // deletes the object. Add additional cleanup required for your
- // object before calling the base class.
-
- CRecordView::OnFinalRelease();
- }
- $$ENDIF
-
- void %1::DoDataExchange(CDataExchange* pDX)
- {
- CRecordView::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(%1)
- // NOTE: the ClassWizard will add DDX and DDV calls here
- //}}AFX_DATA_MAP
- }
-
-
- BEGIN_MESSAGE_MAP(%1, CRecordView)
- //{{AFX_MSG_MAP(%1)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- $$IF(OLEAUTO)
-
- BEGIN_DISPATCH_MAP(%1, CRecordView)
- //{{AFX_DISPATCH_MAP(%1)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- //}}AFX_DISPATCH_MAP
- END_DISPATCH_MAP()
-
- // Note: we add support for IID_I%c to support typesafe binding
- // from VBA. This IID must match the GUID that is attached to the
- // dispinterface in the .ODL file.
-
- // {%b}
- static const IID IID_I%c =
- %d;
-
- BEGIN_INTERFACE_MAP(%1, CRecordView)
- INTERFACE_PART(%1, IID_I%c, Dispatch)
- END_INTERFACE_MAP()
- $$ENDIF //OLEAUTO
- $$IF(OLECREATE)
-
- // {%e}
- IMPLEMENT_OLECREATE(%1, "%6", %7)
- $$ENDIF //OLECREATE
-
- /////////////////////////////////////////////////////////////////////////////
- // %1 diagnostics
-
- #ifdef _DEBUG
- void %1::AssertValid() const
- {
- CRecordView::AssertValid();
- }
-
- void %1::Dump(CDumpContext& dc) const
- {
- CRecordView::Dump(dc);
- }
- #endif //_DEBUG
-
- /////////////////////////////////////////////////////////////////////////////
- // %1 message handlers
-
- CRecordset* %1::OnGetRecordset()
- {
- if (m_pSet != NULL)
- return m_pSet;
-
- m_pSet = new %8(NULL);
- m_pSet->Open();
-
- return m_pSet;
- }
-
- %8* %1::GetRecordset()
- {
- %8* pData = (%8*) OnGetRecordset();
- ASSERT(pData == NULL || pData->IsKindOf(RUNTIME_CLASS(%8)));
- return pData;
- }
-
- void %1::OnInitialUpdate()
- {
- BeginWaitCursor();
- GetRecordset();
- CRecordView::OnInitialUpdate();
- if (m_pSet->IsOpen())
- {
- CString strTitle = m_pSet->m_pDatabase->GetDatabaseName();
- CString strTable = m_pSet->GetTableName();
- if (!strTable.IsEmpty())
- strTitle += _T(":") + strTable;
- GetDocument()->SetTitle(strTitle);
- }
- EndWaitCursor();
- }