How To Specify a URL When Starting Pocket Internet Explorer from eVB (275230)



The information in this article 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

  1. Start eVC, and from the File menu, click New.
  2. From the Projects tab, select WCE Dynamic-Link Library.
  3. Name the project GetURLDll.
  4. In the next screen of the wizard, select A DLL that exports some symbols and click Finish.
  5. 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;
    }
    					
  6. 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 
    					
  7. Make sure that the device type is "Pocket PC" and the target is "Win32 (WCE x86em) Release", and then press F7 to build the DLL.

Build the eVB Client

  1. Start eVB and select Windows CE for the Pocket PC Project.
  2. Add a .bas module to the project, and paste the following code:
    Option Explicit
    
    Public Declare Function CallShell Lib "GetURLDll.dll" _
        (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 = "\windows\iexplore.exe"
        URL = "\windows\calc.htm"
        RetVal = CallShell(Path, URL)
    
    End Sub
    
    					
  3. 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.
  4. 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
    					
  5. Run the code, and then click the button. The Calculator Help screen appears.

Modification Type:MinorLast Reviewed:7/13/2004
Keywords:kbhowto KB275230