Microsoft KB Archive/222527

= How To Launch ActiveSync from a Visual Basic CE 6.0 Application =

Article ID: 222527

Article Last Modified on 8/19/2005

-

APPLIES TO


 * Microsoft Windows CE 2.0 for the Handheld PC
 * Microsoft Windows CE Toolkit for Visual Basic 6.0

-



This article was previously published under Q222527



SUMMARY
Under the Windows CE Toolkit for Visual Basic 6.0, you can now call the CreateProcess API to launch a process on a Handheld PC device running Windows CE 2.0. This article demonstrates how to launch the ActiveSync program using the CreateProcess API.



Step-by-Step Procedure
NOTE: This code works for Windows CE 2.0 only.  Start a new Windows CE HPC Project in Visual Basic 6.0. Form1 is created by default. Place a command button and a label on Form1.  Paste the following code into the code module of Form1: Option Explicit

Public Declare Function CreateProcess Lib "coredll.DLL" _ Alias "CreateProcessW" _ (ByVal lpApplicationName As String, _    ByVal lpCommandLine As String, _     ByVal lpProcessAttributes As Long, _     ByVal lpThreadAttributes As Long, _     ByVal bInheritHandles As Long, _     ByVal dwCreationFlags As Long, _     ByVal lpEnvironment As Long, _     ByVal lpCurrentDirectory As String, _     ByVal lpStartupInfo As Long, _     ByVal lpProcessInformation As Long) As Long

Private Sub Command1_Click Dim ret ret = CreateProcess("windows\repllog.exe", "/remote", _                       0, 0, False, 0, 0, "", 0, 0) If ret = 1 Then Label1.Caption = "Success" Else Label1.Caption = "Failure" End If End Sub  Run the project on the H/PC device. Disconnect the device from the desktop. Click Command1 and notice that the ActiveSync program starts.</ol>

<div class="references_section">