0 out of 1 rated this helpful - Rate this topic

WM_GETICON message

Applies to: desktop apps only

Sent to a window to retrieve a handle to the large or small icon associated with a window. The system displays the large icon in the ALT+TAB dialog, and the small icon in the window caption.

A window receives this message through its WindowProc function.

#define WM_GETICON                      0x007F

Parameters

wParam

The type of icon being retrieved. This parameter can be one of the following values.

ValueMeaning
ICON_BIG
1

Retrieve the large icon for the window.

ICON_SMALL
0

Retrieve the small icon for the window.

ICON_SMALL2
2

Retrieves the small icon provided by the application. If the application does not provide one, the system uses the system-generated icon for that window.

 

lParam

This parameter is not used.

Return value

Type: HICON

The return value is a handle to the large or small icon, depending on the value of wParam. When an application receives this message, it can return a handle to a large or small icon, or pass the message to the DefWindowProc function.

Remarks

When an application receives this message, it can return a handle to a large or small icon, or pass the message to DefWindowProc.

DefWindowProc returns a handle to the large or small icon associated with the window, depending on the value of wParam.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winuser.h (include Windows.h)

See also

Reference
DefWindowProc
WM_SETICON
Conceptual
Windows

 

 

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
How big is big? How small is small?
How big is the big icon? How small is the small icon?

The system uses four icon sizes:
System small GetSystemMetrics(SM_CXSMICON)
System large GetSystemMetrics(SM_CXICON)
Shell small SHGetFileInfo(SHGFI_SHELLICONSIZE | SHGFI_SMALLICON)
Shell largeSHGetFileInfo(SHGFI_SHELLICONSIZE)
Work on win7?

I try this on Win7, but return NULL for some applications run at elevated premession.
If I run this code as administrator, it works and get the icon.
But the TaskManager could get this icon without run run as administrator, how should I deal with this?

Value
WM_GETICON = &H7F
Public Enum WM_GETICON As Integer
ICON_BIG = 1
ICON_SMALL = 0
ICON_SMALL2 = 2
End Enum