Microsoft KB Archive/275230

= How To Specify a URL When Starting Pocket Internet Explorer from eVB =

Article ID: 275230

Article Last Modified on 7/13/2004

-

APPLIES TO


 * Microsoft eMbedded Visual Basic 3.0

-



This article was previously published under Q275230



SUMMARY
This article demonstrates how to start Microsoft Pocket Internet Explorer on a Pocket PC with a specific URL from eMbedded Visual Basic (eVB) code.



MORE INFORMATION
To do this, you need to use the ShellExecuteInfoEx API function from a dynamic-link library (DLL) created in eMbedded Visual C++ (eVC) and pass in the URL to which you want to browse. Then, you need to write a Declare statement in eVB, and call the function from eVB code.

Create the eVC DLL
 Start eVC, and from the File menu, click New. From the Projects tab, select WCE Dynamic-Link Library. Name the project GetURLDll. In the next screen of the wizard, select A DLL that exports some symbols and click Finish.  Browse to the GetURLDll.cpp file, and add the following code: int WINAPI CallShell(LPCTSTR lpFilePath, LPCTSTR lpURL) {   SHELLEXECUTEINFO *lpSHInfo; BOOL RetVal; lpSHInfo = (SHELLEXECUTEINFO *) HeapAlloc(GetProcessHeap, HEAP_ZERO_MEMORY, sizeof(SHELLEXECUTEINFO)); lpSHInfo->cbSize = sizeof(SHELLEXECUTEINFO); lpSHInfo->fMask = SEE_MASK_NOCLOSEPROCESS; lpSHInfo->lpFile = lpFilePath; lpSHInfo->lpParameters = lpURL;

RetVal = ShellExecuteEx(lpSHInfo);

HeapFree(GetProcessHeap, 0, lpSHInfo); return RetVal; }                     From the File menu, click New, and then add a text file named GetURLDll.def to the project. Paste the following code: LIBRARY GetURLDll EXPORTS CallShell @1  Make sure that the device type is &quot;Pocket PC&quot; and the target is &quot;Win32 (WCE x86em) Release&quot;, and then press F7 to build the DLL.</li></ol>

Build the eVB Client
<ol> Start eVB and select Windows CE for the Pocket PC Project.</li>  Add a .bas module to the project, and paste the following code: Option Explicit

Public Declare Function CallShell Lib &quot;GetURLDll.dll&quot; _ (ByVal FilePath As String, ByVal DestURL As String) As Integer

Public Sub FindMe Dim RetVal As Integer Dim Path As String Dim URL As String Path = &quot;\windows\iexplore.exe&quot; URL = &quot;\windows\calc.htm&quot; RetVal = CallShell(Path, URL)

End Sub

</li> The compiled DLL needs to be in the \WinCETools\wce300\MS Pocket PC\emulation\palm300 folder, or you will need to use the relative path in the Lib clause of the Declare statement.</li>  Add a button to the form, and then paste the following code in the code window of the form: Option Explicit

Private Sub Command1_Click Call FindMe End Sub

Private Sub Form_OKClick App.End End Sub </li> Run the code, and then click the button. The Calculator Help screen appears.</li></ol>

Additional query words: wce evb

Keywords: kbhowto KB275230

-

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

© Microsoft Corporation. All rights reserved.