CopyIcon function

Copies the specified icon from another module to the current module.

Syntax

HICON CopyIcon(
  HICON hIcon
);

Parameters

hIcon

Type: HICON

A handle to the icon to be copied.

Return value

Type: HICON

If the function succeeds, the return value is a handle to the duplicate icon.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

Remarks

The CopyIcon function enables an application or DLL to get its own handle to an icon owned by another module. If the other module is freed, the application icon will still be able to use the icon.

Before closing, an application must call the DestroyIcon function to free any system resources associated with the icon.

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See also

Conceptual

CopyCursor

DestroyIcon

DrawIcon

DrawIconEx

Icons

Reference