Microsoft KB Archive/241531

= How To Create a UI-Less eVC DLL for Use in an eVB Application =

Article ID: 241531

Article Last Modified on 8/19/2005

-

APPLIES TO


 * Microsoft eMbedded Visual Basic 3.0
 * Microsoft Office Keyboard

-



This article was previously published under Q241531



SUMMARY
This article demonstrates how to create a simple UI-less DLL with eMbedded Visual C++ (eVC) and call that DLL from an eMbedded Visual Basic (eVB) application.

For illustrative purposes, the CreateProcess API function is wrapped for use by a eVB application targeting a Pocket PC device. The same process can be used for other devices supported by both eVC and eVB, as well as with the previous versions of the Windows CE development tools (the Windows CE Toolkit for Visual Basic 6.0 and the Windows CE Toolkit for Visual C++ 6.0).



Step-by-Step Example
How to Build the UI-less EVC DLL  Launch Microsoft eMbedded Visual C++. From the File menu, select New. In the New dialog box, select the Projects tab and click on WCE Dynamic-Link Library. In the Project name text box, enter a project name, such as CProcess . Click OK to create the WCE DLL. In the WCE Dynamic-Link Library dialog box, select An empty Windows CE DLL project. Click Finish.</li> Click the OK button of the New Project Information dialog box to create the project.</li> From the File menu, choose New.</li> In the New dialog box, select the Files tab, and then click on C++ Source File.</li> In the File name text box, enter a file name, such as WinExecCE .</li> Click the OK button.</li> From the File menu, choose New.</li> In the New dialog box, select the Files tab, and then click on Text File.</li> In the File name text box, enter a file name, such as WinExecCE.def .</li> Click the OK button.</li>  Paste the following code into the WinExecCE.cpp file:
 * 1) include <windows.h>

DWORD WINAPI WinExecCE (LPWSTR lpApplicationName, LPWSTR lpCommandLine) { DWORD dwError = NOERROR; PROCESS_INFORMATION pi = {0};

if (!CreateProcess (lpApplicationName, lpCommandLine, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi)) {     dwError = GetLastError ; } else {     if (pi.hProcess) CloseHandle (pi.hProcess); if (pi.hThread) CloseHandle (pi.hThread); } return dwError; }                   </li>  Paste the following into the WinExecCE.def file: EXPORTS WinExecCE </li> From the WCE Configuration toolbar, select Pocket PC, Win32 (WCE ARM) Release, and Pocket PC (Default Device).

NOTE: If your Pocket PC device uses a different processor type, select that one instead.</li> Ensure that the Pocket PC device is connected to the desktop development computer.</li> From the Build menu, select Rebuild All. The DLL is compiled and downloaded to the device.</li> From the File menu, select Save Workspace, and then select Exit.</li></ol>

How to Build the eVB Application <ol> <li>Launch eMbedded Visual Basic.</li> <li>Create a new Windows CE Pocket PC Project.</li> <li>Add command button Command1 to Form1.</li> <li> Paste the following code into Form1: Option Explicit Public Declare Function WinExecCE Lib "CProcess.DLL" ( _  ByVal lpApplicationName As String, _   lpCommandLine As String) As Long

Private Sub Command1_Click WinExecCE "Calc.exe", "" End Sub </li> <li>Ensure that the Pocket PC device is connected to the desktop development computer.</li> <li>Run the project.</li> <li>On the device, click on the command button to launch Calc.Exe.</li></ol>

Additional query words: eVB eVB6 shell wce

Keywords: kbhowto kbtoolkit KB241531

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.