mobile databases, mobile forms, and mobile synchronization … where you need to work
Providing Pocket Access, Mobile Database, Windows CE Database, and Windows CE Development Solutions

Tip of the Month (March 2002)

Launching Report CE® from eMbedded Visual Basic

You can launch a Report CE report from an embedded Visual Basic application by calling CreateProcess, a Windows CE Operating System API function. It's easy to do this. Just declare the Sub procedure and then call it.

To declare the Sub procedure (although this declaration spans multiple lines in this topic, it should all be on one line in your Visual Basic application):

Declare Sub CreateProcessW Lib "coredll" (
ByVal ExeFile As String,
ByVal Args As String,
ByVal Unused1 As Long,
ByVal Unused2 As Long,
ByVal Unused3 As Long,
ByVal Unused4 As Long,
ByVal Unused5 As Long,
ByVal Unused6 As Long,
ByVal Unused7 As Long,
ByVal Unused8 As Long)

(note the W at the end of the CreateProcessW).

To launch your report, just call the Sub procedure. The first argument is the Report CE executable, the second is the file pathname of the template to use (a .RCE file). You have to put in eight zeros for those eight unused parameters (the operating system requires them). If you have any command line switches, put them in the second argument (before the file pathname of the template).

Example 1:
A Report CE Personal Edition launching a report with a template stored in \My Documents\ReportCE.rce

CreateProcessW "\Program Files\Report CE\ReportCE.exe",
"\My Documents\ReportCE.rce",
0, 0, 0, 0, 0, 0, 0, 0

Example 2:
A Report CE Pro or MobileSuite user launching the same report using the same report using the Report CE runtime:

CreateProcessW "\Windows\RCERT.exe",
"\My Documents\ReportCE.rce",
0, 0, 0, 0, 0, 0, 0, 0

Example 3:
Launching a report with command line switches:

CreateProcessW "\Program Files\Report CE\ReportCE.exe",
"/f""ABC Books"" \My Documents\ReportCE.rce",
0, 0, 0, 0, 0, 0, 0, 0

(note the use of two double quotes to enclose "ABC Books" in double quotes).