65.9K
CodeProject is changing. Read more.
Home

C++ wrapper for ADOCE filtering

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.67/5 (6 votes)

Sep 1, 2002

CPOL

1 min read

viewsIcon

104172

downloadIcon

208

A simple class to use the DesktopToDevice and DeviceToDesktop functions from a C++ project.

Overview

The DesktopToDevice and DeviceToDesktop functions allow you to transfer and/or synchronize MS Access databases (.mdb files) to a Windows CE device (.cdb files). These functions were designed to be used from Visual Basic, however it is still possible to call them from C++ projects by locating the function in the dll.

The original code was written by Nathan Lewis (nlewis@programmer.net, http://www.ticz.com/~nlewis) I simply reorganized the functions in a class to make it easy to use from MFC projects. I use the Singleton pattern to ensure that the class is only instanciated once and the dll gets loaded only one time.

Usage

To use the class in your project you simply need to include it in your project. To get an instance of the CAdoFiltr class you must use the getInstance() function, you can't use the constructor since it is protected. For more information on the parameters you can pass to DesktopToDevice and DeviceToDesktop see MSDN.

E.g.:

CAdoFiltr* pAdoFiltr = CAdoFiltr::getInstance();

HRESULT hr = pAdoFiltr->DesktopToDevice("c:\\database\\test.mdb",
		"tblTest..!tblTest2..", 
		false, true, "\\My Documents\\test.cdb");

if (hr != S_OK)
{
	//transfer has failed
}

I tested the code under Windows NT 4 Workstation with ActiveSync 3.5 and an iPAQ 3650 running PocketPC 2000

Documentation

The documentation files were generated by doxygen, it explains the strange tags in the comment blocks through the code.

  • For more information about ADOCE and the DesktopToDevice and DeviceToDesktop functions see MSDN.
  • For more information about using these functions from C/C++ see the original contribution from Nathan Lewis.
  • For more information about the Singleton pattern you can have a look to Pattern Digest.