Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

C++ wrapper for ADOCE filtering

0.00/5 (No votes)
31 Aug 2002 1  
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.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here