eVB applications are not compiled to executable files but to binary files that the Pvbload.exe executable interprets. Thus, eVB applications use the icon from Pvbload.exe in the same way that Microsoft Excel worksheets use the icon from Excel.exe. To allow for a customized application icon, you must create an eMbedded Visual C++ (eVC) application that only shells out to the operating system to run the application. The operating system recognizes that there is a file association with Pvbload.exe.
You must perform four main procedures to distribute an eMbedded Visual Basic application with a custom icon:
Associate the icon with the eVB application.Distribute the eVC application that is required for step 1 with the eVB distribution package.Place the eVC application that is required for step 1 in the Start menu.Distribute all files successfully to multiple CPUs.
Distribute the eVC application that is required for step 1 with the eVB distribution package.Place the eVC application that is required for step 1 in the Start menu.Distribute all files successfully to multiple CPUs.
Place the eVC application that is required for step 1 in the Start menu.Distribute all files successfully to multiple CPUs.
Distribute all files successfully to multiple CPUs.
Start a new Windows CE project in eMbedded Visual Basic for your preferred target platform.
From the File menu, click Make Project1.vb, and compile the project.
Save the project.
Close the project, and exit eVB.
Create eVC Application
Start eMbedded Visual C++.
From the File menu, click New.
On the Project tab, click WCE Application, and provide a project name. In this example, the project is named StubLauncher.
When prompted, select the option to create a simple Windows CE application.
Paste the following code over the existing WinMain function:
// StubLauncher.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "shellapi.h"
LPTSTR szAppName = _T("Project1.vb");
LPTSTR szStubName = _T("StubLauncher.exe");
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
long retVal;
TCHAR szPath[128];
LPTSTR Instr;
LPTSTR szVerb = _T("open");
//Start the Visual Basic application and exit.
SHELLEXECUTEINFO lpExecInfo;
memset(&lpExecInfo, 0, sizeof(SHELLEXECUTEINFO));
lpExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
// Get the path to the current directory.
retVal = GetModuleFileName(hInstance, szPath, 128);
if (retVal) {
// Remove the stubs file name to get just the path.
Instr = wcsstr(szPath, szStubName);
if (Instr != NULL)
// Add the target file to the resulting path.
wcscpy(Instr, szAppName);
//MessageBox(0, szPath, _T("This is the path I got"), 0);
// Now use this to start the application.
lpExecInfo.lpFile = szPath;
lpExecInfo.nShow = SW_SHOWNORMAL;
lpExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
lpExecInfo.lpVerb = szVerb ;
ShellExecuteEx(&lpExecInfo);
return(0);
}
return(-1);
}
Make sure that the necessary platform is selected in the WCE Configuration toolbar.
From the Insert menu, click Resource, and add or import an icon for your application.
Make sure that the resource window for your icon is open.
Save the resource as an .rc file.
From the Build menu, click Batch Build, and compile for the necessary platforms.
Save all files, and exit eVC.
Prepare and Configure eVB Distribution Package
Start the Application Install Wizard. Use the steps in the following Microsoft Knowledge Base article to complete steps 1 through 6 of the wizard:
194837
(http://support.microsoft.com/kb/194837/EN-US/
)
How To Distribute a Visual Basic Windows CE Application
In Step 7 of the Application Install Wizard, select the CPU-specific .exe file that you want to distribute with the eVB application.
Complete the Application Install Wizard.
Open the .inf file, and make the following changes:
In the [DefaultInstall] section, change the value for CEShortcuts from "Shortcuts" to "AddlShortcut" (or whatever name you choose) as follows:
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.