put_SetIcon

Description

Determines whether the packed executable should embed the icon specified by put_IconPath.

When this property is set to VARIANT_TRUE, the icon defined by put_IconPath is included in the resulting executable.
If disabled, the output EXE will use its default system icon instead.

Syntax

HRESULT put_SetIcon([in] VARIANT_BOOL bValue);

Parameters

bValue
Type: VARIANT_BOOL
[in] Pass VARIANT_TRUE to embed the icon specified via put_IconPath, or VARIANT_FALSE to disable custom icon embedding.

Return Value

Returns an HRESULT.

  • S_OK if the option was successfully applied.
  • E_FAIL or another COM error code if an error occurred.

Example

CComPtr<IBxProject> project;
if (SUCCEEDED(BxPackerApi_CreateProject(&project))) {
    // Specify a custom icon
    project->put_IconPath(CComBSTR(L"C:\\Images\\CustomIcon.ico"));
 
    // Enable embedding of the icon into the packed EXE
    project->put_SetIcon(VARIANT_TRUE);
 
    // Continue with other configuration and build
    // project->Build();
}

Remarks

  • This setting works in conjunction with put_IconPath.
    If no icon path is provided, enabling this option has no effect.
  • The icon file must be in .ico format and accessible at build time.
  • To disable icon embedding, call put_SetIcon(VARIANT_FALSE) before building.
  • The setting can be checked using get_SetIcon.

See Also