/***********************************************************************/ /* Copyright (C) 2002 Definitive Solutions, Inc. All Rights Reserved. */ /* THIS COMPUTER PROGRAM IS PROPRIETARY AND CONFIDENTIAL TO DEFINITIVE */ /* SOLUTIONS, INC. AND ITS LICENSORS AND CONTAINS TRADE SECRETS OF */ /* DEFINITIVE SOLUTIONS, INC. THAT ARE PROVIDED PURSUANT TO A WRITTEN */ /* AGREEMENT CONTAINING RESTRICTIONS ON USE AND DISCLOSURE. ANY USE, */ /* REPRODUCTION, OR TRANSFER EXCEPT AS PROVIDED IN SUCH AGREEMENT */ /* IS STRICTLY PROHIBITED. */ /***********************************************************************/ #if !defined(AFX_MYADOLISTCTRL_H__8D019721_BDA8_11D5_8A60_00B0D0529ED2__INCLUDED_) #define AFX_MYADOLISTCTRL_H__8D019721_BDA8_11D5_8A60_00B0D0529ED2__INCLUDED_ #pragma once #include "MyListCtrl.h" #include // CMap // Microsoft ADO. Look in "C:\Program Files\Common Files\system\ado". // "Unary minus operator applied to unsigned type, result still unsigned." #pragma warning (disable : 4146) #import "msado15.dll" rename("EOF", "adoEOF") using namespace ADODB; ///////////////////////////////////////////////////////////////////////////// // MyAdoListCtrlCache // Declare the class depending on this file is in an EXE project or a DLL one. class #ifdef _WINDLL AFX_EXT_CLASS #endif MyAdoListCtrlCache : public CObject { friend class MyAdoListCtrl; // Construction. public: MyAdoListCtrlCache(_RecordsetPtr& pRS); virtual ~MyAdoListCtrlCache(); // Declared but not defined. private: MyAdoListCtrlCache(const MyAdoListCtrlCache& rhs); MyAdoListCtrlCache& operator=(const MyAdoListCtrlCache& rhs); // Interface. public: void SetOwnerListCtrl(MyAdoListCtrl* pListCtrl); // Implementation. private: HRESULT AddRowsToCache(DWORD dwRowLower, DWORD dwRowUpper); HRESULT AddCurrentRowToCache(); HRESULT Prepare(int nLower, int nUpper); CString GetString(DWORD dwRow, DWORD dwCol); void Flush(); HRESULT StaleCache(int nLower, int nUpper); // Data. private: MyAdoListCtrl* m_pListCtrl; // Points back to the list control. _RecordsetPtr& m_pRS; // ADO recordset passed from // view or dialog - we are not // the owner of this object. CMap m_map; // An map of row numbers to // heap-based CStringArray objects. // Each item in the array // represents one database row; // each item its string list // represents one column in that // row. DWORD m_dwCurRec; // The current record in the // recordset (adOpenForwardOnly // does *not* support either // GetRecordCount() or // GetAbsolutePosition().) }; ///////////////////////////////////////////////////////////////////////////// // MyAdoListCtrl // Declare the class depending on this file is in an EXE project or a DLL one. class #ifdef _WINDLL AFX_EXT_CLASS #endif MyAdoListCtrl : public MyListCtrl { // Construction. public: MyAdoListCtrl(_RecordsetPtr& pRS); virtual ~MyAdoListCtrl(); // Operations. public: HRESULT PrepareForNewRecords(bool& bCancel, CWnd* pwndCount = NULL); //{{AFX_VIRTUAL(MyAdoListCtrl) //}}AFX_VIRTUAL // Generated message map functions protected: //{{AFX_MSG(MyAdoListCtrl) afx_msg void OnGetdispinfo(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnOdcachehint(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnOdfinditem(NMHDR* pNMHDR, LRESULT* pResult); //}}AFX_MSG DECLARE_MESSAGE_MAP() HRESULT AddItems(bool& bCancel, int nItems = -1, CWnd* pwndCount = NULL); // Data. private: _RecordsetPtr& m_pRS; // ADO recordset passed from // view or dialog - we are not // the owner of this object. MyAdoListCtrlCache m_cache; // Handles all the cache // management stuff for this // virtual list control. }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_MYADOLISTCTRL_H__8D019721_BDA8_11D5_8A60_00B0D0529ED2__INCLUDED_)