put_IconPath
Description
Defines the icon file to be embedded into the packed executable.
The specified icon replaces the default application icon, allowing customization of the resulting executable's appearance in Windows Explorer and taskbar.
This property is used together with put_SetIcon.
If put_SetIcon is set to VARIANT_TRUE, the icon specified here is embedded into the packed EXE file.
Syntax
HRESULT put_IconPath([in] BSTR Value);Parameters
Value
Type: BSTR
[in] Specifies the full path to the icon file (.ico) that will be used as the executable's icon.
Return Value
Returns an HRESULT.
S_OKif the path was successfully applied.E_FAILor another COM error code if an error occurred (for example, invalid path or missing file).
Example
CComPtr<IBxProject> project;
if (SUCCEEDED(BxPackerApi_CreateProject(&project))) {
// Specify a custom icon for the packed executable
project->put_IconPath(CComBSTR(L"C:\\Images\\AppIcon.ico"));
// Enable embedding of the specified icon
project->put_SetIcon(VARIANT_TRUE);
// Continue configuring and building the project
// project->Build();
}Remarks
- The icon file must be in .ico format. Other image types (e.g.,
.png,.jpg) are not supported. - The icon is embedded directly into the generated EXE file.
- To disable embedding, call put_SetIcon with
VARIANT_FALSE. - The embedded icon will be visible in File Explorer, taskbar, and Alt+Tab UI.
- Use get_IconPath to retrieve the currently set icon path.