DuplicateIcon function (shellapi.h)

Creates a duplicate of a specified icon.

Syntax

HICON DuplicateIcon(
  [in] HINSTANCE hInst,
  [in] HICON     hIcon
);

Parameters

[in] hInst

Type: HINSTANCE

[in] hIcon

Type: HICON

Handle to the icon to be duplicated.

Return value

Type: HICON

If successful, the function returns the handle to the new icon that was created; otherwise, NULL.

Remarks

When it is no longer needed, the caller is responsible for freeing the icon handle returned by DuplicateIcon by calling the DestroyIcon function.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shellapi.h
DLL Shell32.dll
API set ext-ms-win-shell-shell32-l1-2-1 (introduced in Windows 10, version 10.0.10240)