RAPI EDB Database Application
8/28/2008
This sample is called EdbRapi. It demonstrates how to use RAPI to access EDB databases. It also provides a reusable libary for accessing EDB databases remotely on the Windows Mobile powered device.
This application mounts an EDB database volume, creates an EDB database and populates it with the names, size and time of the files or directories in the root directory of the device.
The database is then closed and re-opened sorted by file or directory names. The content of the database in the created volume is printed. Finally, the database will be deleted and the volume will be unmounted.
Feature Area |
---|
Relevant APIs |
---|
CeOpenDatabaseInSession (EDB) function |
To run the code sample
Navigate to the solution file (*.sln), and double-click it. By default, the solution file is copied to the following folder:
C:\Program Files\Windows Mobile 6 SDK\Samples\Common\CPP\Win32\Rapi\edbrapi
Microsoft Visual Studio 2005 launches and loads the solution.
Navigate to Tools -> Options, and expand Projects and Solutions, and click VC++ Directories
In Show directories for: select Include files.
For Win32 and mobile device platform, add the path to the ActiveSync include directory. If you accepted the defaults when installing the SDK, then the new directory will be C:\Program Files\Windows Mobile 6 SDK\Activesync\inc.
In Show directories for: select Library files.
For Win32 and mobile device platform, add the path to the ActiveSync library directory. If you accepted the defaults when installing the SDK, then the new directory will be C:\Program Files\Windows Mobile 6 SDK\Activesync\Lib.
Right click properties for the "EDBRapi" Solution, and select Configuration Properties. Set the platform for Client and Clientlib as WIN32; the platform for EDBRapiServer and ServerSetup as the mobile platform you choose, either Windows Mobile 6 Professional or Windows Mobile 6 Standard
Navigate to "Build", and click "ReBuild Solution" to compile the executable file
Go to the main output directory of ServerSetup, and copy ServerSetup.CAB to the device, and run it. (You may use Remote File Viewer to copy the file to a location you can access on the device or emulator). Running the CAB will copy the signed version of EdbRapiServer.dll to the \windows folder on the device. The Setup DLL included in the ServerSetup CAB needs to run with privileged rights. If you will run this CAB on a Windows Mobile powered ered device, make sure to sign the CAB with a certificate on the privileged certificate store.
Make sure your device/emulator is connected to ActiveSync before running the application.
Development Environments
SDK: Windows Mobile 6 Professional SDK and Windows Mobile 6 Standard SDK
Development Environment: Visual Studio 2005.
ActiveSync: Version 4.5.
Remarks
If you have not installed the SamplePrivDeveloper certificate, you will need to do that so that your dll and cab projects are signed correctly.
To install the certificate from the windows desktop
Click Start.
Click Run
Type in the path to SamplePrivDeveloper.pfx. By default, this is installed in the followinf directory
C:\Program Files\Windows Mobile 6 SDK\Tools\Security\SDK Development Certificates.
Click OK. The Certificate Import Wizard should appear.
Click Next. The path to the certificate should be filled in for the File name.
Click Next.
Click Next. You do not need a password.
Click Next. This selects the default options: Automatically select the certificate store based on the type of certificate.
Click Finish.