ID Number: Q69754
3.00
WINDOWS
docerr
Summary:
The information on the WM_GETTEXT and WM_SETTEXT messages in version
3.0 of the "Microsoft Windows Software Development Kit Reference
Volume 1" is incomplete.
The following information should be added to the documentation for
WM_SETTEXT on pages 6-100 and 6-101:
When the WM_SETTEXT message is sent to a static control with the
SS_ICON style, LOWORD(lParam) should contain a handle to an icon,
and HIWORD(lParam) should be 0 (zero). The static control will then
display the new icon.
The following information should be added to the documentation for
WM_GETTEXT on page 6-64:
When the WM_GETTEXT message is sent to a static control with the
SS_ICON style, the handle to the icon will be returned in the first
two bytes of the buffer pointed to by the lParam. This is true only
if the icon has been set using the WM_SETTEXT message.
Note: The technique described above does not work under Windows 3.1.
Windows 3.1 defines the STM_GETICON and STM_SETICON messages to allow
an application to change the icon associated with an icon resource.
More Information:
The following code demonstrates retrieving and changing the icon
associated with an icon resource under Windows versions 3.0 and 3.1.
HWND hWndStaticIcon; // A static control having the SS_ICON style.
HICON hIconOld; // The icon that is currently drawn in the
// static control.
HICON hIconNew; // The new icon for the static control.
WORD wVersionWindows;
...
wVersionWindows = LOWORD(GetVersion());
if (LOBYTE(wVersionWindows) >= 3 && HIBYTE(wVersionWindows) >= 10)
// Windows version 3.1 or later.
{
// Retrieve the HICON for the currently displayed icon.
hIconOld = (HICON) SendMessage(hWndStaticIcon, STM_GETICON, 0, 0L);
// Specify the new icon to be drawn.
SendMessage(hWndStaticIcon, STM_SETICON, hIconNew, 0L);
}
else
{ // Versions of Windows earlier than 3.1.
// Retrieve the HICON for the currently displayed icon. Note that
// this technique will work only if this icon was previously set by
// sending a WM_SETTEXT message to the static control.
SendMessage(hWndStaticIcon, WM_GETTEXT, 0,
(LONG)(HICON FAR *)&hIconOld);
// Specify the new icon to be drawn in the static control.
SendMessage(hWndStaticIcon, WM_SETTEXT, 0, MAKELONG(hIconNew, 0));
}
Additional reference words: 3.00 MICS3 R5.1 docerr