1 out of 3 rated this helpful - Rate this topic

DestroyIcon function

Applies to: desktop apps only

Destroys an icon and frees any memory the icon occupied.

Syntax

BOOL WINAPI DestroyIcon(
  __in  HICON hIcon
);

Parameters

hIcon [in]

Type: HICON

A handle to the icon to be destroyed. The icon must not be in use.

Return value

Type: BOOL

If the function succeeds, the return value is nonzero.

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

Remarks

It is only necessary to call DestroyIcon for icons and cursors created with the following functions: CreateIconFromResourceEx (if called without the LR_SHARED flag), CreateIconIndirect, and CopyIcon. Do not use this function to destroy a shared icon. A shared icon is valid as long as the module from which it was loaded remains in memory. The following functions obtain a shared icon.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Reference
CopyIcon
CreateIconFromResource
CreateIconFromResourceEx
CreateIconIndirect
Conceptual
Icons

 

 

Send comments about this topic to Microsoft

Build date: 2/3/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
1
1
C#
[DllImport("user32.dll")]
public static extern bool DestroyIcon(IntPtr hIcon);