get_SetIcon

Description

Retrieves a value that indicates whether the packed executable will use the custom icon defined via the put_IconPath method.
If this function returns VARIANT_TRUE, the resulting executable will be built with the specified icon instead of the original one from the input file.

This property allows confirming whether icon customization is currently enabled for the project.

Syntax

HRESULT get_SetIcon([out, retval] VARIANT_BOOL* pbValue);

Parameters

pbValue
Type: VARIANT_BOOL*
[out, retval] Receives VARIANT_TRUE if the packed executable will use the custom icon specified by put_IconPath, or VARIANT_FALSE otherwise.

Return Value

Returns an HRESULT.

  • S_OK if the value was successfully retrieved.
  • E_POINTER if pbValue is null.
  • Other standard COM error codes on failure.

Example

CComPtr<IBxProject> project;
if (SUCCEEDED(BxPackerApi_CreateProject(&project))) {
    VARIANT_BOOL bSetIcon = VARIANT_FALSE;
    if (SUCCEEDED(project->get_SetIcon(&bSetIcon))) {
        wprintf(L"Custom icon usage: %s\n", bSetIcon == VARIANT_TRUE ? L"Enabled" : L"Disabled");
    }
}

Remarks

  • If get_SetIcon returns VARIANT_TRUE, the packer replaces the original icon of the input file with the one defined via put_IconPath.
  • If VARIANT_FALSE, the packed executable keeps the original icon.
  • Icon customization can be toggled by calling put_SetIcon before building the project.
  • The icon file must be in standard .ico format to be applied correctly.

See Also