Click here to Skip to main content
15,390,470 members
Articles / Mobile Apps
Posted 31 Aug 2002


25 bookmarked

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
A simple class to use the DesktopToDevice and DeviceToDesktop functions from a C++ project.


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 (, 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.


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.


CAdoFiltr* pAdoFiltr = CAdoFiltr::getInstance();

HRESULT hr = pAdoFiltr->DesktopToDevice("c:\\database\\test.mdb",
		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


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.


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


About the Author

Olivier Gaumond
Web Developer
Canada Canada
No Biography provided

Comments and Discussions

QuestionDo it in VC++ Pin
Michelly040510-Sep-07 8:28
MemberMichelly040510-Sep-07 8:28 
Questioncan not overwrite .cdb file in my device [modified] Pin
saygogogo11-Oct-06 4:15
Membersaygogogo11-Oct-06 4:15 
GeneralDevicetodesktop - Desktoptodevice and WM5 Pin
jsoftmonopoli6-Jul-06 21:41
Memberjsoftmonopoli6-Jul-06 21:41 
GeneralThe doxygen link leads to a domain squatter Pin
Member 127836731-Aug-05 0:14
MemberMember 127836731-Aug-05 0:14 
GeneralProblem with Seek() method Pin
george ivanov9-Oct-03 1:01
Membergeorge ivanov9-Oct-03 1:01 
QuestionHow to get Device Desktop to Pc? Pin
Noohsamui23-Sep-03 21:32
MemberNoohsamui23-Sep-03 21:32 
QuestionWhen does the instance of CAdoFiltr get deleted ? Pin
Ray Kinsella12-Jun-03 23:40
MemberRay Kinsella12-Jun-03 23:40 
AnswerRe: When does the instance of CAdoFiltr get deleted ? Pin
Tanzim Husain30-Jun-03 0:36
MemberTanzim Husain30-Jun-03 0:36 
GeneralRe: When does the instance of CAdoFiltr get deleted ? Pin
deborabeatriz25-Aug-03 20:59
Memberdeborabeatriz25-Aug-03 20:59 
Generallittle promblem here Pin
cdextraze24-Apr-03 10:29
Membercdextraze24-Apr-03 10:29 
GeneralSyncronizing database between PC and Pocket PC 2002 Pin
Loron26-Mar-03 2:59
MemberLoron26-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
MemberLoron27-Mar-03 3:59 
QuestionCould you please provide some sample code about using ADOCE in PPC? Pin
Bui Huy Kien23-Feb-03 18:14
MemberBui 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
MemberNathan Lewis13-Mar-07 6:18 
GeneralWow - I'm flattered! Pin
Nathan Lewis10-Sep-02 6:17
MemberNathan 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.