Click here to Skip to main content
15,867,141 members
Articles / Mobile Apps

C++ wrapper for ADOCE filtering

Rate me:
Please Sign up or sign in to vote.
4.67/5 (6 votes)
31 Aug 2002CPOL1 min read 102.7K   206   25   17
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


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

Comments and Discussions

 
QuestionDo it in VC++ Pin
Michelly040510-Sep-07 8:28
Michelly040510-Sep-07 8:28 
Questioncan not overwrite .cdb file in my device [modified] Pin
saygogogo11-Oct-06 4:15
saygogogo11-Oct-06 4:15 
GeneralDevicetodesktop - Desktoptodevice and WM5 Pin
jsoftmonopoli6-Jul-06 21:41
jsoftmonopoli6-Jul-06 21:41 
GeneralThe doxygen link leads to a domain squatter Pin
Member 127836731-Aug-05 0:14
Member 127836731-Aug-05 0:14 
GeneralProblem with Seek() method Pin
george ivanov9-Oct-03 1:01
george ivanov9-Oct-03 1:01 
QuestionHow to get Device Desktop to Pc? Pin
Noohsamui23-Sep-03 21:32
Noohsamui23-Sep-03 21:32 
QuestionWhen does the instance of CAdoFiltr get deleted ? Pin
Ray Kinsella12-Jun-03 23:40
Ray Kinsella12-Jun-03 23:40 
AnswerRe: When does the instance of CAdoFiltr get deleted ? Pin
Tanzim Husain30-Jun-03 0:36
Tanzim Husain30-Jun-03 0:36 
GeneralRe: When does the instance of CAdoFiltr get deleted ? Pin
deborabeatriz25-Aug-03 20:59
deborabeatriz25-Aug-03 20:59 
Generallittle promblem here Pin
cdextraze24-Apr-03 10:29
cdextraze24-Apr-03 10:29 
GeneralSyncronizing database between PC and Pocket PC 2002 Pin
Loron26-Mar-03 2:59
Loron26-Mar-03 2:59 
GeneralRe: Syncronizing database between PC and Pocket PC 2002 Pin
João Paulo Figueira26-Mar-03 23:00
professionalJoão Paulo Figueira26-Mar-03 23:00 
GeneralRe: Syncronizing database between PC and Pocket PC 2002 Pin
Loron27-Mar-03 3:59
Loron27-Mar-03 3:59 
QuestionCould you please provide some sample code about using ADOCE in PPC? Pin
Bui Huy Kien23-Feb-03 18:14
Bui Huy Kien23-Feb-03 18:14 
GeneralUnicode Pin
João Paulo Figueira29-Jan-03 4:51
professionalJoão Paulo Figueira29-Jan-03 4:51 
GeneralRe: Unicode Pin
Nathan Lewis13-Mar-07 6:18
Nathan Lewis13-Mar-07 6:18 
GeneralWow - I'm flattered! Pin
Nathan Lewis10-Sep-02 6:17
Nathan Lewis10-Sep-02 6:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.