Click here to Skip to main content
15,891,976 members
Articles / Desktop Programming / Win32

Creation and memory mapping existing DBF files as alternative of data serialization during work with modified CListCtrl classes in virtual mode on dialogs of MDI application

Rate me:
Please Sign up or sign in to vote.
4.64/5 (6 votes)
22 Jul 2009CPOL11 min read 47.1K   1.5K   26  
The demonstration of reading, writing and creation of standard DBF files with random access in memory instead of serialization of typical MFC application for descendants of CListCtrl classes in Virtual Mode.
/////////////////////////////////////////////////////////////////////////////
// Main.h : main header file for the MAIN application
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_MAIN_H__EMERY_EMERALD__INCLUDED_)
	#define AFX_MAIN_H__EMERY_EMERALD__INCLUDED_

	#if _MSC_VER > 1000
		#pragma once
	#endif // _MSC_VER > 1000

	#ifndef __AFXWIN_H__
		#error include 'stdafx.h' before including this file for PCH
	#endif

	#include "ListCtrlEx\ListCtrlEx.h"
	#include "Dbf\Dbf.h"
	#include "Resource.h"  // Main symbols

	class CMainFrame;
	class CChildFrame;
	class CMainDoc;
	
	/////////////////////////////////////////////////////////////////////////////
	// CMainApp: See Main.cpp for the implementation of this class
	/////////////////////////////////////////////////////////////////////////////
	class CMainApp : public CWinApp {
		public:
			CMainApp();

			//*** Saves the CMultiDocTemplate class pointer
			CMultiDocTemplate *m_pDocTemplate;

			//*** Common height of main frame tollbar, tab and status line
			UINT m_nClientCtrlsHeight;

			//*** Common width of main frame for border
			UINT m_nMainFrmBorders;

			//*** Common offset for child frames
			int m_nChildFrmOffset;

			//*** Table Id
			ETABLE m_eTable;

			//*** Array of tables
			CListCtrlEx *m_apTable[e_MAX];

			//*** Main frames pointer
			CMainFrame *m_pMainFrame;

			//*** Array of child frames
			CChildFrame *m_apFrame[e_MAX];

			//*** Array of documents
			CMainDoc *m_apDoc[e_MAX];

			//*** For all tables ***

			//*** Table header font structure
			static LOGFONT m_LogHdrFont;
			//*** Table header font
			CFont m_HdrFont;
			//*** Table list font structure
			static LOGFONT m_LogListFont;
			//*** Table list font
			CFont m_ListFont;
			//*** The dbf-file data table structure
			//META_DATA m_aMetaData[e_MAX];
			//*** Meta table structures array
			META_TABLE m_aMetaTable[e_MAX];
	
			//*** For Table 1 ***

			//*** Dbf-file 1 name
			static TCHAR *m_szDbfName1;
			//*** Table 1 name
			static TCHAR *m_szTblName1;
			//*** Frame 1 rectangle coordinates
			static RECT m_FrmRect1;
			//*** View 1 rectangle coordinates
			static RECT m_ViewRect1;
			//*** Dbf-file 1 fields data structure
			static META_DATA m_aMetaData1[];
			//*** Meta table 1 header structure array
			static META_HEADER m_aMetaHeader1[];
			//*** Table 1 rows text array
			static TCHAR *m_apRowText1[];

			//*** For Table 2 ***

			//*** Dbf-file 2 name
			static TCHAR *m_szDbfName2;
			//*** Table 2 name
			static TCHAR *m_szTblName2;
			//*** Frame 2 rectangle coordinates
			static RECT m_FrmRect2;
			//*** View 2 rectangle coordinates
			static RECT m_ViewRect2;
			//*** Dbf-file 2 fields data structure
			static META_DATA m_aMetaData2[];
			//*** Meta table 2 header structure array
			static META_HEADER m_aMetaHeader2[];
			//*** Table 2 rows text array
			static TCHAR *m_apRowText2[];
			
			//*** For Table 3 ***

			//*** Dbf-file 3 name
			static TCHAR *m_szDbfName3;
			//*** Table 3 name
			static TCHAR *m_szTblName3;
			//*** Frame 3 rectangle coordinates
			static RECT m_FrmRect3;
			//*** View 3 rectangle coordinates
			static RECT m_ViewRect3;
			//*** Dbf-file 3 fields data structure
			static META_DATA m_aMetaData3[];
			//*** Meta table 3 header structure array
			static META_HEADER m_aMetaHeader3[];
			//*** Table 3 rows text array
			static TCHAR *m_apRowText3[];
			
		// Operations
		public:
			
		// Overrides
		// ClassWizard generated virtual function overrides
		//{{AFX_VIRTUAL(CMainApp)
		public:
			virtual BOOL InitInstance();
			//virtual int ExitInstance();
		//}}AFX_VIRTUAL

		// Implementation
		//{{AFX_MSG(CMainApp)
		//afx_msg void OnFileNew();
		afx_msg void OnTable(UINT eTable);
		afx_msg void OnAppAbout();
		//}}AFX_MSG

		DECLARE_MESSAGE_MAP()
	};
	//{{AFX_INSERT_LOCATION}}
	// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAIN_H__EMERY_EMERALD__INCLUDED_)

/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Ukraine Ukraine
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions