Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

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

, 22 Jul 2009 CPOL
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.
ModifiedListCtrl04.zip
ModifiedListCtrl04
Bin
Main.exe
Dbf
First.dbf
Second.dbf
Third.dbf
ListCtrlEx
Main.aps
Main.clw
Main.dsp
Main.dsw
Main.ncb
Main.opt
Main.plg
res
Main.ico
MainDoc.ico
Toolbar.bmp
Toolbar2.bmp
Toolbar2_.bmp
/////////////////////////////////////////////////////////////////////////////
// StdAfx.h : include file for standard system include files
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_STDAFX_H__EMERY_EMERALD__INCLUDED_)
	#define AFX_STDAFX_H__EMERY_EMERALD__INCLUDED_

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

	#define VC_EXTRALEAN		// Exclude rarely-used stuff from Windows headers

	#include <afxwin.h>         // MFC core and standard components
	#include <afxext.h>         // MFC extensions
	#include <afxdtctl.h>		// MFC support for Internet Explorer 4 Common Controls

	#ifndef _AFX_NO_AFXCMN_SUPPORT
		#include <afxcmn.h>			// MFC support for Windows Common Controls
	#endif  // _AFX_NO_AFXCMN_SUPPORT

	//*** For CMainTabs class
	#include <AFXPRIV.H>
	#include <vector>
	#include <algorithm>

	#include "Resource.h"  // Main symbols

	#define MAXITEMTEXT			2*256  // The maximum text length of message line

	//*** The table names - Insert new Ids between e_NULL and e_MAX
	enum ETABLE {
		e_NULL = E_NULL,  // Empty Form Index
		e_First = E_FIRST,
		e_Second = E_SECOND,
		e_Third = E_THIRD,
		e_MAX = E_MAX
	}; 
	
	//*** The dbf-file fields data structure
	typedef struct {
		TCHAR *szFldName;  // Field name
		TCHAR *szFldType;  // Field type
		UINT nFldLen;  // Field length (in bytes)
		UINT nDecLen;  // Number of decimal places (in bytes)
	} META_DATA;

	//*** The meta table header structure
	typedef struct {
		TCHAR *szHdrName;  // Column name
		DWORD nAdjust;  // Text formatting
		UINT nWidth;  // Column width
	} META_HEADER;

	//*** The meta table structure
	typedef struct {
		TCHAR *szDbfName;  // Dbf name
		META_DATA *aMetaData;  // Dbf-file fields data structure
		TCHAR *szTblName;  // Table name
		META_HEADER *apMetaHeader;  // Meta table header structure
		DWORD dwStyle;  // Table style
		DWORD dwExStyle;  // Extended table style
		RECT *pFrmRect;  // Frame rectangle pointer
		RECT *pViewRect;  // View rectangle pointer
		CFont *pHdrFont;  // Table header font pointer
		CFont *pListFont;  // Table list font pointer
		UINT nHdrHeight;  // Table header height
		UINT nListHeight;  // Table list height
		UINT nColCount;  // Table header columns count
		UINT nRowCount;  // Table list row count
		TCHAR **apRowText;  // Table rows text array
	} META_TABLE;

	//*** Our MessageBoxes
	void _M(int nVal);  // Shows a number
	void _M(CString sStr);  // Shows a CString
	void _M(TCHAR *szStr);  // Shows a Unicode line
	//void _M(wchar_t *szStr);  // Shows a Unicode line

	//{{AFX_INSERT_LOCATION}}
	// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_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)

Share

About the Author

Emery Emerald
Software Developer
Ukraine Ukraine
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150123.1 | Last Updated 22 Jul 2009
Article Copyright 2009 by Emery Emerald
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid