Modifying entry point & icon

Top  Previous  Next

In the following example, the auto-launch executable (entry-point executable) of a virtual package is defined as %Program Files%\\MyApp\\Run.exe.

Additionally, the virtual package's icon is copied from calc.exe.

Note that it is important to call PackageSave before closing the package, to save changes.

 

PACKAGE_HANDLE hPkg;

 

if (PackageOpen(L"C:\\MyPackage.exe", 0, &hPkg) == APIRET_SUCCESS)

{

   // Modify package property "AutoLaunch"

   PackageSetProperty(hPkg, L"AutoLaunch", L"%Program Files%\\MyApp\\Run.exe");

 

   // Set package's icon to be the same as Calc's

   PackageSetIconFile(hPkg, L"C:\\Windows\\System32\\calc.exe");

 

   // Save and close package

   PackageSave(hPkg, L"c:\\now\\output.exe");

   PackageClose(hPkg);

}