Skip to main content

Past Blast

Featured Products

Windows Mobile Developer Controls
Windows Mobile Developer Controls
Stay in touch using the DEVBUSS RSS feeds.
 

News

Windows Mobile Developer Controls
Windows Mobile Developer Controls

Copy Access database files between the desktop and the Pocket PC.

Written by Richard Hands  [author's bio]  [read 66318 times]
Edited by Derek

Download the code

Page 1  Page 2 

Read Part Two

"How on earth do you write software that can copy files between the desktop and the Pocket PC?" This was the conundrum I set out to crack. There had to be a way, after all, the install programs manage it, as do various other C programs I have seen.

This meant I was going to have to delve deep into that black sticky mess that all non-C programmers fear, the API's.

First off, API calls aren't all that scary. As long as you are careful when using them, and save your code before every test, they are a boon and can help greatly with seemingly impossible tasks. For the task at hand, I knew that the solution lay not in calls made on the Pocket PC, but on the desktop machine itself.

The goals

I will attempt to explain within this article how to copy Access database files to the Pocket PC (Part I), and its follow up, how to copy both databaseas well as other files to the device (Part II).

My first port of call was the eVB Help file, which taught me about the DESKTOPTODEVICE and DEVICETODESKTOP calls. These calls allow easy transmission of access databases from the desktop pc to the pocket pc, and back again.

Creating the Visual Basic Project

Create a new Visual Basic 6 project on the desktop PC, giving it a form and a module. I always find it best practise to place function declarations off in a module called modGlobalDeclarations as you always know where to find them.

On the form, place two text fields called txtDesktopDB and txtPPCDB, with labels reading 'PC File' and 'Pocket File' respectively. You will also need two buttons labelled 'Download' and 'Upload'.

In your module place the following declarations:

'==================================================
' adofiltr library calls
'==================================================

Declare Function DEVICETODESKTOP Lib "adofiltr.dll" _
(ByVal desktoplocn As String, _
ByVal tablelist As String, _
ByVal sync As Boolean, _
ByVal overwrite As Integer, _
ByVal devicelocn As String) As Long

Declare Function DESKTOPTODEVICE Lib "adofiltr.dll" _
(ByVal desktoplocn As String, _
ByVal tablelist As String, _
ByVal sync As Boolean, _
ByVal overwrite As Integer, _
ByVal devicelocn As String) As Long
'==================================================

Next Page