windows系统message消息和wparam、lparam参数的含义

WM_ACTIVATE

The WM_ACTIVATE message is sent to both the window being activated and the window being deactivated. If the windows use the same input queue, the message is sent synchronously, first to the window procedure of the top-level window being deactivated, then to the window procedure of the top-level window being activated. If the windows use different input queues, the message is sent asynchronously, so the window is activated immediately.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_ACTIVATE

  WPARAM wParam,   // activation and minimization options

  LPARAM lParam    // handle to window (HWND)

);

Parameters

wParam

The low-order word specifies whether the window is being activated or deactivated. This parameter can be one of the following values.

Value

Meaning

WA_ACTIVE

Activated by some method other than a mouse click (for example, by a call to the SetActiveWindow function or by use of the keyboard interface to select the window).

WA_CLICKACTIVE

Activated by a mouse click.

WA_INACTIVE

Deactivated.

 

The high-order word specifies the minimized state of the window being activated or deactivated. A nonzero value indicates the window is minimized.

lParam

Handle to the window being activated or deactivated, depending on the value of the wParam parameter. If the low-order word of wParam is WA_INACTIVE, lParam is the handle to the window being activated. If the low-order word of wParam is WA_ACTIVE or WA_CLICKACTIVE, lParam is the handle to the window being deactivated. This handle can be NULL.

Return Values

If an application processes this message, it should return zero.

Remarks

If the window is being activated and is not minimized, the DefWindowProc function sets the keyboard focus to the window. If the window is activated by a mouse click, it also receives a WM_MOUSEACTIVATE message.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, DefWindowProc, SetActiveWindow, WM_MOUSEACTIVATE, WM_NCACTIVATE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, DefWindowProc, SetActiveWindow, WM_MOUSEACTIVATE, WM_NCACTIVATE

 

 

 

   

Platform SDK: Windows User Interface

WM_SETFOCUS

The WM_SETFOCUS message is sent to a window after it has gained the keyboard focus.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_SETFOCUS

  WPARAM wParam,   // handle to window (HWND)

  LPARAM lParam    // not used

);

Parameters

wParam

Handle to the window that has lost the keyboard focus. This parameter can be NULL.

lParam

This parameter is not used.

Return Values

An application should return zero if it processes this message.

Remarks

To display a caret, an application should call the appropriate caret functions when it receives the WM_SETFOCUS message.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, SetFocus, WM_KILLFOCUS

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, SetFocus, WM_KILLFOCUS

 

 

 

   

Platform SDK: Windows User Interface

WM_KILLFOCUS

The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_KILLFOCUS

  WPARAM wParam,   // handle to window (HWND)

  LPARAM lParam    // not used

);

Parameters

wParam

Handle to the window that receives the keyboard focus. This parameter can be NULL.

lParam

This parameter is not used.

Return Values

An application should return zero if it processes this message.

Remarks

If an application is displaying a caret, the caret should be destroyed at this point.

While processing this message, do not make any function calls that display or activate a window. This causes the thread to yield control and can cause the application to stop responding to messages. For more information, see Message Deadlocks.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, SetFocus, WM_SETFOCUS

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, SetFocus, WM_SETFOCUS

 

 

 

   

Platform SDK: Windows User Interface

WM_ENABLE

The WM_ENABLE message is sent when an application changes the enabled state of a window. It is sent to the window whose enabled state is changing. This message is sent before the EnableWindow function returns, but after the enabled state (WS_DISABLED style bit) of the window has changed.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_ENABLE

  WPARAM wParam,   // enabled state (BOOL)

  LPARAM lParam    // not used

);

Parameters

wParam

Specifies whether the window has been enabled or disabled. This parameter is TRUE if the window has been enabled or FALSE if the window has been disabled.

lParam

This parameter is not used.

Return Values

If an application processes this message, it should return zero.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, EnableWindow

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, EnableWindow

 

 

 

   

Platform SDK: Windows GDI

WM_SETREDRAW

An application sends the WM_SETREDRAW message to a window to allow changes in that window to be redrawn or to prevent changes in that window from being redrawn.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_SETREDRAW,             // message to send

  (WPARAM) wParam,          // redraw state

  (LPARAM) lParam          // not used; must be zero

);

Parameters

wParam

Specifies the redraw state. If this parameter is TRUE, the content can be redrawn after a change. If this parameter is FALSE, the content cannot be redrawn after a change.

lParam

This parameter is not used.

Return Values

An application returns zero if it processes this message.

Remarks

This message can be useful if an application must add several items to a list box. The application can call this message with wParam set to FALSE, add the items, and then call the message again with wParam set to TRUE. Finally, the application can call the InvalidateRect function to cause the list box to be repainted.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Painting and Drawing Overview, Painting and Drawing Messages, InvalidateRect

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Painting and Drawing Overview, Painting and Drawing Messages, InvalidateRect

 

 

 

   

Platform SDK: Windows User Interface

WM_SETTEXT

An application sends a WM_SETTEXT message to set the text of a window.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_SETTEXT,               // message to send

  (WPARAM) wParam,          // not used; must be zero

  (LPARAM) lParam           // window-text string (LPCTSTR)

);

Parameters

wParam

This parameter is not used.

lParam

Pointer to a null-terminated string that is the window text.

Return Values

The return value is TRUE if the text is set. It is FALSE (for an edit control), LB_ERRSPACE (for a list box), or CB_ERRSPACE (for a combo box) if insufficient space is available to set the text in the edit control. It is CB_ERR if this message is sent to a combo box without an edit control.

Remarks

The DefWindowProc function sets and displays the window text. For an edit control, the text is the contents of the edit control. For a combo box, the text is the contents of the edit-control portion of the combo box. For a button, the text is the button name. For other windows, the text is the window title.

This message does not change the current selection in the list box of a combo box. An application should use the CB_SELECTSTRING message to select the item in a list box that matches the text in the edit control.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, CB_SELECTSTRING, WM_GETTEXT

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, CB_SELECTSTRING, WM_GETTEXT

 

 

 

   

Platform SDK: Windows User Interface

WM_GETTEXT

An application sends a WM_GETTEXT message to copy the text that corresponds to a window into a buffer provided by the caller.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_GETTEXT,               // message to send

  (WPARAM) wParam,          // number of characters to copy

  (LPARAM) lParam           // text buffer

);

Parameters

wParam

Specifies the maximum number of TCHARs to be copied, including the terminating null character.

Windows NT/2000: ANSI applications may have the string in the buffer reduced in size (to a minimum of half that of the wParam value) due to conversion from ANSI to Unicode.

lParam

Pointer to the buffer that is to receive the text.

Return Values

The return value is the number of TCHARs copied, not including the terminating null character.

Remarks

The DefWindowProc function copies the text associated with the window into the specified buffer and returns the number of characters copied. Note, for non-text static controls this gives you the text with which the control was originally created, that is, the ID number. However, it gives you the ID of the non-text static control as originally created. That is, if you subsequently used a STM_SETIMAGE to change it the original ID would still be returned.

For an edit control, the text to be copied is the content of the edit control. For a combo box, the text is the content of the edit control (or static-text) portion of the combo box. For a button, the text is the button name. For other windows, the text is the window title. To copy the text of an item in a list box, an application can use the LB_GETTEXT message.

When the WM_GETTEXT message is sent to a static control with the SS_ICON style, a handle to the icon will be returned in the first four bytes of the buffer pointed to by lParam. This is true only if the WM_SETTEXT message has been used to set the icon.

Rich Edit: If the text to be copied exceeds 64K, use either the EM_STREAMOUT or EM_GETSELTEXT message.

Windows 2000: Sending a WM_GETTEXT message to a non-text static control, such as a static bitmap or static icon control, does not return a string value. Instead, it returns zero. In addition, in previous versions of Windows and Windows NT, applications could send a WM_GETTEXT message to a non-text static control to retrieve the control's ID. To retrieve a control's ID in Windows 2000, applications can use GetWindowLong passing GWL_ID as the index value or GetWindowLongPtr using GWLP_ID.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, EM_GETSELTEXT, EM_STREAMOUT, GetWindowLong, GetWindowLongPtr, GetWindowText, GetWindowTextLength, LB_GETTEXT, WM_GETTEXTLENGTH, WM_SETTEXT

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, EM_GETSELTEXT, EM_STREAMOUT, GetWindowLong, GetWindowLongPtr, GetWindowText, GetWindowTextLength, LB_GETTEXT, WM_GETTEXTLENGTH, WM_SETTEXT

 

 

 

   

Platform SDK: Windows User Interface

WM_GETTEXTLENGTH

An application sends a WM_GETTEXTLENGTH message to determine the length, in characters, of the text associated with a window.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_GETTEXTLENGTH,         // message to send

  (WPARAM) wParam,          // not used; must be zero

  (LPARAM) lParam           // not used; must be zero

);

Parameters

wParam

This parameter is not used and must be zero.

lParam

This parameter is not used and must be zero.

Return Values

The return value is the length of the text in TCHARs, not including the terminating null character.

Remarks

For an edit control, the text to be copied is the content of the edit control. For a combo box, the text is the content of the edit control (or static-text) portion of the combo box. For a button, the text is the button name. For other windows, the text is the window title. To determine the length of an item in a list box, an application can use the LB_GETTEXTLEN message.

When the WM_GETTEXTLENGTH message is sent, the DefWindowProc function returns the length, in characters, of the text. Under certain conditions, the DefWindowProc function returns a value that is larger than the actual length of the text. This occurs with certain mixtures of ANSI and Unicode, and is due to the system allowing for the possible existence of DBCS characters within the text. The return value, however, will always be at least as large as the actual length of the text; you can thus always use it to guide buffer allocation. This behavior can occur when an application uses both ANSI functions and common dialogs, which use Unicode.

To obtain the exact length of the text, use the WM_GETTEXT, LB_GETTEXT, or CB_GETLBTEXT messages, or the GetWindowText function.

Windows 2000: Sending a WM_GETTEXTLENGTH message to a non-text static control, such as a static bitmap or static icon controlc, does not return a string value. Instead, it returns zero.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, CB_GETLBTEXT, DefWindowProc, GetWindowText, GetWindowTextLength, LB_GETTEXT, LB_GETTEXTLEN, WM_GETTEXT

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, CB_GETLBTEXT, DefWindowProc, GetWindowText, GetWindowTextLength, LB_GETTEXT, LB_GETTEXTLEN, WM_GETTEXT

 

 

 

   

Platform SDK: Windows User Interface

WM_CLOSE

The WM_CLOSE message is sent as a signal that a window or an application should terminate.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_CLOSE

  WPARAM wParam,   // not used

  LPARAM lParam    // not used

);

Parameters

This message has no parameters.

Return Values

If an application processes this message, it should return zero.

Remarks

An application can prompt the user for confirmation, prior to destroying a window, by processing the WM_CLOSE message and calling the DestroyWindow function only if the user confirms the choice.

By default, the DefWindowProc function calls the DestroyWindow function to destroy the window.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, DestroyWindow

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, DestroyWindow

 

 

 

   

Platform SDK: Windows System Information

WM_QUERYENDSESSION

The WM_QUERYENDSESSION message is sent when the user chooses to end the session or when an application calls the ExitWindows function. If any application returns zero, the session is not ended. The system stops sending WM_QUERYENDSESSION messages as soon as one application returns zero.

After processing this message, the system sends the WM_ENDSESSION message with the wParam parameter set to the results of the WM_QUERYENDSESSION message.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_QUERYENDSESSION

  WPARAM wParam,   // not used

  LPARAM lParam    // logoff option

);

Parameters

wParam

This parameter is reserved for future use.

lParam

Specifies whether the user is logging off or shutting down the system. If this parameter includes the ENDSESSION_LOGOFF value, the user if logging off. (Note that this parameter is a bit mask. To test for this value, use a bitwise operation; do not test for equality.)

Windows 2000: If this parameter is zero, the system is shutting down.

Return Values

If an application can terminate conveniently, it should return TRUE; otherwise, it should return FALSE.

Remarks

By default, the DefWindowProc function returns TRUE for this message.

Windows NT/2000: When an application returns TRUE for this message, it receives the WM_ENDSESSION message and it is terminated, regardless of how the other applications respond to the WM_QUERYENDSESSION message.

Windows 95/98: After all applications return TRUE for this message, they receive the WM_ENDSESSION and they are terminated.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

System Shutdown Overview, System Shutdown Messages, DefWindowProc, ExitWindows, WM_ENDSESSION

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

System Shutdown Overview, System Shutdown Messages, DefWindowProc, ExitWindows, WM_ENDSESSION

 

 

 

   

Platform SDK: Windows User Interface

WM_QUIT

The WM_QUIT message indicates a request to terminate an application and is generated when the application calls the PostQuitMessage function. It causes the GetMessage function to return zero.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_QUIT

  WPARAM wParam,   // exit code

  LPARAM lParam    // not used

);

Parameters

wParam

Specifies the exit code given in the PostQuitMessage function.

lParam

This parameter is not used.

Return Values

This message does not have a return value, because it causes the message loop to terminate before the message is sent to the application's window procedure.

Remarks

The WM_QUIT message is not associated with a window and therefore will never be received through a window's window procedure. It is retrieved only by the GetMessage or PeekMessage functions.

Do not post the WM_QUIT message using the PostMessage function; use PostQuitMessage.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, GetMessage, PeekMessage, PostQuitMessage

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, GetMessage, PeekMessage, PostQuitMessage

 

 

 

   

Platform SDK: Windows User Interface

WM_QUERYOPEN

The WM_QUERYOPEN message is sent to an icon when the user requests that the window be restored to its previous size and position.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_QUERYOPEN

  WPARAM wParam,   // not used

  LPARAM lParam    // not used

);

Parameters

This message has no parameters.

Return Values

If the icon can be opened, an application that processes this message should return TRUE; otherwise, it should return FALSE to prevent the icon from being opened.

Remarks

By default, the DefWindowProc function returns TRUE.

While processing this message, the application should not perform any action that would cause an activation or focus change (for example, creating a dialog box).

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc

 

 

 

   

Platform SDK: Windows User Interface

WM_ERASEBKGND

The WM_ERASEBKGND message is sent when the window background must be erased (for example, when a window is resized). The message is sent to prepare an invalidated portion of a window for painting.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_ERASEBKGND

  WPARAM wParam,   // handle to device context (HDC)

  LPARAM lParam    // not used

);

Parameters

wParam

Handle to the device context.

lParam

This parameter is not used.

Return Values

An application should return nonzero if it erases the background; otherwise, it should return zero.

Remarks

The DefWindowProc function erases the background by using the class background brush specified by the hbrBackground member of the WNDCLASS structure. If hbrBackground is NULL, the application should process the WM_ERASEBKGND message and erase the background.

An application should return nonzero in response to WM_ERASEBKGND if it processes the message and erases the background; this indicates that no further erasing is required. If the application returns zero, the window will remain marked for erasing. (Typically, this indicates that the fErase member of the PAINTSTRUCT structure will be TRUE.)

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Icons Overview, Icon Messages, BeginPaint, DefWindowProc, PAINTSTRUCT, WM_ICONERASEBKGND, WNDCLASS

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Icons Overview, Icon Messages, BeginPaint, DefWindowProc, PAINTSTRUCT, WM_ICONERASEBKGND, WNDCLASS

 

 

 

   

Platform SDK: Windows GDI

WM_SYSCOLORCHANGE

The WM_SYSCOLORCHANGE message is sent to all top-level windows when a change is made to a system color setting.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_SYSCOLORCHANGE

  WPARAM wParam,   // not used

  LPARAM lParam    // not used

);

Parameters

This message has no parameters.

Remarks

The system sends a WM_PAINT message to any window that is affected by a system color change.

Applications that have brushes using the existing system colors should delete those brushes and recreate them using the new system colors.

Top level windows that use common controls must forward the WM_SYSCOLORCHANGE message to the controls; otherwise, the controls will not be notified of the color change. This ensures that the colors used by your common controls are consistent with those used by other user interface objects. For example, a toolbar control uses the "3D Objects" color to draw its buttons. If the user changes the 3D Objects color but the WM_SYSCOLORCHANGE message is not forwarded to the toolbar, the toolbar buttons will remain in their original color while the color of other buttons in the system changes.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Colors Overview, Color Messages, WM_PAINT

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Colors Overview, Color Messages, WM_PAINT

 

 

 

   

Platform SDK: Windows System Information

WM_ENDSESSION

The WM_ENDSESSION message is sent to an application after the system processes the results of the WM_QUERYENDSESSION message. The WM_ENDSESSION message informs the application whether the session is ending.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_ENDSESSION

  WPARAM wParam,   // end-session option

  LPARAM lParam    // logoff option

);

Parameters

wParam

Specifies whether the session is being ended. If the session is being ended, this parameter is TRUE; otherwise, it is FALSE.

lParam

Specifies whether the user is logging off or shutting down the system. If this parameter includes the ENDSESSION_LOGOFF value, the user if logging off. (Note that this parameter is a bit mask. To test for this value, use a bitwise operation; do not test for equality.)

Windows 2000: If this parameter is zero, the system is shutting down.

Return Values

If an application processes this message, it should return zero.

Remarks

If the wParam parameter is TRUE, the session can end any time after all applications have returned from processing this message. Therefore, an application should perform all tasks required for termination before returning from this message.

The application need not call the DestroyWindow or PostQuitMessage function when the session is ending.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

System Shutdown Overview, System Shutdown Messages, DestroyWindow, PostQuitMessage, WM_QUERYENDSESSION

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

System Shutdown Overview, System Shutdown Messages, DestroyWindow, PostQuitMessage, WM_QUERYENDSESSION

 

 

 

   

Platform SDK: Windows User Interface

WM_SHOWWINDOW

The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_SHOWWINDOW

  WPARAM wParam,   // show flag (BOOL)

  LPARAM lParam    // status flag

);

Parameters

wParam

Specifies whether a window is being shown. If wParam is TRUE, the window is being shown. If wParam is FALSE, the window is being hidden.

lParam

Specifies the status of the window being shown. If lParam is zero, the message was sent because of a call to the ShowWindow function; otherwise, lParam is one of the following values.

Value

Meaning

SW_OTHERUNZOOM

The window is being uncovered because a maximize window was restored or minimized.

SW_OTHERZOOM

The window is being covered by another window that has been maximized.

SW_PARENTCLOSING

The window's owner window is being minimized.

SW_PARENTOPENING

The window's owner window is being restored.

 

Return Values

If an application processes this message, it should return zero.

Remarks

The DefWindowProc function hides or shows the window, as specified by the message. If a window has the WS_VISIBLE style when it is created, the window receives this message after it is created, but before it is displayed. A window also receives this message when its visibility state is changed by the ShowWindow or ShowOwnedPopups function.

The WM_SHOWWINDOW message is not sent under the following circumstances:

  • When a top-level, overlapped window is created with the WS_MAXIMIZE or WS_MINIMIZE style.
  • When the SW_SHOWNORMAL flag is specified in the call to the ShowWindow function.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, ShowOwnedPopups, ShowWindow

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, ShowOwnedPopups, ShowWindow

 

 

 

   

Platform SDK: Windows System Information

WM_WININICHANGE

An application sends the WM_WININICHANGE message to all top-level windows after making a change to the WIN.INI file. The SystemParametersInfo function sends this message after an application uses the function to change a setting in WIN.INI.

Note  The WM_WININICHANGE message is provided only for compatibility with earlier versions of the system. Applications should use the WM_SETTINGCHANGE message.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_WININICHANGE

  WPARAM wParam,   // not used; must be zero

  LPARAM lParam    // system parameter area (LPCTSTR)

);

Parameters

wParam

This parameter is not used.

lParam

Pointer to a string containing the name of the system parameter that was changed. For example, this string can be the name of a registry key or the name of a section in the Win.ini file. This parameter is not particularly useful in determining which system parameter changed. For example, when the string is a registry name, it typically indicates only the leaf node in the registry, not the whole path. In addition, some applications send this message with lParam set to NULL. In general, when you receive this message, you should check and reload any system parameter settings that are used by your application.

Return Values

If you process this message, return zero.

Remarks

To send the WM_WININICHANGE message to all top-level windows, use the SendMessage function with the hWnd parameter set to HWND_BROADCAST.

Calls to functions that change WIN.INI may be mapped to the registry instead. This mapping occurs when WIN.INI and the section being changed are specified in the registry under the following keys:

HKEY_LOCAL_MACHINE\Software\Microsoft\
        Windows NT\CurrentVersion\IniFileMapping

The change in the storage location has no effect on the behavior of this message.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

System Information Overview, System Information Messages, SystemParametersInfo

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

System Information Overview, System Information Messages, SystemParametersInfo

 

 

 

   

Platform SDK: Windows System Information

WM_SETTINGCHANGE

The system sends the WM_SETTINGCHANGE message to all top-level windows when the SystemParametersInfo function changes a system-wide setting or when policy settings have changed.

Applications should send WM_SETTINGCHANGE to all top-level windows when they make changes to system parameters. (This message cannot be sent directly to a window.) To send the WM_SETTINGCHANGE message to all top-level windows, use the SendMessageTimeout function with the hwnd parameter set to HWND_BROADCAST.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_SETTINGCHANGE

  WPARAM wParam,   // system parameter indicator

  LPARAM lParam    // system parameter area (LPCTSTR)

);

Parameters

wParam

When the system sends this message as a result of a SystemParametersInfo call, wParam is a flag that indicates the system parameter that was changed. For a list of values, see SystemParametersInfo.

When the system sends this message as a result of a change in policy settings, this parameter indicates the type of policy that was applied. If this value is 1 if computer policy was applied or zero if user policy was applied.

When the system sends this message as a result of a change in locale settings, this parameter is zero.

When an application sends this message, this parameter must be NULL.

lParam

When the system sends this message as a result of a SystemParametersInfo call, lParam is a pointer to a string that indicates the area containing the system parameter that was changed. For example, this string can be the name of a registry key or the name of a section in the Win.ini file. This parameter is not particularly useful in determining which system parameter changed. For example, when the string is a registry name, it typically indicates only the leaf node in the registry, not the whole path. In addition, some applications send this message with lParam set to NULL. In general, when you receive this message, you should check and reload any system parameter settings that are used by your application.

When the system sends this message as a result of a change in policy settings, this parameter points to the string "Policy".

When the system sends this message as a result of a change in locale settings, this parameter points to the string "intl".

Return Values

If you process this message, return zero.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

System Information Overview, System Information Messages, Policy Events, SendMessageTimeout, SystemParametersInfo

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

System Information Overview, System Information Messages, Policy Events, SendMessageTimeout, SystemParametersInfo

 

 

 

   

Platform SDK: Windows GDI

WM_DEVMODECHANGE

The WM_DEVMODECHANGE message is sent to all top-level windows whenever the user changes device-mode settings.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_DEVMODECHANGE

  WPARAM wParam,   // not used

  LPARAM lParam    // device name (LPCTSTR)

);

Parameters

wParam

This parameter is not used.

lParam

Pointer to a string that specifies the device name.

Return Values

An application should return zero if it processes this message.

Remarks

This message cannot be sent directly to a window. To send the WM_DEVMODECHANGE message to all top-level windows, use the SendMessageTimeout function with the hWnd parameter set to HWND_BROADCAST.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Device Contexts Overview, Device Context Messages

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Device Contexts Overview, Device Context Messages

 

 

 

   

Platform SDK: Windows User Interface

WM_ACTIVATEAPP

The WM_ACTIVATEAPP message is sent when a window belonging to a different application than the active window is about to be activated. The message is sent to the application whose window is being activated and to the application whose window is being deactivated.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_ACTIVATEAPP

  WPARAM wParam,   // activation flag (BOOL)

  LPARAM lParam    // thread identifier (DWORD)

);

Parameters

wParam

Specifies whether the window is being activated or deactivated. This parameter is TRUE if the window is being activated; it is FALSE if the window is being deactivated.

lParam

Specifies a thread identifier. If the wParam parameter is TRUE, lParam is the identifier of the thread that owns the window being deactivated. If wParam is FALSE, lParam is the identifier of the thread that owns the window being activated.

Return Values

If an application processes this message, it should return zero.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, WM_ACTIVATE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, WM_ACTIVATE

 

 

 

   

Platform SDK: Windows GDI

WM_FONTCHANGE

An application sends the WM_FONTCHANGE message to all top-level windows in the system after changing the pool of font resources.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_FONTCHANGE,            // message to send

  (WPARAM) wParam,          // not used; must be zero

  (LPARAM) lParam          // not used; must be zero

);

Parameters

This message has no parameters.

Remarks

An application that adds or removes fonts from the system (for example, by using the AddFontResource or RemoveFontResource function) should send this message to all top-level windows.

To send the WM_FONTCHANGE message to all top-level windows, an application can call the SendMessage function with the hwnd parameter set to HWND_BROADCAST.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Fonts and Text Overview, Font and Text Messages, AddFontResource, RemoveFontResource

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Fonts and Text Overview, Font and Text Messages, AddFontResource, RemoveFontResource

 

 

 

   

Platform SDK: Windows System Information

WM_TIMECHANGE

An application sends the WM_TIMECHANGE message whenever it updates the system time.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_TIMECHANGE,            // message to send

  (WPARAM) wParam,          // not used; must be zero

  (LPARAM) lParam          // not used; must be zero

);

Parameters

This message has no parameters.

Return Values

An application should return zero if it processes this message.

Remarks

To send the message to all top-level windows, an application can use the SendMessage function with the hWnd parameter set to HWND_TOPMOST.

Windows 2000: An application should not broadcast this message, because the system will broadcast this message when the application changes the system time.

Windows NT 4.0 and earlier: An application should send the message to all top-level windows after changing the system time.

Windows 95: An application should send the message to all top-level windows after changing the system time.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Time Overview, Time Messages, SendMessage

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Time Overview, Time Messages, SendMessage

 

 

 

   

Platform SDK: Windows User Interface

WM_CANCELMODE

The WM_CANCELMODE message is sent to cancel certain modes, such as mouse capture. For example, the system sends this message to the active window when a dialog box or message box is displayed. Certain functions also send this message explicitly to the specified window regardless of whether it is the active window. For example, the EnableWindow function sends this message when disabling the specified window.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_CANCELMODE

  WPARAM wParam,   // not used

  LPARAM lParam    // not used

);

Parameters

This message has no parameters.

Return Values

If an application processes this message, it should return zero.

Remarks

When the WM_CANCELMODE message is sent, the DefWindowProc function cancels internal processing of standard scroll bar input, cancels internal menu processing, and releases the mouse capture.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, EnableWindow, ReleaseCapture

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, EnableWindow, ReleaseCapture

 

 

 

   

Platform SDK: Windows User Interface

WM_SETCURSOR

The WM_SETCURSOR message is sent to a window if the mouse causes the cursor to move within a window and mouse input is not captured.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_SETCURSOR

  WPARAM wParam,   // handle to window (HWND)

  LPARAM lParam    // hit-test code and mouse message

);

Parameters

wParam

Handle to the window that contains the cursor.

lParam

The low-order word of lParam specifies the hit-test code.

The high-order word of lParam specifies the identifier of the mouse message.

Return Values

If an application processes this message, it should return TRUE to halt further processing or FALSE to continue.

Remarks

The high-order word of lParam is zero when the window enters menu mode.

The DefWindowProc function passes the WM_SETCURSOR message to a parent window before processing. If the parent window returns TRUE, further processing is halted. Passing the message to a window's parent window gives the parent window control over the cursor's setting in a child window. The DefWindowProc function also uses this message to set the cursor to an arrow if it is not in the client area, or to the registered class cursor if it is in the client area. If the low-order word of the lParam parameter is HTERROR and the high-order word of lParam specifies that one of the mouse buttons is pressed, DefWindowProc calls the MessageBeep function.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Cursors Overview, Cursor Messages, DefWindowProc, HIWORD, LOWORD, MessageBeep

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Cursors Overview, Cursor Messages, DefWindowProc, HIWORD, LOWORD, MessageBeep

 

 

 

   

Platform SDK: Windows User Interface

WM_MOUSEACTIVATE

The WM_MOUSEACTIVATE message is sent when the cursor is in an inactive window and the user presses a mouse button. The parent window receives this message only if the child window passes it to the DefWindowProc function.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_MOUSEACTIVATE

  WPARAM wParam,   // handle to parent (HWND)

  LPARAM lParam    // hit-test value and message

);

Parameters

wParam

Handle to the top-level parent window of the window being activated.

lParam

The low-order word specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

The high-order word specifies the identifier of the mouse message generated when the user pressed a mouse button. The mouse message is either discarded or posted to the window, depending on the return value.

Return Values

The return value specifies whether the window should be activated and whether the identifier of the mouse message should be discarded. It must be one of the following values.

Value

Meaning

MA_ACTIVATE

Activates the window, and does not discard the mouse message.

MA_ACTIVATEANDEAT

Activates the window, and discards the mouse message.

MA_NOACTIVATE

Does not activate the window, and does not discard the mouse message.

MA_NOACTIVATEANDEAT

Does not activate the window, but discards the mouse message.

 

Remarks

The DefWindowProc function passes the message to a child window's parent window before any processing occurs. The parent window determines whether to activate the child window. If it activates the child window, the parent window should return MA_NOACTIVATE or MA_NOACTIVATEANDEAT to prevent the system from processing the message further.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, HIWORD, LOWORD, WM_NCHITTEST

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, HIWORD, LOWORD, WM_NCHITTEST

 

 

 

   

Platform SDK: Windows User Interface

WM_CHILDACTIVATE

The WM_CHILDACTIVATE message is sent to a child window when the user clicks the window's title bar or when the window is activated, moved, or sized.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_CHILDACTIVATE

  WPARAM wParam,   // not used

  LPARAM lParam    // not used

);

Parameters

This message has no parameters.

Return Values

If an application processes this message, it should return zero.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, MoveWindow, SetWindowPos

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, MoveWindow, SetWindowPos

 

 

 

   

Platform SDK: Interprocess Communications

WM_QUEUESYNC

The WM_QUEUESYNC message is sent by a computer-based training (CBT) application to separate user-input messages from other messages sent through the WH_JOURNALPLAYBACK hook procedure.

Parameters

This message has no parameters.

Return Values

A CBT application should return zero if it processes this message.

Remarks

Whenever a CBT application uses the WH_JOURNALPLAYBACK hook procedure, the first and last messages are WM_QUEUESYNC. This allows the CBT application to intercept and examine user-initiated messages without doing so for events that it sends.

If an application specifies a NULL window handle, the message is posted to the message queue of the active window.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Hooks Overview, Hook Messages, SetWindowsHookEx

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Hooks Overview, Hook Messages, SetWindowsHookEx

 

 

 

   

Platform SDK: Windows User Interface

WM_GETMINMAXINFO

The WM_GETMINMAXINFO message is sent to a window when the size or position of the window is about to change. An application can use this message to override the window's default maximized size and position, or its default minimum or maximum tracking size.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_GETMINMAXINFO

  WPARAM wParam,   // not used

  LPARAM lParam    // window information (LPMINMAXINFO)

);

Parameters

wParam

This parameter is not used.

lParam

Pointer to a MINMAXINFO structure that contains the default maximized position and dimensions, and the default minimum and maximum tracking sizes. An application can override the defaults by setting the members of this structure.

Return Values

If an application processes this message, it should return zero.

Remarks

The maximum tracking size is the largest window size that can be produced by using the borders to size the window. The minimum tracking size is the smallest window size that can be produced by using the borders to size the window.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, MoveWindow, SetWindowPos, MINMAXINFO

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, MoveWindow, SetWindowPos, MINMAXINFO

 

 

 

   

Platform SDK: Windows User Interface

WM_PAINTICON

On Windows versions prior to Windows 95 and Windows NT 4.0, the WM_PAINTICON message is sent to a minimized window when the icon is to be painted. This message is not sent by newer versions of Windows, except in unusual circumstances explained in the Remarks.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_PAINTICON

  WPARAM wParam,   // not used

  LPARAM lParam    // not used

);

Parameters

This message has no parameters.

Return Values

An application should return zero if it processes this message.

Remarks

On Windows 95 and higher and Windows NT 4.0 and higher, this message is sent only to 16-bit windows (note that this is with a lowercase "W"), and only for compatibility reasons. Under such conditions, the value of wParam is TRUE (the value carries no significance).

On Windows versions prior to Windows 95 and Windows NT 4.0, or on newer versions of Windows when the unusual circumstances above are met, the window receives this message only if a class icon is defined for the window; otherwise, WM_PAINT is sent instead.

On Windows versions prior to Windows 95 and Windows NT 4.0, the DefWindowProc function draws the class icon. On newer versions of Windows, the DefWindowProc function ignores the message.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Icons Overview, Icon Messages, DefWindowProc, WM_ICONERASEBKGND, WM_PAINT

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Icons Overview, Icon Messages, DefWindowProc, WM_ICONERASEBKGND, WM_PAINT

 

 

 

   

Platform SDK: Windows User Interface

WM_ICONERASEBKGND

On Windows versions prior to Windows 95 and Windows NT 4.0, the WM_ICONERASEBKGND message is sent to a minimized window when the background of the icon must be filled before painting the icon. A window receives this message only if a class icon is defined for the window; otherwise, WM_ERASEBKGND is sent. This message is not sent by newer versions of Windows.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_ICONERASEBKGND

  WPARAM wParam,   // handle to device context (HDC)

  LPARAM lParam    // not used

);

Parameters

wParam

Handle to the device context of the icon.

lParam

This parameter is not used.

Return Values

An application should return nonzero if it processes this message.

Remarks

On Windows versions prior to Windows 95 and Windows NT 4.0, the DefWindowProc function fills the icon background with the class background brush of the parent window. On newer versions of Windows, the DefWindowProc function ignores the message.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Icons Overview, Icon Messages, DefWindowProc, WM_ERASEBKGND

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Icons Overview, Icon Messages, DefWindowProc, WM_ERASEBKGND

 

 

 

   

Platform SDK: Windows User Interface

WM_NEXTDLGCTL

The WM_NEXTDLGCTL message is sent to a dialog box procedure to set the keyboard focus to a different control in the dialog box.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_NEXTDLGCTL

  WPARAM wParam,   // control identifier

  LPARAM lParam    // wParam usage

);

Parameters

wParam

If lParam is TRUE, this parameter identifies the control that receives the focus. If lParam is FALSE, this parameter indicates whether the next or previous control with the WS_TABSTOP style receives the focus. If wParam is zero, the next control receives the focus; otherwise, the previous control with the WS_TABSTOP style receives the focus.

lParam

The low-order word indicates how the system uses wParam. If the low-order word is TRUE, wParam is a handle associated with the control that receives the focus; otherwise, wParam is a flag that indicates whether the next or previous control with the WS_TABSTOP style receives the focus.

Return Values

An application should return zero if it processes this message.

Remarks

This message performs additional dialog box management operations beyond those performed by the SetFocus function WM_NEXTDLGCTL updates the default pushbutton border, sets the default control identifier, and automatically selects the text of an edit control (if the target window is an edit control).

Do not use the SendMessage function to send a WM_NEXTDLGCTL message if your application will concurrently process other messages that set the focus. Use the PostMessage function instead.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Dialog Boxes Overview, Dialog Box Messages, PostMessage, SendMessage, SetFocus

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Dialog Boxes Overview, Dialog Box Messages, PostMessage, SendMessage, SetFocus

 

 

 

Platform SDK: Windows GDI

WM_SPOOLERSTATUS

The WM_SPOOLERSTATUS message is sent from Print Manager whenever a job is added to or removed from the Print Manager queue.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_SPOOLERSTATUS

  WPARAM wParam,   // job status

  LPARAM lParam    // number of jobs remaining

);

Parameters

wParam

Specifies the PR_JOBSTATUS flag.

lParam

The low-order word specifies the number of jobs remaining in the Print Manager queue.

Return Values

An application should return zero if it processes this message.

Remarks

This message is for informational purposes only. This message is advisory and does not have guaranteed delivery semantics. Applications should not assume that they will receive a WM_SPOOLERSTATUS message for every change in spooler status.

Windows NT/2000: Requires Windows NT 3.5 through 4.0; not supported on Windows 2000.

Windows 2000: The WM_SPOOLERSTATUS message is not sent. To be notified of changes to the print queue status, use FindFirstPrinterChangeNotification and FindNextPrinterChangeNotification. The following code outlines how this might be done.

HANDLE chgObject;

DWORD *pdwChange;

BOOL fcnreturn;

 

chgObject = FindFirstPrinterChangeNotification( hPrinter, PRINTER_CHANGE_JOB, 0, NULL);

WaitForSingleObject(chgObject, INFINTE);

fcnreturn = FindNextPrinterChangeNotification(chgObject, pdwChange, NULL, NULL);

if (fcnreturn) {

     // check value of *pdwChange and deal with the indicated change

}See Also

Printing and Print Spooler Overview, Printing and Print Spooler Messages, LOWORD, FindFirstPrinterChangeNotification and FindNextPrinterChangeNotification

Built on Thursday, October 12, 2000

 

 

 

   

Platform SDK: Windows User Interface

WM_DRAWITEM

The WM_DRAWITEM message is sent to the owner window of an owner-drawn button, combo box, list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_DRAWITEM

  WPARAM wParam,   // control identifier (UINT)

  LPARAM lParam    // item data (LPDRAWITEMSTRUCT)

);

Parameters

wParam

Specifies the identifier of the control that sent the WM_DRAWITEM message. If the message was sent by a menu, this parameter is zero.

lParam

Pointer to a DRAWITEMSTRUCT structure containing information about the item to be drawn and the type of drawing required.

Return Values

If an application processes this message, it should return TRUE.

Remarks

By default, the DefWindowProc function draws the focus rectangle for an owner-drawn list box item.

The itemAction member of the DRAWITEMSTRUCT structure specifies the drawing operation that an application should perform.

Before returning from processing this message, an application should ensure that the device context identified by the hDC member of the DRAWITEMSTRUCT structure is in the default state.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Combo Boxes Overview, Combo Box Messages, DefWindowProc, DRAWITEMSTRUCT

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Combo Boxes Overview, Combo Box Messages, DefWindowProc, DRAWITEMSTRUCT

 

 

 

   

Platform SDK: Windows User Interface

WM_MEASUREITEM

The WM_MEASUREITEM message is sent to the owner window of a combo box, list box, list view control, or menu item when the control or menu is created.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_MEASUREITEM

  WPARAM wParam,   // control identifier (UINT)

  LPARAM lParam    // item data (LPMEASUREITEMSTRUCT)

);

Parameters

wParam

Contains the value of the CtlID member of the MEASUREITEMSTRUCT structure pointed to by the lParam parameter. This value identifies the control that sent the WM_MEASUREITEM message.

If the value is zero, the message was sent by a menu. If the value is nonzero, the message was sent by a combo box or by a list box. If the value is nonzero, and the value of the itemID member of the MEASUREITEMSTRUCT pointed to by lParam is (UINT)–1, the message was sent by a combo edit field.

lParam

Pointer to a MEASUREITEMSTRUCT structure that contains the dimensions of the owner-drawn control or menu item.

Return Values

If an application processes this message, it should return TRUE.

Remarks

When the owner window receives the WM_MEASUREITEM message, the owner fills in the MEASUREITEMSTRUCT structure pointed to by the lParam parameter of the message and returns; this informs the system of the dimensions of the control. If a list box or combo box is created with the LBS_OWNERDRAWVARIABLE or CBS_OWNERDRAWVARIABLE style, this message is sent to the owner for each item in the control; otherwise, this message is sent once.

The system sends the WM_MEASUREITEM message to the owner window of combo boxes and list boxes created with the OWNERDRAWFIXED style before sending the WM_INITDIALOG message. As a result, when the owner receives this message, the system has not yet determined the height and width of the font used in the control; function calls and calculations requiring these values should occur in the main function of the application or library.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Combo Boxes Overview, Combo Box Messages, MEASUREITEMSTRUCT, WM_INITDIALOG

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Combo Boxes Overview, Combo Box Messages, MEASUREITEMSTRUCT, WM_INITDIALOG

 

 

 

   

Platform SDK: Windows User Interface

WM_DELETEITEM

The WM_DELETEITEM message is sent to the owner of a list box or combo box when the list box or combo box is destroyed or when items are removed by the LB_DELETESTRING, LB_RESETCONTENT, CB_DELETESTRING, or CB_RESETCONTENT message. The system sends a WM_DELETEITEM message for each deleted item. The system sends the WM_DELETEITEM message for any deleted list box or combo box item with nonzero item data.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_DELETEITEM

  WPARAM wParam,   // control identifier

  LPARAM lParam    // item information (LPDELETEITEMSTRUCT)

);

Parameters

wParam

Specifies the identifier of the control that sent the WM_DELETEITEM message.

lParam

Pointer to a DELETEITEMSTRUCT structure that contains information about the item deleted from a list box.

Return Values

An application should return TRUE if it processes this message.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

List Boxes Overview, List Box Messages, CB_DELETESTRING, CB_RESETCONTENT, DELETEITEMSTRUCT, LB_DELETESTRING, LB_RESETCONTENT

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

List Boxes Overview, List Box Messages, CB_DELETESTRING, CB_RESETCONTENT, DELETEITEMSTRUCT, LB_DELETESTRING, LB_RESETCONTENT

 

 

 

   

Platform SDK: Windows User Interface

WM_VKEYTOITEM

The WM_VKEYTOITEM message is sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_KEYDOWN message.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_VKEYTOITEM

  WPARAM wParam,   // virtual-key code, caret position

  LPARAM lParam    // handle to list box (HWND)

);

Parameters

wParam

The low-order word specifies the virtual-key code of the key the user pressed.

The high-order word specifies the current position of the caret.

lParam

Handle to the list box.

Return Values

The return value specifies the action that the application performed in response to the message. A return value of –2 indicates that the application handled all aspects of selecting the item and requires no further action by the list box. A return value of –1 indicates that the list box should perform the default action in response to the keystroke. A return value of 0 or greater specifies the index of an item in the list box and indicates that the list box should perform the default action for the keystroke on the specified item.

Remarks

The DefWindowProc function returns –1.

If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

List Boxes Overview, List Box Messages, DefWindowProc, HIWORD, LOWORD, WM_CHARTOITEM, WM_KEYDOWN

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

List Boxes Overview, List Box Messages, DefWindowProc, HIWORD, LOWORD, WM_CHARTOITEM, WM_KEYDOWN

 

 

 

   

Platform SDK: Windows User Interface

WM_CHARTOITEM

The WM_CHARTOITEM message is sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_CHAR message.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_CHARTOITEM

  WPARAM wParam,   // key value and caret position

  LPARAM lParam    // handle to list box (HWND)

);

Parameters

wParam

The low-order word specifies the value of the key the user pressed.

The high-order word specifies the current position of the caret.

lParam

Handle to the list box.

Return Values

The return value specifies the action that the application performed in response to the message. A return value of –1 or –2 indicates that the application handled all aspects of selecting the item and requires no further action by the list box. A return value of 0 or greater specifies the zero-based index of an item in the list box and indicates that the list box should perform the default action for the keystroke on the specified item.

Remarks

The DefWindowProc function returns –1.

Only owner-drawn list boxes that do not have the LBS_HASSTRINGS style can receive this message.

If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

List Boxes Overview, List Box Messages, DefWindowProc, HIWORD, LOWORD, WM_CHAR, WM_VKEYTOITEM

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

List Boxes Overview, List Box Messages, DefWindowProc, HIWORD, LOWORD, WM_CHAR, WM_VKEYTOITEM

 

 

 

   

Platform SDK: Windows User Interface

WM_SETFONT

An application sends a WM_SETFONT message to specify the font that a control is to use when drawing text.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_SETFONT,               // message to send

  (WPARAM) wParam,          // handle to font

  (LPARAM) lParam          // redraw option

);

Parameters

wParam

Handle to the font. If this parameter is NULL, the control uses the default system font to draw text.

lParam

The low-order word of lParam specifies whether the control should be redrawn immediately upon setting the font. If this parameter is TRUE, the control redraws itself.

Return Values

This message does not return a value.

Remarks

The WM_SETFONT message applies to all controls, not just those in dialog boxes.

The best time for the owner of a dialog box control to set the font of the control is when it receives the WM_INITDIALOG message. The application should call the DeleteObject function to delete the font when it is no longer needed; for example, after it destroys the control.

The size of the control does not change as a result of receiving this message. To avoid clipping text that does not fit within the boundaries of the control, the application should correct the size of the control window before it sets the font.

When a dialog box uses the DS_SETFONT style to set the text in its controls, the system sends the WM_SETFONT message to the dialog box procedure before it creates the controls. An application can create a dialog box that contains the DS_SETFONT style by calling any of the following functions:

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Controls Overview, Control Messages, CreateDialogIndirect, CreateDialogIndirectParam, DeleteObject, DialogBoxIndirect, DialogBoxIndirectParam, DLGTEMPLATE, MAKELPARAM, WM_GETFONT, WM_INITDIALOG

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Controls Overview, Control Messages, CreateDialogIndirect, CreateDialogIndirectParam, DeleteObject, DialogBoxIndirect, DialogBoxIndirectParam, DLGTEMPLATE, MAKELPARAM, WM_GETFONT, WM_INITDIALOG

 

 

 

   

Platform SDK: Windows User Interface

WM_GETFONT

An application sends a WM_GETFONT message to a control to retrieve the font with which the control is currently drawing its text.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_GETFONT,               // message to send

  (WPARAM) wParam,          // not used; must be zero

  (LPARAM) lParam          // not used; must be zero

);

Parameters

This message has no parameters.

Return Values

The return value is a handle to the font used by the control, or NULL if the control is using the system font.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Controls Overview, Control Messages, WM_SETFONT

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Controls Overview, Control Messages, WM_SETFONT

 

 

 

   

Platform SDK: Windows User Interface

WM_SETHOTKEY

An application sends a WM_SETHOTKEY message to a window to associate a hot key with the window. When the user presses the hot key, the system activates the window.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,             // handle to destination window

  WM_SETHOTKEY,            // message to send

  (WPARAM) wParam,         // virtual-key code and modifiers

  (LPARAM) lParam         // not used; must be zero

);

Parameters

wParam

The low-order word specifies the virtual-key code to associate with the window.

The high-order word can be one or more of the following values.

Value

Meaning

HOTKEYF_ALT

ALT key

HOTKEYF_CONTROL

CTRL key

HOTKEYF_EXT

Extended key

HOTKEYF_SHIFT

SHIFT key

 

Setting wParam to NULL removes the hot key associated with a window.

lParam

This parameter is not used.

Return Values

The return value is one of the following.

Value

Meaning

–1

The function is unsuccessful—the hot key is invalid.

0

The function is unsuccessful—the window is invalid.

1

The function is successful, and no other window has the same hot key.

2

The function is successful, but another window already has the same hot key.

 

Remarks

A hot key cannot be associated with a child window.

VK_ESCAPE, VK_SPACE, and VK_TAB are invalid hot keys.

When the user presses the hot key, the system generates a WM_SYSCOMMAND message with wParam equal to SC_HOTKEY and lParam equal to the window's handle. If this message is passed on to DefWindowProc, the system will bring the window's last active popup (if it exists) or the window itself (if there is no popup window) to the foreground.

A window can only have one hot key. If the window already has a hot key associated with it, the new hot key replaces the old one. If more than one window has the same hot key, the window that is activated by the hot key is random.

These hot keys are unrelated to the hot keys set by RegisterHotKey.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, RegisterHotKey, WM_GETHOTKEY, WM_SYSCOMMAND

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, RegisterHotKey, WM_GETHOTKEY, WM_SYSCOMMAND

 

 

 

   

Platform SDK: Windows User Interface

WM_GETHOTKEY

An application sends a WM_GETHOTKEY message to determine the hot key associated with a window.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_GETHOTKEY,             // message to send

  (WPARAM) wParam,          // not used; must be zero

  (LPARAM) lParam          // not used; must be zero

);

Parameters

This message has no parameters.

Return Values

The return value is the virtual-key code and modifiers for the hot key, or NULL if no hot key is associated with the window. The virtual-key code is in the low byte of the return value and the modifiers are in the high byte. The modifiers can be a combination of the following flags.

Value

Meaning

HOTKEYF_ALT

ALT key

HOTKEYF_CONTROL

CTRL key

HOTKEYF_EXT

Extended key

HOTKEYF_SHIFT

SHIFT key

 

Remarks

These hot keys are unrelated to the hot keys set by the RegisterHotKey function.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, RegisterHotKey, WM_SETHOTKEY

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, RegisterHotKey, WM_SETHOTKEY

 

 

 

   

Platform SDK: Windows User Interface

WM_QUERYDRAGICON

The WM_QUERYDRAGICON message is sent to a minimized (iconic) window. The window is about to be dragged by the user but does not have an icon defined for its class. An application can return a handle to an icon or cursor. The system displays this cursor or icon while the user drags the icon.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_QUERYDRAGICON

  WPARAM wParam,   // not used

  LPARAM lParam    // not used

);

Parameters

This message has no parameters.

Return Values

An application should return a handle to a cursor or icon that the system is to display while the user drags the icon. The cursor or icon must be compatible with the display driver's resolution. If the application returns NULL, the system displays the default cursor.

Remarks

When the user drags the icon of a window without a class icon, the system replaces the icon with a default cursor. If the application requires a different cursor to be displayed during dragging, it must return a handle to the cursor or icon compatible with the display driver's resolution. If an application returns a handle to a color cursor or icon, the system converts the cursor or icon to black and white. The application can call the LoadCursor or LoadIcon function to load a cursor or icon from the resources in its executable (.EXE) file and to retrieve this handle.

If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, LoadCursor, LoadIcon

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, LoadCursor, LoadIcon

 

 

 

   

Platform SDK: Windows User Interface

WM_COMPAREITEM

The system sends the WM_COMPAREITEM message to determine the relative position of a new item in the sorted list of an owner-drawn combo box or list box. Whenever the application adds a new item, the system sends this message to the owner of a combo box or list box created with the CBS_SORT or LBS_SORT style.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_COMPAREITEM (UINT)

  WPARAM wParam,   // control identifier

  LPARAM lParam    // item data (LPCOMPAREITEMSTRUCT)

);

Parameters

wParam

Specifies the identifier of the control that sent the WM_COMPAREITEM message.

lParam

Pointer to a COMPAREITEMSTRUCT structure that contains the identifiers and application-supplied data for two items in the combo or list box.

Return Values

The return value indicates the relative position of the two items. It may be any of the values shown in the following table.

Value

Meaning

–1

Item 1 precedes item 2 in the sorted order.

0

Items 1 and 2 are equivalent in the sorted order.

1

Item 1 follows item 2 in the sorted order.

 

Remarks

When the owner of an owner-drawn combo box or list box receives this message, the owner returns a value indicating which of the items specified by the COMPAREITEMSTRUCT structure will appear before the other. Typically, the system sends this message several times until it determines the exact position for the new item.

If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Combo Boxes Overview, Combo Box Messages, COMPAREITEMSTRUCT

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Combo Boxes Overview, Combo Box Messages, COMPAREITEMSTRUCT

 

 

 

Platform SDK: Accessibility

WM_GETOBJECT

Active Accessibility sends the WM_GETOBJECT message to obtain information about an accessible object contained in a server application.

Applications must never send this message directly. It is sent only by Active Accessibility in response to calls to AccessibleObjectFromPoint, AccessibleObjectFromEvent, or AccessibleObjectFromWindow. However, server applications must handle this message.

dwFlags = (WPARAM)(DWORD) wParam;

dwObjId = (LPARAM)(DWORD) lParam;

Parameters

dwFlags

Provides additional information about the message, and is used only by the system. Servers should pass dwFlags as the wParam parameter in the call to LresultFromObject when handling the message.

dwObjId

Object identifier. This value can be one of the object identifier constants or a custom object identifier. Typically, servers process WM_GETOBJECT only if the dwObjId is OBJID_CLIENT.

Return Values

The return value depends on whether the window or control that receives the message implements IAccessible.

  • If implementing IAccessible for the object, the application must return the result obtained from LresultFromObject.
  • If not implementing IAccessible, or if dwObjID is not OBJID_CLIENT, the application should return 0 or let the message fall through to DefWindowProc, which returns 0.

Remarks

When a client calls AccessibleObjectFromWindow or any of the other AccessibleObjectFromX APIs that retrieve an interface to an object, Active Accessibility sends the WM_GETOBJECT message to the appropriate window procedure within the appropriate server application. While processing WM_GETOBJECT, server applications call LresultFromObject and use the return value of this function as the return value for the message. Active Accessibility, in conjunction with the COM library, performs the appropriate marshaling (if needed) and passes the interface pointer from the server back to the client.

Servers must not respond to WM_GETOBJECT before the object is fully initialized or after it is beginning to close down. When an application creates a new window, the system sends EVENT_OBJECT_CREATE notifying clients before it sends the WM_CREATE message to the application's window procedure. Because many applications use WM_CREATE to start their initialization process, servers should not respond to the WM_GETOBJECT message until finished processing the WM_CREATE message.

The most typical ways a server handles WM_GETOBJECT are:

For clients, this means that they may receive distinct interface pointers for the same user interface element. To determine if two interface pointers point to the same user interface element, clients must compare IAccessible properties of the object, comparing pointers will not work.

See Also

LresultFromObject, How WM_GETOBJECT Works, How to Handle WM_GETOBJECT

Built on Monday, April 24, 2000

See Also

LresultFromObject, How WM_GETOBJECT Works, How to Handle WM_GETOBJECT

 

 

 

   

Platform SDK: Windows User Interface

WM_COMPACTING

The WM_COMPACTING message is sent to all top-level windows when the system detects more than 12.5 percent of system time over a 30- to 60-second interval is being spent compacting memory. This indicates that system memory is low.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_COMPACTING

  WPARAM wParam,   // compacting ratio

  LPARAM lParam    // not used

);

Parameters

wParam

Specifies the ratio of central processing unit (CPU) time currently spent by the system compacting memory to CPU time currently spent by the system performing other operations. For example, 0x8000 represents 50 percent of CPU time spent compacting memory.

lParam

This parameter is not used.

Return Values

If an application processes this message, it should return zero.

Remarks

When an application receives this message, it should free as much memory as possible, taking into account the current level of activity of the application and the total number of applications running on the system.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages

 

 

 

   

Platform SDK: Windows User Interface

WM_WINDOWPOSCHANGED

The WM_WINDOWPOSCHANGED message is sent to a window whose size, position, or place in the Z order has changed as a result of a call to the SetWindowPos function or another window-management function.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_WINDOWPOSCHANGED

  WPARAM wParam,   // not used

  LPARAM lParam    // size and position data (LPWINDOWPOS)

);

Parameters

wParam

This parameter is not used.

lParam

Pointer to a WINDOWPOS structure that contains information about the window's new size and position.

Return Values

If an application processes this message, it should return zero.

Remarks

By default, the DefWindowProc function sends the WM_SIZE and WM_MOVE messages to the window. The WM_SIZE and WM_MOVE messages are not sent if an application handles the WM_WINDOWPOSCHANGED message without calling DefWindowProc. It is more efficient to perform any move or size change processing during the WM_WINDOWPOSCHANGED message without calling DefWindowProc.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, EndDeferWindowPos, SetWindowPos, WINDOWPOS, WM_MOVE, WM_SIZE, WM_WINDOWPOSCHANGING

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, EndDeferWindowPos, SetWindowPos, WINDOWPOS, WM_MOVE, WM_SIZE, WM_WINDOWPOSCHANGING

 

 

 

   

Platform SDK: Hardware

WM_POWER

The WM_POWER message is broadcast when the system, typically a battery-powered personal computer, is about to enter suspended mode.

Note  The WM_POWER message is obsolete. It is provided only for compatibility with 16-bit Windows-based applications. Win32-based applications should use the WM_POWERBROADCAST message.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_POWER

  WPARAM wParam,   // power-event notification

  LPARAM lParam    // not used

);

Parameters

wParam

Specifies a power-event notification. This parameter can be one of the following values.

Value

Meaning

PWR_CRITICALRESUME

Indicates that the system is resuming operation after entering suspended mode without first broadcasting a PWR_SUSPENDREQUEST notification message to the application. An application should perform any necessary recovery actions.

PWR_SUSPENDREQUEST

Indicates that the system is about to enter suspended mode.

PWR_SUSPENDRESUME

Indicates that the system is resuming operation after having entered suspended mode normally — that is, the system broadcast a PWR_SUSPENDREQUEST notification message to the application before the system was suspended. An application should perform any necessary recovery actions.

 

lParam

This parameter is not used.

Return Values

The value an application returns depends on the value of the wParam parameter. If wParam is PWR_SUSPENDREQUEST, the return value is PWR_FAIL to prevent the system from entering the suspended state; otherwise, it is PWR_OK. If wParam is PWR_SUSPENDRESUME or PWR_CRITICALRESUME, the return value is zero.

Remarks

This message is broadcast only to an application that is running on a system that conforms to the Advanced Power Management (APM) basic input/output system (BIOS) specification. The message is broadcast by the power-management driver to each window returned by the EnumWindows function.

The suspended mode is the state in which the greatest amount of power savings occurs, but all operational data and parameters are preserved. Random-access memory (RAM) contents are preserved, but many devices are likely to be turned off.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Power Management Overview, Power Management Messages, EnumWindows, WM_POWERBROADCAST

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Power Management Overview, Power Management Messages, EnumWindows, WM_POWERBROADCAST

 

 

 

   

Platform SDK: Interprocess Communications

WM_COPYDATA

An application sends the WM_COPYDATA message to pass data to another application.

To send this message, call the SendMessage function with the following parameters (do not call the PostMessage function).

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_COPYDATA,              // message to send

  (WPARAM) wParam,          // handle to window (HWND)

  (LPARAM) lParam           // data (PCOPYDATASTRUCT)

);

Parameters

wParam

Handle to the window passing the data.

lParam

Pointer to a COPYDATASTRUCT structure that contains the data to be passed.

Return Values

If the receiving application processes this message, it should return TRUE; otherwise, it should return FALSE.

Remarks

The data being passed must not contain pointers or other references to objects not accessible to the application receiving the data.

While this message is being sent, the referenced data must not be changed by another thread of the sending process.

The receiving application should consider the data read-only. The lParam parameter is valid only during the processing of the message. The receiving application should not free the memory referenced by lParam. If the receiving application must access the data after SendMessage returns, it must copy the data into a local buffer.

When you send a WM_COPYDATA message, SendMessage allocates a block of memory cbData bytes in size and copies the data from the caller's address space to this block. It then sends the message to the destination window. When the receiving window procedure processes this message, the lParam parameter is a pointer to a COPYDATASTRUCT structure that exists in the address space of the receiving process. The lpData member is a pointer to the copied block of memory, and the address reflects the memory location in the receiving process's address space.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Interprocess Communications Overview, Interprocess Communications Messages, SendMessage, COPYDATASTRUCT

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Interprocess Communications Overview, Interprocess Communications Messages, SendMessage, COPYDATASTRUCT

 

 

 

   

Platform SDK: Interprocess Communications

WM_CANCELJOURNAL

The WM_CANCELJOURNAL message is posted to an application when a user cancels the application's journaling activities. The message is posted with a NULL window handle.

Parameters

This message has no parameters.

Return Values

This message does not return a value. It is meant to be processed from within an application's main loop or a GetMessage hook procedure, not from a window procedure.

Remarks

Journal record and playback modes are modes imposed on the system that let an application sequentially record or play back user input. The system enters these modes when an application installs a JournalRecordProc or JournalPlaybackProc hook procedure. When the system is in either of these journaling modes, applications must take turns reading input from the input queue. If any one application stops reading input while the system is in a journaling mode, other applications are forced to wait.

To ensure a robust system, one that cannot be hung up by any one application, the system automatically cancels any journaling activities when a user presses CTRL+ESC or CTRL+ALT+DEL. The system then unhooks any journaling hook procedures, and posts a WM_CANCELJOURNAL message, with a NULL window handle, to the application that set the journaling hook.

The WM_CANCELJOURNAL message has a NULL window handle, therefore it cannot be dispatched to a window procedure. There are two ways for an application to see a WM_CANCELJOURNAL message: If the application is running in its own main loop, it must catch the message between its call to GetMessage or PeekMessage and its call to DispatchMessage. If the application is not running in its own main loop, it must set a GetMsgProc hook procedure (through a call to SetWindowsHookEx specifying the WH_GETMESSAGE hook type) that watches for the message.

When an application sees a WM_CANCELJOURNAL message, it can assume two things: the user has intentionally cancelled the journal record or playback mode, and the system has already unhooked any journal record or playback hook procedures.

Note that the key combinations mentioned above (CTRL+ESC or CTRL+ALT+DEL) cause the system to cancel journaling. If any one application is hung, they give the user a means of recovery. The VK_CANCEL virtual key code (usually implemented as the CTRL+BREAK key combination) is what an application that is in journal record mode should watch for as a signal that the user wishes to cancel the journaling activity. The difference is that watching for VK_CANCEL is a suggested behavior for journaling applications, whereas CTRL+ESC or CTRL+ALT+DEL cause the system to cancel journalling regardless of a journalling application's behavior.

Requirements

  Windows NT/2000: Requires Windows NT 3.5 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Hooks Overview, Hook Messages, DispatchMessage, GetMessage, JournalPlaybackProc, JournalRecordProc, GetMsgProc, PeekMessage, SetWindowsHookEx

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.5 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Hooks Overview, Hook Messages, DispatchMessage, GetMessage, JournalPlaybackProc, JournalRecordProc, GetMsgProc, PeekMessage, SetWindowsHookEx

WM_NOTIFY


The WM_NOTIFY message is sent by a common control to its parent window when an event has occurred or the control requires some information.

WM_NOTIFY 
    idCtrl = (int) wParam; 
    pnmh = (LPNMHDR) lParam; 

Parameters

idCtrl

Identifier of the common control sending the message. This identifier is not guaranteed to be unique. An application should use the hwndFrom or idFrom member of the NMHDR structure (passed as the lParam parameter) to identify the control.

pnmh

Pointer to an NMHDR structure that contains the notification code and additional information. For some notification messages, this parameter points to a larger structure that has the NMHDR structure as its first member.

Return Values

The return value is ignored except for notification messages that specify otherwise.

Remarks

If the message handler is in a dialog box procedure, you must use the SetWindowLong function with DWL_MSGRESULT to set a return value.

The standard Microsoft® Windows® controls (edit controls, combo boxes, list boxes, buttons, scroll bars, and static controls) do not send WM_NOTIFY messages. To determine if a common control will send a WM_NOTIFY message and, if it will, which notification codes it will send, see the documentation for the control.

For Windows 2000 and later systems, the WM_NOTIFY message cannot be sent between processes.

Requirements

  Windows NT/2000: Requires Windows NT 3.51 or later
  Windows 95/98: Requires Windows 95 or later
  Header: Declared in winuser.h.

 

 

 

   

Platform SDK: Windows User Interface

WM_INPUTLANGCHANGE

The WM_INPUTLANGCHANGE message is sent to the topmost affected window after an application's input language has been changed. You should make any application-specific settings and pass the message to the DefWindowProc function, which passes the message to all first-level child windows. These child windows can pass the message to DefWindowProc to have it pass the message to their child windows, and so on.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_INPUTLANGCHANGE

  WPARAM wParam,   // character set

  LPARAM lParam    // input locale identifier (HKL)

);

Parameters

wParam

Specifies the character set of the new locale.

lParam

Input locale identifier. For more information, see Languages, Locales, and Keyboard Layouts.

Return Values

An application should return nonzero if it processes this message.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, WM_INPUTLANGCHANGEREQUEST

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, WM_INPUTLANGCHANGEREQUEST

WM_TCARD

Sent to an application that has initiated a training card with Windows Help. The message informs the application when the user clicks an authorable button. An application initiates a training card by specifying the HELP_TCARD command in a call to the WinHelp function.

WM_TCARD 
    idAction = wParam; 
    dwActionData = lParam; 

Parameters

idAction

Value that indicates the action the user has taken. This can be one of these values:

IDABORT

The user clicked an authorable Abort button.

IDCANCEL

The user clicked an authorable Cancel button.

IDCLOSE

The user closed the training card.

IDHELP

The user clicked an authorable Windows Help button.

IDIGNORE

The user clicked an authorable Ignore button.

IDOK

The user clicked an authorable OK button.

IDNO

The user clicked an authorable No button.

IDRETRY

The user clicked an authorable Retry button.

HELP_TCARD_DATA

The user clicked an authorable button. The lParam parameter contains a long integer specified by the Help author.

HELP_TCARD_NEXT

The user clicked an authorable Next button.

HELP_TCARD_OTHER_CALLER

Another application has requested training cards.

IDYES

The user clicked an authorable Yes button.

dwActionData

If idAction specifies HELP_TCARD_DATA, this parameter is a long integer specified by the Help author. Otherwise, this parameter is zero.

Return Values

The return value is ignored; use zero.

Requirements

  Version 4.00 and later of Shell32.dll

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in winuser.h.

WM_HELP

Indicates that the user pressed the F1 key. If a menu is active when F1 is pressed, WM_HELP is sent to the window associated with the menu; otherwise, WM_HELP is sent to the window that has the keyboard focus. If no window has the keyboard focus, WM_HELP is sent to the currently active window.

WM_HELP 
    lphi = (LPHELPINFO) lParam; 

Parameters

lphi

Address of a HELPINFO structure that contains information about the menu item, control, dialog box, or window for which Help is requested.

Return Values

Returns TRUE.

Remarks

The DefWindowProc function passes WM_HELP to the parent window of a child window or to the owner of a top-level window.

Requirements

  Windows NT/2000: Requires Windows NT 3.51 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in winuser.h.

 

 

 

   

Platform SDK: Windows User Interface

WM_USERCHANGED

The WM_USERCHANGED message is sent to all windows after the user has logged on or off. When the user logs on or off, the system updates the user-specific settings. The system sends this message immediately after updating the settings.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_USERCHANGED

  WPARAM wParam,   // not used

  LPARAM lParam    // not used

);

Parameters

This message has no parameters.

Return Values

An application should return zero if it processes this message.

Requirements

  Windows NT/2000: Unsupported.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Unsupported.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages

WM_NOTIFYFORMAT


Used to determine if a window accepts ANSI or Unicode structures in the WM_NOTIFY notification message. WM_NOTIFYFORMAT messages are sent from a common control to its parent window and from the parent window to the common control.

WM_NOTIFYFORMAT
    hwndFrom = (HWND) wParam; 
    Command = lParam; 

Parameters

hwndFrom

Handle to the window that is sending the WM_NOTIFYFORMAT message. If Command is NF_QUERY, this parameter is the handle to a control. If Command is NF_REQUERY, this parameter is the handle to the parent window of a control.

Command

Command value that specifies the nature of the WM_NOTIFYFORMAT message. This will be one of the following values:

NF_QUERY

The message is a query to determine whether ANSI or Unicode structures should be used in WM_NOTIFY messages. This command is sent from a control to its parent window during the creation of a control and in response to an NF_REQUERY command.

NF_REQUERY

The message is a request for a control to send an NF_QUERY form of this message to its parent window. This command is sent from the parent window. The parent window is asking the control to requery it about the type of structures to use in WM_NOTIFY messages.

Return Values

Returns one of the following:

NFR_ANSI

ANSI structures should be used in WM_NOTIFY messages sent by the control.

NFR_UNICODE

Unicode structures should be used in WM_NOTIFY messages sent by the control.

0

An error occurred.

If Command is NF_REQUERY, the return value is the result of the requery operation.

Remarks

When a common control is created, the control sends a WM_NOTIFYFORMAT message to its parent window to determine the type of structures to use in WM_NOTIFY messages. If the parent window does not handle this message, the DefWindowProc function responds according to the type of the parent window. That is, if the parent window is a Unicode window, DefWindowProc returns NFR_UNICODE, and if the parent window is an ANSI window, DefWindowProc returns NFR_ANSI. If the parent window is a dialog box and does not handle this message, the DefDlgProc function similarly responds according to the type of the dialog box (Unicode or ANSI).

A parent window can change the type of structures a common control uses in WM_NOTIFY messages by setting lParam to NF_REQUERY and sending a WM_NOTIFYFORMAT message to the control. This causes the control to send an NF_QUERY form of the WM_NOTIFYFORMAT message to the parent window.

All common controls will send WM_NOTIFYFORMAT messages. However, the standard Windows controls (edit controls, combo boxes, list boxes, buttons, scroll bars, and static controls) do not.

Requirements

  Windows NT/2000: Requires Windows NT 3.51 or later
  Windows 95/98: Requires Windows 95 or later
  Header: Declared in winuser.h.

 

 

 

   

Platform SDK: Windows User Interface

WM_CONTEXTMENU

The WM_CONTEXTMENU message notifies a window that the user clicked the right mouse button (right clicked) in the window.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  WM_CONTEXTMENU// the message to send

  WPARAM wParam,   // handle to window (HWND)

  LPARAM lParam    // horizontal and vertical position

);

Parameters

wParam

Handle to the window in which the user right clicked the mouse. This can be a child window of the window receiving the message. For more information about processing this message, see the Remarks section.

lParam

The low-order word specifies the horizontal position of the cursor, in screen coordinates, at the time of the mouse click.

The high-order word specifies the vertical position of the cursor, in screen coordinates, at the time of the mouse click.

Return Values

No return value.

Remarks

A window can process this message by displaying a shortcut menu using the TrackPopupMenu or TrackPopupMenuEx function. To obtain the horizontal and vertical positions, use the following code:

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

If a window does not display a shortcut menu it should pass this message to the DefWindowProc function. If a window is a child window, DefWindowProc sends the message to the parent. Otherwise, DefWindowProc displays a default shortcut menu if the specified position is in the window's caption.

DefWindowProc generates the WM_CONTEXTMENU message when it processes the WM_RBUTTONUP or WM_NCRBUTTONUP message or when the user types SHIFT+F10. The WM_CONTEXTMENU message is also generated when the user presses and releases the VK_APPS key.

If the context menu is generated from the keyboard—for example, if the user types SHIFT+F10--then the x- and y-coordinates are –1 and the application should display the context menu at the location of the current selection rather than at (xPos, yPos).

Requirements

  Windows NT/2000: Requires Windows NT 3.51 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, TrackPopupMenu, TrackPopupMenuEx, WM_NCRBUTTONUP, WM_RBUTTONUP

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.51 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, TrackPopupMenu, TrackPopupMenuEx, WM_NCRBUTTONUP, WM_RBUTTONUP

 

 

 

   

Platform SDK: Windows User Interface

WM_STYLECHANGING

The WM_STYLECHANGING message is sent to a window when the SetWindowLong function is about to change one or more of the window's styles.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_STYLECHANGING

  WPARAM wParam,   // window style types

  LPARAM lParam    // new styles (LPSTYLESTRUCT)

);

Parameters

wParam

Specifies whether the window's styles or extended window styles have changed. This parameter can be one or more of the following values.

Value

Meaning

GWL_EXSTYLE

The extended window styles are changing.

GWL_STYLE

The window styles are changing.

 

lParam

Pointer to a STYLESTRUCT structure that contains the proposed new styles for the window. An application can examine the styles and, if necessary, change them.

Return Values

An application should return zero if it processes this message.

Requirements

  Windows NT/2000: Requires Windows NT 3.51 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, STYLESTRUCT, WM_STYLECHANGED

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.51 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, STYLESTRUCT, WM_STYLECHANGED

 

 

 

   

Platform SDK: Windows User Interface

WM_STYLECHANGED

The WM_STYLECHANGED message is sent to a window after the SetWindowLong function has changed one or more of the window's styles.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_STYLECHANGED

  WPARAM wParam,   // w

indow style types

  LPARAM lParam    // new styles (LPSTYLESTRUCT)

);

Parameters

wParam

Specifies whether the window's styles or extended window styles have changed. This parameter can be one or more of the following values.

Value

Meaning

GWL_EXSTYLE

The extended window styles have changed.

GWL_STYLE

The window styles have changed.

 

lParam

Pointer to a STYLESTRUCT structure that contains the new styles for the window. An application can examine the styles, but can not change them.

Return Values

An application should return zero if it processes this message.

Requirements

  Windows NT/2000: Requires Windows NT 3.51 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, SetWindowLong, STYLESTRUCT, WM_STYLECHANGING

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.51 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, SetWindowLong, STYLESTRUCT, WM_STYLECHANGING

 

 

 

   

Platform SDK: Windows GDI

WM_DISPLAYCHANGE

The WM_DISPLAYCHANGE message is sent to all windows when the display resolution has changed.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_DISPLAYCHANGE

  WPARAM wParam,   // image depth

  LPARAM lParam    // screen resolution

);

Parameters

wParam

Specifies the new image depth of the display, in bits per pixel.

lParam

The low-order word specifies the horizontal resolution of the screen.

The high-order word specifies the vertical resolution of the screen.

Remarks

This message is only sent to top-level windows. For all other windows it is posted.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Painting and Drawing Overview, Painting and Drawing Messages, , HIWORD, LOWORD

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Painting and Drawing Overview, Painting and Drawing Messages, , HIWORD, LOWORD

 

 

 

   

Platform SDK: Windows User Interface

WM_GETICON

The WM_GETICON message is 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.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_GETICON

  WPARAM wParam,   // icon type

  LPARAM lParam    // not used

);

Parameters

wParam

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

Value

Meaning

ICON_BIG

Retrieve the large icon for the window.

ICON_SMALL

Retrieve the small icon for the window.

ICON_SMALL2

Whistler: 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 Values

The return value is a handle to the large or small icon, depending on the value of fType. 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 fType.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, WM_SETICON

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, WM_SETICON

 

 

 

   

Platform SDK: Windows User Interface

WM_SETICON

An application sends the WM_SETICON message to associate a new large or small icon with a window. The system displays the large icon in the ALT+TAB dialog box, and the small icon in the window caption.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_SETICON,               // message to send

  (WPARAM) wParam,          // icon type

  (LPARAM) lParam          // handle to icon (HICON)

);

Parameters

wParam

Specifies the type of icon to be set. This parameter can be one of the following values.

Value

Meaning

ICON_BIG

Set the large icon for the window.

ICON_SMALL

Set the small icon for the window.

 

lParam

Handle to the new large or small icon. If this parameter is NULL, the icon indicated by wParam is removed.

Return Values

The return value is a handle to the previous large or small icon, depending on the value of wParam. It is NULL if the window previously had no icon of the type indicated by wParam.

Remarks

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

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, WM_GETICON

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, WM_GETICON

 

 

 

   

Platform SDK: Windows User Interface

WM_NCCREATE

The WM_NCCREATE message is sent prior to the WM_CREATE message when a window is first created.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_NCCREATE

  WPARAM wParam,   // not used

  LPARAM lParam    // creation data (LPCREATESTRUCT)

);

Parameters

wParam

This parameter is not used.

lParam

Pointer to the CREATESTRUCT structure that contains information about the window being created. The members of CREATESTRUCT are identical to the parameters of the CreateWindowEx function.

Return Values

If an application processes this message, it should return TRUE to continue creation of the window. If the application returns FALSE, the CreateWindow or CreateWindowEx function will return a NULL handle.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, CreateWindow, CreateWindowEx, DefWindowProc, CREATESTRUCT, WM_CREATE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, CreateWindow, CreateWindowEx, DefWindowProc, CREATESTRUCT, WM_CREATE

 

 

 

   

Platform SDK: Windows User Interface

WM_NCDESTROY

The WM_NCDESTROY message informs a window that its nonclient area is being destroyed. The DestroyWindow function sends the WM_NCDESTROY message to the window following the WM_DESTROY message. WM_DESTROY is used to free the allocated memory object associated with the window.

The WM_NCDESTROY message is sent after the child windows have been destroyed. In contrast, WM_DESTROY is sent before the child windows are destroyed.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_NCDESTROY

  WPARAM wParam,   // not used

  LPARAM lParam    // not used

);

Parameters

This message has no parameters.

Return Values

If an application processes this message, it should return zero.

Remarks

This message frees any memory internally allocated for the window.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DestroyWindow, WM_DESTROY, WM_NCCREATE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DestroyWindow, WM_DESTROY, WM_NCCREATE

 

 

 

   

Platform SDK: Windows User Interface

WM_NCCALCSIZE

The WM_NCCALCSIZE message is sent when the size and position of a window's client area must be calculated. By processing this message, an application can control the content of the window's client area when the size or position of the window changes.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_NCCALCSIZE

  WPARAM wParam,   // validation flag (BOOL)

  LPARAM lParam    // data (LPNCCALCSIZE_PARAMS or LPRECT)

);

Parameters

wParam

If wParam is TRUE, it specifies that the application should indicate which part of the client area contains valid information. The system copies the valid information to the specified area within the new client area.

If wParam is FALSE, the application does not need to indicate the valid part of the client area.

lParam

If wParam is TRUE, lParam points to an NCCALCSIZE_PARAMS structure that contains information an application can use to calculate the new size and position of the client rectangle.

If wParam is FALSE, lParam points to a RECT structure. On entry, the structure contains the proposed window rectangle for the window. On exit, the structure should contain the screen coordinates of the corresponding window client area.

Return Values

If the wParam parameter is FALSE, the application should return zero.

If wParam is TRUE, the application should return zero or a combination of the following values.

Value

Meaning

WVR_ALIGNTOP,
WVR_ALIGNLEFT,
WVR_ALIGNBOTTOM

These values, used in combination, specify that the client area of the window is to be preserved and aligned appropriately relative to the new position of the window. For example, to align the client area to the lower-left corner, return the WVR_ALIGNLEFT and WVR_ALIGNBOTTOM values.

WVR_HREDRAW,
WVR_VREDRAW

These values, used in combination with any other values, cause the window to be completely redrawn if the client rectangle changes size horizontally or vertically. These values are similar to the CS_HREDRAW and CS_VREDRAW class styles.

WVR_REDRAW

This value causes the entire window to be redrawn. It is a combination of WVR_HREDRAW and WVR_VREDRAW values.

WVR_VALIDRECTS

This value indicates that, upon return from WM_NCCALCSIZE, the rectangles specified by the rgrc[1] and rgrc[2] members of the NCCALCSIZE_PARAMS structure contain valid destination and source area rectangles, respectively. The system combines these rectangles to calculate the area of the window to be preserved. The system copies any part of the window image that is within the source rectangle and clips the image to the destination rectangle. Both rectangles are in parent-relative or screen-relative coordinates.

This return value allows an application to implement more elaborate client-area preservation strategies, such as centering or preserving a subset of the client area.

 

If wParam is TRUE and an application returns zero, the old client area is preserved and is aligned with the upper-left corner of the new client area.

Remarks

The window may be redrawn, depending on whether the CS_HREDRAW or CS_VREDRAW class style is specified. This is the default, backward-compatible processing of this message by the DefWindowProc function (in addition to the usual client rectangle calculation described in the preceding table).

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, MoveWindow, SetWindowPos, NCCALCSIZE_PARAMS, RECT

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, MoveWindow, SetWindowPos, NCCALCSIZE_PARAMS, RECT

 

 

 

   

Platform SDK: Windows User Interface

WM_NCHITTEST

The WM_NCHITTEST message is sent to a window when the cursor moves, or when a mouse button is pressed or released. If the mouse is not captured, the message is sent to the window beneath the cursor. Otherwise, the message is sent to the window that has captured the mouse.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_NCHITTEST

  WPARAM wParam,   // not used

  LPARAM lParam    // horizontal and vertical position

);

Parameters

wParam

This parameter is not used.

lParam

The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the screen.

The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the screen.

Return Values

The return value of the DefWindowProc function is one of the following values, indicating the position of the cursor hot spot.

Value

Location of hot spot

HTBORDER

In the border of a window that does not have a sizing border.

HTBOTTOM

In the lower-horizontal border of a resizable window (the user can click the mouse to resize the window vertically).

HTBOTTOMLEFT

In the lower-left corner of a border of a resizable window (the user can click the mouse to resize the window diagonally).

HTBOTTOMRIGHT

In the lower-right corner of a border of a resizable window (the user can click the mouse to resize the window diagonally).

HTCAPTION

In a title bar.

HTCLIENT

In a client area.

HTCLOSE

In a Close button.

HTERROR

On the screen background or on a dividing line between windows (same as HTNOWHERE, except that the DefWindowProc function produces a system beep to indicate an error).

HTGROWBOX

In a size box (same as HTSIZE).

HTHELP

In a Help button.

HTHSCROLL

In a horizontal scroll bar.

HTLEFT

In the left border of a resizable window (the user can click the mouse to resize the window horizontally).

HTMENU

In a menu.

HTMAXBUTTON

In a Maximize button.

HTMINBUTTON

In a Minimize button.

HTNOWHERE

On the screen background or on a dividing line between windows.

HTREDUCE

In a Minimize button.

HTRIGHT

In the right border of a resizable window (the user can click the mouse to resize the window horizontally).

HTSIZE

In a size box (same as HTGROWBOX).

HTSYSMENU

In a window menu or in a Close button in a child window.

HTTOP

In the upper-horizontal border of a window.

HTTOPLEFT

In the upper-left corner of a window border.

HTTOPRIGHT

In the upper-right corner of a window border.

HTTRANSPARENT

In a window currently covered by another window in the same thread (the message will be sent to underlying windows in the same thread until one of them returns a code that is not HTTRANSPARENT).

HTVSCROLL

In the vertical scroll bar.

HTZOOM

In a Maximize button.

 

Remarks

Use the following code to obtain the horizontal and vertical position:

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS

 

 

 

   

Platform SDK: Windows GDI

WM_NCPAINT

The WM_NCPAINT message is sent to a window when its frame must be painted.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_NCPAINT

  WPARAM wParam,   // handle to update region (HRGN)

  LPARAM lParam    // not used

);

Parameters

wParam

Handle to the update region of the window. The update region is clipped to the window frame. When wParam is 1, the entire window frame needs to be updated.

lParam

This parameter is not used.

Return Values

An application returns zero if it processes this message.

Remarks

The DefWindowProc function paints the window frame.

An application can intercept the WM_NCPAINT message and paint its own custom window frame. The clipping region for a window is always rectangular, even if the shape of the frame is altered.

The wParam value can be passed to GetDCEx as in the following example.

case WM_NCPAINT:

{

    HDC hdc;

    hdc = GetDCEx(hwnd, (HRGN)wParam, DCX_WINDOW|DCX_INTERSECTRGN);

    // Paint into this DC

    ReleaseDC(hwnd, hdc);

}

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Painting and Drawing Overview, Painting and Drawing Messages, DefWindowProc, GetWindowDC, WM_PAINT GetDCEx

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Painting and Drawing Overview, Painting and Drawing Messages, DefWindowProc, GetWindowDC, WM_PAINT GetDCEx

 

 

 

   

Platform SDK: Windows User Interface

WM_NCACTIVATE

The WM_NCACTIVATE message is sent to a window when its nonclient area needs to be changed to indicate an active or inactive state.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_NCACTIVATE

  WPARAM wParam,   // new state (BOOL)

  LPARAM lParam    // not used

);

Parameters

wParam

Specifies when a title bar or icon needs to be changed to indicate an active or inactive state. If an active title bar or icon is to be drawn, the wParam parameter is TRUE. It is FALSE for an inactive title bar or icon.

lParam

This parameter is not used.

Return Values

When the wParam parameter is FALSE, an application should return TRUE to indicate that the system should proceed with the default processing, or it should return FALSE to prevent the title bar or icon from being deactivated. When wParam is TRUE, the return value is ignored.

Remarks

The DefWindowProc function draws the title bar or icon title in its active colors when the wParam parameter is TRUE and in its inactive colors when wParam is FALSE.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc

 

 

 

   

Platform SDK: Windows User Interface

WM_GETDLGCODE

The WM_GETDLGCODE message is sent to the window procedure associated with a control. By default, the system handles all keyboard input to the control; the system interprets certain types of keyboard input as dialog box navigation keys. To override this default behavior, the control can respond to the WM_GETDLGCODE message to indicate the types of input it wants to process itself.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_GETDLGCODE

  WPARAM wParam,   // not used

  LPARAM lParam    // message information

);

Parameters

wParam

This parameter is not used.

lParam

Pointer to an MSG structure (or NULL if the system is performing a query).

Return Values

The return value is one or more of the following values, indicating which type of input the application processes.

Value

Meaning

DLGC_BUTTON

Button.

DLGC_DEFPUSHBUTTON

Default push button.

DLGC_HASSETSEL

EM_SETSEL messages.

DLGC_RADIOBUTTON

Radio button.

DLGC_STATIC

Static control.

DLGC_UNDEFPUSHBUTTON

Non-default push button.

DLGC_WANTALLKEYS

All keyboard input.

DLGC_WANTARROWS

Direction keys.

DLGC_WANTCHARS

WM_CHAR messages.

DLGC_WANTMESSAGE

All keyboard input (the application passes this message in the MSG structure to the control).

DLGC_WANTTAB

TAB key.

 

Remarks

Although the DefWindowProc function always returns zero in response to the WM_GETDLGCODE message, the window procedure for the predefined control classes return a code appropriate for each class.

The WM_GETDLGCODE message and the returned values are useful only with user-defined dialog box controls or standard controls modified by subclassing.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Dialog Boxes Overview, Dialog Box Messages, DefWindowProc, MSG, EM_SETSEL, WM_CHAR

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Dialog Boxes Overview, Dialog Box Messages, DefWindowProc, MSG, EM_SETSEL, WM_CHAR

 

 

 

   

Platform SDK: Windows GDI

WM_SYNCPAINT

The WM_SYNCPAINT message is used to synchronize painting while avoiding linking independent GUI threads.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_SYNCPAINT

  WPARAM wParam,   // not used

  LPARAM lParam    // not used

);

Parameters

This message has no parameters.

Return Values

An application returns zero if it processes this message.

Remarks

When a window has been hidden, shown, moved, or sized, the system may determine that it is necessary to send a WM_SYNCPAINT message to the top-level windows of other threads. Applications must pass WM_SYNCPAINT to DefWindowProc for processing. The DefWindowProc function will send a WM_NCPAINT message to the window procedure if the window frame must be painted and send a WM_ERASEBKGND message if the window background must be erased.

Requirements

  Windows NT/2000: Requires Windows 2000 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Painting and Drawing Overview, Painting and Drawing Messages, DefWindowProc, GetDCEx, GetWindowDC, WM_PAINT

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows 2000 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Painting and Drawing Overview, Painting and Drawing Messages, DefWindowProc, GetDCEx, GetWindowDC, WM_PAINT

 

 

 

   

Platform SDK: Windows User Interface

WM_NCMOUSEMOVE

The WM_NCMOUSEMOVE message is posted to a window when the cursor is moved within the nonclient area of the window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_NCMOUSEMOVE

  WPARAM wParam,   // hit-test value

  LPARAM lParam    // cursor position

);

Parameters

wParam

Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

lParam

Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Remarks

If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

You can also use the GET_X_LPARAM and GET_Y_LPARAM macros to extract the values of the x- and y- coordinates from lParam.

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_SYSCOMMAND

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_SYSCOMMAND

 

 

 

   

Platform SDK: Windows User Interface

WM_NCLBUTTONDOWN

The WM_NCLBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_NCLBUTTONDOWN

  WPARAM wParam,   // hit-test value

  LPARAM lParam    // cursor position

);

Parameters

wParam

Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

lParam

Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Remarks

The DefWindowProc function tests the specified point to find the location of the cursor and performs the appropriate action. If appropriate, DefWindowProc sends the WM_SYSCOMMAND message to the window.

You can also use the GET_X_LPARAM and GET_Y_LPARAM macros to extract the values of the x- and y- coordinates from lParam.

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_NCLBUTTONDBLCLK, WM_NCLBUTTONUP, WM_SYSCOMMAND

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_NCLBUTTONDBLCLK, WM_NCLBUTTONUP, WM_SYSCOMMAND

 

 

 

   

Platform SDK: Windows User Interface

WM_NCLBUTTONUP

The WM_NCLBUTTONUP message is posted when the user releases the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_NCLBUTTONUP

  WPARAM wParam,   // hit-test value

  LPARAM lParam    // cursor position

);

Parameters

wParam

Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

lParam

Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Remarks

The DefWindowProc function tests the specified point to find out the location of the cursor and performs the appropriate action. If appropriate, DefWindowProc sends the WM_SYSCOMMAND message to the window.

You can also use the GET_X_LPARAM and GET_Y_LPARAM macros to extract the values of the x- and y- coordinates from lParam.

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_NCLBUTTONDBLCLK, WM_NCLBUTTONDOWN, WM_SYSCOMMAND

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_NCLBUTTONDBLCLK, WM_NCLBUTTONDOWN, WM_SYSCOMMAND

 

 

 

   

Platform SDK: Windows User Interface

WM_NCLBUTTONDBLCLK

The WM_NCLBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_NCLBUTTONDBLCLK

  WPARAM wParam,   // hit-test value

  LPARAM lParam    // cursor position

);

Parameters

wParam

Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

lParam

Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Remarks

You can also use the GET_X_LPARAM and GET_Y_LPARAM macros to extract the values of the x- and y- coordinates from lParam.

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

By default, the DefWindowProc function tests the specified point to find out the location of the cursor and performs the appropriate action. If appropriate, DefWindowProc sends the WM_SYSCOMMAND message to the window.

A window need not have the CS_DBLCLKS style to receive WM_NCLBUTTONDBLCLK messages.

The system generates a WM_NCLBUTTONDBLCLK message when the user presses, releases, and again presses the left mouse button within the system's double-click time limit. Double-clicking the left mouse button actually generates four messages: WM_NCLBUTTONDOWN, WM_NCLBUTTONUP, WM_NCLBUTTONDBLCLK, and WM_NCLBUTTONUP again.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_NCLBUTTONDOWN, WM_NCLBUTTONUP, WM_SYSCOMMAND

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_NCLBUTTONDOWN, WM_NCLBUTTONUP, WM_SYSCOMMAND

 

 

 

   

Platform SDK: Windows User Interface

WM_NCRBUTTONDOWN

The WM_NCRBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_NCRBUTTONDOWN

  WPARAM wParam,   // hit-test value

  LPARAM lParam    // cursor position

);

Parameters

wParam

Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

lParam

Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Remarks

You can also use the GET_X_LPARAM and GET_Y_LPARAM macros to extract the values of the x- and y- coordinates from lParam.

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_NCRBUTTONDBLCLK, WM_NCRBUTTONUP, WM_SYSCOMMAND

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_NCRBUTTONDBLCLK, WM_NCRBUTTONUP, WM_SYSCOMMAND

 

 

 

   

Platform SDK: Windows User Interface

WM_NCRBUTTONUP

The WM_NCRBUTTONUP message is posted when the user releases the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_NCRBUTTONUP

  WPARAM wParam,   // hit-test value

  LPARAM lParam    // cursor position

);

Parameters

wParam

Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

lParam

Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Remarks

You can also use the GET_X_LPARAM and GET_Y_LPARAM macros to extract the values of the x- and y- coordinates from lParam.

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_NCRBUTTONDBLCLK, WM_NCRBUTTONDOWN, WM_SYSCOMMAND

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_NCRBUTTONDBLCLK, WM_NCRBUTTONDOWN, WM_SYSCOMMAND

 

 

 

   

Platform SDK: Windows User Interface

WM_NCRBUTTONDBLCLK

The WM_NCRBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_NCRBUTTONDBLCLK

  WPARAM wParam,   // hit-test value

  LPARAM lParam    // cursor position

);

Parameters

wParam

Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

lParam

Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Remarks

A window need not have the CS_DBLCLKS style to receive WM_NCRBUTTONDBLCLK messages.

The system generates a WM_NCRBUTTONDBLCLK message when the user presses, releases, and again presses the right mouse button within the system's double-click time limit. Double-clicking the right mouse button actually generates four messages: WM_NCRBUTTONDOWN, WM_NCRBUTTONUP, WM_NCRBUTTONDBLCLK, and WM_NCRBUTTONUP again.

You can also use the GET_X_LPARAM and GET_Y_LPARAM macros to extract the values of the x- and y- coordinates from lParam.

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_NCRBUTTONDOWN, WM_NCRBUTTONUP, WM_SYSCOMMAND

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_NCRBUTTONDOWN, WM_NCRBUTTONUP, WM_SYSCOMMAND

 

 

 

   

Platform SDK: Windows User Interface

WM_NCMBUTTONDOWN

The WM_NCMBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_NCMBUTTONDOWN

  WPARAM wParam,   // hit-test value

  LPARAM lParam    // cursor position

);

Parameters

wParam

Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

lParam

Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Remarks

You can also use the GET_X_LPARAM and GET_Y_LPARAM macros to extract the values of the x- and y- coordinates from lParam.

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_NCMBUTTONDBLCLK, WM_NCMBUTTONUP, WM_SYSCOMMAND

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_NCMBUTTONDBLCLK, WM_NCMBUTTONUP, WM_SYSCOMMAND

 

 

 

   

Platform SDK: Windows User Interface

WM_NCMBUTTONUP

The WM_NCMBUTTONUP message is posted when the user releases the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_NCMBUTTONUP

  WPARAM wParam,   // hit-test value

  LPARAM lParam    // cursor position

);

Parameters

wParam

Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

lParam

Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Remarks

You can also use the GET_X_LPARAM and GET_Y_LPARAM macros to extract the values of the x- and y- coordinates from lParam.

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_NCMBUTTONDBLCLK, WM_NCMBUTTONDOWN, WM_SYSCOMMAND

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_NCMBUTTONDBLCLK, WM_NCMBUTTONDOWN, WM_SYSCOMMAND

 

 

 

   

Platform SDK: Windows User Interface

WM_NCMBUTTONDBLCLK

The WM_NCMBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_NCMBUTTONDBLCLK

  WPARAM wParam,   // hit-test value

  LPARAM lParam    // cursor position

);

Parameters

wParam

Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

lParam

Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Remarks

A window need not have the CS_DBLCLKS style to receive WM_NCMBUTTONDBLCLK messages.

The system generates a WM_NCMBUTTONDBLCLK message when the user presses, releases, and again presses the middle mouse button within the system's double-click time limit. Double-clicking the middle mouse button actually generates four messages: WM_NCMBUTTONDOWN, WM_NCMBUTTONUP, WM_NCMBUTTONDBLCLK, and WM_NCMBUTTONUP again.

You can also use the GET_X_LPARAM and GET_Y_LPARAM macros to extract the values of the x- and y- coordinates from lParam.

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_NCMBUTTONDOWN, WM_NCMBUTTONUP, WM_SYSCOMMAND

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, MAKEPOINTS, POINTS, WM_NCHITTEST, WM_NCMBUTTONDOWN, WM_NCMBUTTONUP, WM_SYSCOMMAND

 

 

 

   

Platform SDK: Windows User Interface

WM_KEYDOWN

The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_KEYDOWN

  WPARAM wParam,   // virtual-key code

  LPARAM lParam    // key data

);

Parameters

wParam

Specifies the virtual-key code of the nonsystem key.

lParam

Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table.

Value

Description

0–15

Specifies the repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.

16–23

Specifies the scan code. The value depends on the original equipment manufacturer (OEM).

24

Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.

25–28

Reserved; do not use.

29

Specifies the context code. The value is always 0 for a WM_KEYDOWN message.

30

Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is zero if the key is up.

31

Specifies the transition state. The value is always zero for a WM_KEYDOWN message.

 

Return Values

An application should return zero if it processes this message.

Remarks

If the F10 key is pressed, the DefWindowProc function sets an internal flag. When DefWindowProc receives the WM_KEYUP message, the function checks whether the internal flag is set and, if so, sends a WM_SYSCOMMAND message to the top-level window. The wParam parameter of the message is set to SC_KEYMENU.

Because of the autorepeat feature, more than one WM_KEYDOWN message may be posted before a WM_KEYUP message is posted. The previous key state (bit 30) can be used to determine whether the WM_KEYDOWN message indicates the first down transition or a repeated down transition.

For enhanced 101- and 102-key keyboards, extended keys are the right ALT and CTRL keys on the main section of the keyboard; the INS, DEL, HOME, END, PAGE UP, PAGE DOWN, and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and ENTER keys in the numeric keypad. Other keyboards may support the extended-key bit in the lParam parameter.

Windows 2000: Applications must pass wParam to TranslateMessage without altering it at all.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, DefWindowProc, TranslateMessage,WM_CHAR, WM_KEYUP, WM_SYSCOMMAND

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, DefWindowProc, TranslateMessage,WM_CHAR, WM_KEYUP, WM_SYSCOMMAND

 

 

 

   

Platform SDK: Windows User Interface

WM_KEYUP

The WM_KEYUP message is posted to the window with the keyboard focus when a nonsystem key is released. A nonsystem key is a key that is pressed when the ALT key is not pressed, or a keyboard key that is pressed when a window has the keyboard focus.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_KEYUP

  WPARAM wParam,   // virtual-key code

  LPARAM lParam    // key data

);

Parameters

wParam

Specifies the virtual-key code of the nonsystem key.

lParam

Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table.

Value

Description

0–15

Specifies the repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. The repeat count is always one for a WM_KEYUP message.

16–23

Specifies the scan code. The value depends on the original equipment manufacturer (OEM).

24

Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.

25–28

Reserved; do not use.

29

Specifies the context code. The value is always 0 for a WM_KEYUP message.

30

Specifies the previous key state. The value is always 1 for a WM_KEYUP message.

31

Specifies the transition state. The value is always 1 for a WM_KEYUP message.

 

Return Values

An application should return zero if it processes this message.

Remarks

The DefWindowProc function sends a WM_SYSCOMMAND message to the top-level window if the F10 key or the ALT key was released. The wParam parameter of the message is set to SC_KEYMENU.

For enhanced 101- and 102-key keyboards, extended keys are the right ALT and CTRL keys on the main section of the keyboard; the INS, DEL, HOME, END, PAGE UP, PAGE DOWN, and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and ENTER keys in the numeric keypad. Other keyboards may support the extended-key bit in the lParam parameter.

Windows 2000: Applications must pass wParam to TranslateMessage without altering it at all.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, DefWindowProc, TranslateMessage, WM_KEYDOWN, WM_SYSCOMMAND

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, DefWindowProc, TranslateMessage, WM_KEYDOWN, WM_SYSCOMMAND

 

 

 

   

Platform SDK: Windows User Interface

WM_CHAR

The WM_CHAR message is posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by the TranslateMessage function. The WM_CHAR message contains the character code of the key that was pressed.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_CHAR

  WPARAM wParam,   // character code (TCHAR)

  LPARAM lParam    // key data

);

Parameters

wParam

Specifies the character code of the key.

lParam

Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table.

Value

Description

0–15

Specifies the repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.

16–23

Specifies the scan code. The value depends on the original equipment manufacturer (OEM).

24

Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.

25–28

Reserved; do not use.

29

Specifies the context code. The value is 1 if the ALT key is held down while the key is pressed; otherwise, the value is 0.

30

Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.

31

Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed.

 

Return Values

An application should return zero if it processes this message.

Remarks

Because there is not necessarily a one-to-one correspondence between keys pressed and character messages generated, the information in the high-order word of the lParam parameter is generally not useful to applications. The information in the high-order word applies only to the most recent WM_KEYDOWN message that precedes the posting of the WM_CHAR message.

For enhanced 101- and 102-key keyboards, extended keys are the right ALT and the right CTRL keys on the main section of the keyboard; the INS, DEL, HOME, END, PAGE UP, PAGE DOWN and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and ENTER keys in the numeric keypad. Some other keyboards may support the extended-key bit in the lParam parameter.

Whistler: The WM_UNICHAR message is the same as WM_CHAR, except it is designed to send or post Unicode characters to ANSI windows.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, TranslateMessage, WM_KEYDOWN, WM_UNICHAR

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, TranslateMessage, WM_KEYDOWN, WM_UNICHAR

 

 

 

   

Platform SDK: Windows User Interface

WM_DEADCHAR

The WM_DEADCHAR message is posted to the window with the keyboard focus when a WM_KEYUP message is translated by the TranslateMessage function. WM_DEADCHAR specifies a character code generated by a dead key. A dead key is a key that generates a character, such as the umlaut (double-dot), that is combined with another character to form a composite character. For example, the umlaut-O character (Ö) is generated by typing the dead key for the umlaut character, and then typing the O key.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_DEADCHAR

  WPARAM wParam,   // character code (TCHAR)

  LPARAM lParam    // key data

);

Parameters

wParam

Specifies the character code generated by the dead key.

lParam

Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table.

Value

Description

0–15

Specifies the repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.

16–23

Specifies the scan code. The value depends on the original equipment manufacturer (OEM).

24

Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.

25–28

Reserved; do not use.

29

Specifies the context code. The value is 1 if the ALT key is held down while the key is pressed; otherwise, the value is 0.

30

Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.

31

Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed.

 

Return Values

An application should return zero if it processes this message.

Remarks

The WM_DEADCHAR message typically is used by applications to give the user feedback about each key pressed. For example, an application can display the accent in the current character position without moving the caret.

Because there is not necessarily a one-to-one correspondence between keys pressed and character messages generated, the information in the high-order word of the lParam parameter is generally not useful to applications. The information in the high-order word applies only to the most recent WM_KEYDOWN message that precedes the posting of the WM_DEADCHAR message.

For enhanced 101- and 102-key keyboards, extended keys are the right ALT and the right CTRL keys on the main section of the keyboard; the INS, DEL, HOME, END, PAGE UP, PAGE DOWN and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and ENTER keys in the numeric keypad. Some other keyboards may support the extended-key bit in the lParam parameter.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, TranslateMessage, WM_KEYDOWN, WM_KEYUP, WM_SYSDEADCHAR

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, TranslateMessage, WM_KEYDOWN, WM_KEYUP, WM_SYSDEADCHAR

 

 

 

   

Platform SDK: Windows User Interface

WM_SYSKEYDOWN

The WM_SYSKEYDOWN message is posted to the window with the keyboard focus when the user presses the F10 key (which activates the menu bar) or holds down the ALT key and then presses another key. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYDOWN message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lParam parameter.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_SYSKEYDOWN

  WPARAM wParam,   // virtual-key code

  LPARAM lParam    // key data

);

Parameters

wParam

Specifies the virtual-key code of the key being pressed.

lParam

Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table.

Value

Description

0–15

Specifies the repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.

16–23

Specifies the scan code. The value depends on the original equipment manufacturer (OEM).

24

Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.

25–28

Reserved; do not use.

29

Specifies the context code. The value is 1 if the ALT key is down while the key is pressed; it is 0 if the WM_SYSKEYDOWN message is posted to the active window because no window has the keyboard focus.

30

Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.

31

Specifies the transition state. The value is always 0 for a WM_SYSKEYDOWN message.

 

Return Values

An application should return zero if it processes this message.

Remarks

The DefWindowProc function examines the specified key and generates a WM_SYSCOMMAND message if the key is either TAB or ENTER.

When the context code is zero, the message can be passed to the TranslateAccelerator function, which will handle it as though it were a normal key message instead of a character-key message. This allows accelerator keys to be used with the active window even if the active window does not have the keyboard focus.

Because of automatic repeat, more than one WM_SYSKEYDOWN message may occur before a WM_SYSKEYUP message is sent. The previous key state (bit 30) can be used to determine whether the WM_SYSKEYDOWN message indicates the first down transition or a repeated down transition.

For enhanced 101- and 102-key keyboards, enhanced keys are the right ALT and CTRL keys on the main section of the keyboard; the INS, DEL, HOME, END, PAGE UP, PAGE DOWN, and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and ENTER keys in the numeric keypad. Other keyboards may support the extended-key bit in the lParam parameter.

This message is also sent whenever the user presses the F10 key without the ALT key.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, DefWindowProc, TranslateAccelerator, WM_SYSCOMMAND, WM_SYSKEYUP

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, DefWindowProc, TranslateAccelerator, WM_SYSCOMMAND, WM_SYSKEYUP

 

 

 

   

Platform SDK: Windows User Interface

WM_SYSKEYUP

The WM_SYSKEYUP message is posted to the window with the keyboard focus when the user releases a key that was pressed while the ALT key was held down. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYUP message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lParam parameter.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_SYSKEYUP

  WPARAM wParam,   // virtual-key code

  LPARAM lParam    // key data

);

Parameters

wParam

Specifies the virtual-key code of the key being released.

lParam

Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table.

Value

Description

0–15

Specifies the repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. The repeat count is always one for a WM_SYSKEYUP message.

16–23

Specifies the scan code. The value depends on the original equipment manufacturer (OEM).

24

Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is zero.

25–28

Reserved; do not use.

29

Specifies the context code. The value is 1 if the ALT key is down while the key is released; it is zero if the WM_SYSKEYDOWN message is posted to the active window because no window has the keyboard focus.

30

Specifies the previous key state. The value is always 1 for a WM_SYSKEYUP message.

31

Specifies the transition state. The value is always 1 for a WM_SYSKEYUP message.

 

Return Values

An application should return zero if it processes this message.

Remarks

The DefWindowProc function sends a WM_SYSCOMMAND message to the top-level window if the F10 key or the ALT key was released. The wParam parameter of the message is set to SC_KEYMENU.

When the context code is zero, the message can be passed to the TranslateAccelerator function, which will handle it as though it were a normal key message instead of a character-key message. This allows accelerator keys to be used with the active window even if the active window does not have the keyboard focus.

For enhanced 101- and 102-key keyboards, extended keys are the right ALT and CTRL keys on the main section of the keyboard; the INS, DEL, HOME, END, PAGE UP, PAGE DOWN, and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and ENTER keys in the numeric keypad. Other keyboards may support the extended-key bit in the lParam parameter.

For non-U.S. enhanced 102-key keyboards, the right ALT key is handled as a CTRL+ALT key. The following table shows the sequence of messages that result when the user presses and releases this key.

Message

Virtual-key code

WM_KEYDOWN

VK_CONTROL

WM_KEYDOWN

VK_MENU

WM_KEYUP

VK_CONTROL

WM_SYSKEYUP

VK_MENU

 

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, DefWindowProc, TranslateAccelerator, WM_SYSCOMMAND, WM_SYSKEYDOWN

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, DefWindowProc, TranslateAccelerator, WM_SYSCOMMAND, WM_SYSKEYDOWN

 

 

 

   

Platform SDK: Windows User Interface

WM_SYSCHAR

The WM_SYSCHAR message is posted to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. It specifies the character code of a system character key — that is, a character key that is pressed while the ALT key is down.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_SYSCHAR

  WPARAM wParam,   // character code (TCHAR)

  LPARAM lParam    // key data

);

Parameters

wParam

Specifies the character code of the window menu key.

lParam

Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table.

Value

Meaning

0–15

Specifies the repeat count for the current message. The value is the number of times the keystroke was auto-repeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.

16–23

Specifies the scan code. The value depends on the original equipment manufacturer (OEM).

24

Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.

25–28

Reserved; do not use.

29

Specifies the context code. The value is 1 if the ALT key is held down while the key is pressed; otherwise, the value is 0.

30

Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.

31

Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed.

 

Return Values

An application should return zero if it processes this message.

Remarks

When the context code is zero, the message can be passed to the TranslateAccelerator function, which will handle it as though it were a standard key message instead of a system character-key message. This allows accelerator keys to be used with the active window even if the active window does not have the keyboard focus.

For enhanced 101- and 102-key keyboards, extended keys are the right ALT and CTRL keys on the main section of the keyboard; the INS, DEL, HOME, END, PAGE UP, PAGE DOWN and arrow keys in the clusters to the left of the numeric keypad; the PRINT SCRN key; the BREAK key; the NUMLOCK key; and the divide (/) and ENTER keys in the numeric keypad. Other keyboards may support the extended-key bit in the lParam parameter.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Accelerators Overview, Keyboard Accelerator Messages, TranslateAccelerator, TranslateMessage, WM_SYSKEYDOWN

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Accelerators Overview, Keyboard Accelerator Messages, TranslateAccelerator, TranslateMessage, WM_SYSKEYDOWN

 

 

 

   

Platform SDK: Windows User Interface

WM_SYSDEADCHAR

The WM_SYSDEADCHAR message is sent to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. WM_SYSDEADCHAR specifies the character code of a system dead key — that is, a dead key that is pressed while holding down the ALT key.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_SYSDEADCHAR

  WPARAM wParam,   // character code (TCHAR)

  LPARAM lParam    // key data

);

Parameters

wParam

Specifies the character code generated by the system dead key — that is, a dead key that is pressed while holding down the ALT key.

lParam

Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table.

Value

Description

0–15

Specifies the repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.

16–23

Specifies the scan code. The value depends on the original equipment manufacturer (OEM).

24

Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.

25–28

Reserved; do not use.

29

Specifies the context code. The value is 1 if the ALT key is held down while the key is pressed; otherwise, the value is 0.

30

Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.

31

Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed.

 

Return Values

An application should return zero if it processes this message.

Remarks

For enhanced 101- and 102-key keyboards, extended keys are the right ALT and CTRL keys on the main section of the keyboard; the INS, DEL, HOME, END, PAGE UP, PAGE DOWN, and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and ENTER keys in the numeric keypad. Other keyboards may support the extended-key bit in the lParam parameter.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, TranslateMessage, WM_DEADCHAR, WM_SYSKEYDOWN

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, TranslateMessage, WM_DEADCHAR, WM_SYSKEYDOWN

 

 

 

   

Platform SDK: International Features

WM_IME_COMPOSITION

The WM_IME_COMPOSITION message is sent to an application when the IME changes composition status as a result of a keystroke. An application should process this message if it displays composition characters itself. Otherwise, it should send the message to the IME window.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  WM_IME_COMPOSITION,   // message

  WPARAM wParam,   // DBCS character

  LPARAM lParam    // change indicator

);

Parameters

wParam

DBCS character representing the latest change to the composition string.

lParam

Specifies how the composition string or character changed. This parameter can be one or more of the following values:

GCS_COMPATTR
GCS_COMPCLAUSE
GCS_COMPREADSTR
GCS_COMPREADATTR
GCS_COMPREADCLAUSE
GCS_COMPSTR
GCS_CURSORPOS
GCS_DELTASTART
GCS_RESULTCLAUSE
GCS_RESULTREADCLAUSE
GCS_RESULTREADSTR
GCS_RESULTSTR

For more information about these values, see IME Composition String Values.

The lParam parameter can also be one or more of the following values.

Value

Meaning

CS_INSERTCHAR

The wParam composition character should be inserted at the current insertion point. An application should display the composition character if it processes this message.

CS_NOMOVECARET

The application must not move the caret position as a result of processing the message. For example, if an IME specifies a combination of CS_INSERTCHAR and CS_NOMOVECARET, the application should insert the specified character at the current caret position but should not move caret to the next position. A subsequent WM_IME_COMPOSITION message with GCS_RESULTSTR will replace this character.

 

Return Values

This message has no return value.

Remarks

If the application has created an IME window, it should pass this message to that window. The DefWindowProc function processes this message by passing it to the default IME window. The IME window processes this message by updating its appearance based on the change flag specified. An application can call ImmGetCompositionString to retrieve the new composition status.

If none of the GCS_ values are set, the message indicates that the current composition has been canceled and applications that draw the composition string should delete the string.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Imm.h; include Windows.h.

See Also

Input Method Editor Overview, Input Method Editor Messages, DefWindowProc, ImmGetCompositionString

Built on Tuesday, November 07, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Imm.h; include Windows.h.

See Also

Input Method Editor Overview, Input Method Editor Messages, DefWindowProc, ImmGetCompositionString

 

 

 

   

Platform SDK: Windows User Interface

WM_INITDIALOG

The WM_INITDIALOG message is sent to the dialog box procedure immediately before a dialog box is displayed. Dialog box procedures typically use this message to initialize controls and carry out any other initialization tasks that affect the appearance of the dialog box.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_INITDIALOG

  WPARAM wParam,   // handle to control (HWND)

  LPARAM lParam    // initialization parameter

);

Parameters

wParam

Handle to the control to receive the default keyboard focus. The system assigns the default keyboard focus only if the dialog box procedure returns TRUE.

lParam

Specifies additional initialization data. This data is passed to the system as the lParam parameter in a call to the CreateDialogIndirectParam, CreateDialogParam, DialogBoxIndirectParam, or DialogBoxParam function used to create the dialog box. For property sheets, this parameter is a pointer to the PROPSHEETPAGE structure used to create the page. This parameter is zero if any other dialog box creation function is used.

Return Values

The dialog box procedure should return TRUE to direct the system to set the keyboard focus to the control specified by wParam. Otherwise, it should return FALSE to prevent the system from setting the default keyboard focus.

The dialog box procedure should return the value directly. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

Remarks

The control to receive the default keyboard focus is always the first control in the dialog box that is visible, not disabled, and that has the WS_TABSTOP style. When the dialog box procedure returns TRUE, the system checks the control to ensure that the procedure has not disabled it. If it has been disabled, the system sets the keyboard focus to the next control that is visible, not disabled, and has the WS_TABSTOP.

An application can return FALSE only if it has set the keyboard focus to one of the controls of the dialog box.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Dialog Boxes Overview, Dialog Box Messages, CreateDialogIndirectParam, CreateDialogParam, DialogBoxIndirectParam, DialogBoxParam, PROPSHEETPAGE, SetFocus

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Dialog Boxes Overview, Dialog Box Messages, CreateDialogIndirectParam, CreateDialogParam, DialogBoxIndirectParam, DialogBoxParam, PROPSHEETPAGE, SetFocus

 

 

 

   

Platform SDK: Windows User Interface

WM_COMMAND

The WM_COMMAND message is sent when the user selects a command item from a menu, when a control sends a notification message to its parent window, or when an accelerator keystroke is translated.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  WM_COMMAND,      // the message to send

  WPARAM wParam,   // notification code and identifier

  LPARAM lParam    // handle to control (HWND)

);

Parameters

wParam

The high-order word specifies the notification code if the message is from a control. If the message is from an accelerator, this value is 1. If the message is from a menu, this value is zero.

The low-order word specifies the identifier of the menu item, control, or accelerator.

lParam

Handle to the control sending the message if the message is from a control. Otherwise, this parameter is NULL.

Return Values

If an application processes this message, it should return zero.

Remarks

Accelerator keystrokes that select items from the window menu are translated into WM_SYSCOMMAND messages.

If an accelerator keystroke occurs that corresponds to a menu item when the window that owns the menu is minimized, no WM_COMMAND message is sent. However, if an accelerator keystroke occurs that does not match any of the items in the window's menu or in the window menu, a WM_COMMAND message is sent, even if the window is minimized.

If an application enables a menu separator, the system sends a WM_COMMAND message with the low-word of the wParam parameter set to zero when the user selects the separator.

Windows 98, Windows 2000: If a menu is defined with a MENUINFO.dwStyle value of MNS_NOTIFYBYPOS, WM_MENUCOMMAND is sent instead of WM_COMMAND.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages, HIWORD, LOWORD, MENUINFO, WM_MENUCOMMAND, WM_SYSCOMMAND

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages, HIWORD, LOWORD, MENUINFO, WM_MENUCOMMAND, WM_SYSCOMMAND

 

 

 

   

Platform SDK: Windows User Interface

WM_SYSCOMMAND

A window receives this message when the user chooses a command from the window menu (formerly known as the system or control menu) or when the user chooses the maximize button, minimize button, restore button, or close button.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_SYSCOMMAND

  WPARAM wParam,   // system command type

  LPARAM lParam    // horizontal and vertical position

);

Parameters

wParam

Specifies the type of system command requested. This parameter can be one of the following values.

Value

Meaning

SC_CLOSE

Closes the window.

SC_CONTEXTHELP

Changes the cursor to a question mark with a pointer. If the user then clicks a control in the dialog box, the control receives a WM_HELP message.

SC_DEFAULT

Selects the default item; the user double-clicked the window menu.

SC_HOTKEY

Activates the window associated with the application-specified hot key. The lParam parameter identifies the window to activate.

SC_HSCROLL

Scrolls horizontally.

SC_KEYMENU

Retrieves the window menu as a result of a keystroke. For more information, see the Remarks section.

SC_MAXIMIZE

Maximizes the window.

SC_MINIMIZE

Minimizes the window.

SC_MONITORPOWER

Sets the state of the display. This command supports devices that have power-saving features, such as a battery-powered personal computer.

The lParam parameter can have the following values:

1 - the display is going to low power
2 - the display is being shut off

SC_MOUSEMENU

Retrieves the window menu as a result of a mouse click.

SC_MOVE

Moves the window.

SC_NEXTWINDOW

Moves to the next window.

SC_PREVWINDOW

Moves to the previous window.

SC_RESTORE

Restores the window to its normal position and size.

SC_SCREENSAVE

Executes the screen saver application specified in the [boot] section of the System.ini file.

SC_SIZE

Sizes the window.

SC_TASKLIST

Activates the Start menu.

SC_VSCROLL

Scrolls vertically.

 

lParam

The low-order word specifies the horizontal position of the cursor, in screen coordinates, if a window menu command is chosen with the mouse. Otherwise, this parameter is not used.

The high-order word specifies the vertical position of the cursor, in screen coordinates, if a window menu command is chosen with the mouse. This parameter is –1 if the command is chosen using a system accelerator, or zero if using a mnemonic.

Return Values

An application should return zero if it processes this message.

Remarks

To obtain the position coordinates in screen coordinates, use the following code:

xPos = GET_X_LPARAM(lParam);    // horizontal position

yPos = GET_Y_LPARAM(lParam);    // vertical position

The DefWindowProc function carries out the window menu request for the predefined actions specified in the previous table.

In WM_SYSCOMMAND messages, the four low-order bits of the wParam parameter are used internally by the system. To obtain the correct result when testing the value of wParam, an application must combine the value 0xFFF0 with the wParam value by using the bitwise AND operator.

The menu items in a window menu can be modified by using the GetSystemMenu, AppendMenu, InsertMenu, ModifyMenu, InsertMenuItem, and SetMenuItem functions. Applications that modify the window menu must process WM_SYSCOMMAND messages.

An application can carry out any system command at any time by passing a WM_SYSCOMMAND message to DefWindowProc. Any WM_SYSCOMMAND messages not handled by the application must be passed to DefWindowProc. Any command values added by an application must be processed by the application and cannot be passed to DefWindowProc.

Accelerator keys that are defined to choose items from the window menu are translated into WM_SYSCOMMAND messages; all other accelerator keystrokes are translated into WM_COMMAND messages.

If the wParam is SC_KEYMENU, lParam contains the character code of the key that is used with the ALT key to display the popup menu. For example, pressing ALT+F to display the File popup will cause a WM_SYSCOMMAND with wParam equal to SC_KEYMENU and lParam equal to 'f'.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Accelerators Overview, Keyboard Accelerator Messages, AppendMenu, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, GetSystemMenu, InsertMenu, ModifyMenu, WM_COMMAND

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Accelerators Overview, Keyboard Accelerator Messages, AppendMenu, DefWindowProc, GET_X_LPARAM, GET_Y_LPARAM, GetSystemMenu, InsertMenu, ModifyMenu, WM_COMMAND

 

 

 

   

Platform SDK: Windows User Interface

WM_TIMER

The WM_TIMER message is posted to the installing thread's message queue when a timer expires. The message is posted by the GetMessage or PeekMessage function.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_TIMER

  WPARAM wParam,   // timer identifier

  LPARAM lParam    // timer callback (TIMERPROC)

);

Parameters

wParam

Specifies the timer identifier.

lParam

Pointer to an application-defined callback function that was passed to the SetTimer function when the timer was installed.

Return Values

An application should return zero if it processes this message.

Remarks

You can process the message by providing a WM_TIMER case in the window procedure. Otherwise, the default window procedure will call the TimerProc callback function specified in the call to the SetTimer function used to install the timer.

The WM_TIMER message is a low-priority message. The GetMessage and PeekMessage functions post this message only when no other higher-priority messages are in the thread's message queue.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Timers Overview, Timer Messages, GetMessage, PeekMessage, SetTimer, TimerProc

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Timers Overview, Timer Messages, GetMessage, PeekMessage, SetTimer, TimerProc

 

 

 

   

Platform SDK: Windows User Interface

WM_HSCROLL

The WM_HSCROLL message is sent to a window when a scroll event occurs in the window's standard horizontal scroll bar. This message is also sent to the owner of a horizontal scroll bar control when a scroll event occurs in the control.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_HSCROLL

  WPARAM wParam,   // request and position

  LPARAM lParam    // handle to scroll bar (HWND)

);

Parameters

wParam

The low-order word specifies a scroll bar value that indicates the user's scrolling request. This word can be one of the following values.

Value

Meaning

SB_ENDSCROLL

Ends scroll.

SB_LEFT

Scrolls to the upper left.

SB_RIGHT

Scrolls to the lower right.

SB_LINELEFT

Scrolls left by one unit.

SB_LINERIGHT

Scrolls right by one unit.

SB_PAGELEFT

Scrolls left by the width of the window.

SB_PAGERIGHT

Scrolls right by the width of the window.

SB_THUMBPOSITION

The user has dragged the scroll box (thumb) and released the mouse button. The high-order word indicates the position of the scroll box at the end of the drag operation.

SB_THUMBTRACK

The user is dragging the scroll box. This message is sent repeatedly until the user releases the mouse button. The high-order word indicates the position that the scroll box has been dragged to.

 

The high-order word specifies the current position of the scroll box if the low-order word is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, this word is not used.

lParam

If the message is sent by a scroll bar, then this parameter is the handle to the scroll bar control. If the message is not sent by a scroll bar, this parameter is NULL.

Return Values

If an application processes this message, it should return zero.

Remarks

The SB_THUMBTRACK request code is typically used by applications that provide feedback as the user drags the scroll box.

If an application scrolls the content of the window, it must also reset the position of the scroll box by using the SetScrollPos function.

Note that the WM_HSCROLL message carries only 16 bits of scroll box position data. Thus, applications that rely solely on WM_HSCROLL (and WM_VSCROLL) for scroll position data have a practical maximum position value of 65,535.

However, because the SetScrollInfo, SetScrollPos, SetScrollRange, GetScrollInfo, GetScrollPos, and GetScrollRange functions support 32-bit scroll bar position data, there is a way to circumvent the 16-bit barrier of the WM_HSCROLL and WM_VSCROLL messages. See GetScrollInfo for a description of the technique.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Scroll Bars Overview, Scroll Bar Messages, GetScrollInfo, GetScrollPos, GetScrollRange, SetScrollInfo, SetScrollPos, SetScrollRange, WM_VSCROLL

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Scroll Bars Overview, Scroll Bar Messages, GetScrollInfo, GetScrollPos, GetScrollRange, SetScrollInfo, SetScrollPos, SetScrollRange, WM_VSCROLL

 

 

 

   

Platform SDK: Windows User Interface

WM_VSCROLL

The WM_VSCROLL message is sent to a window when a scroll event occurs in the window's standard vertical scroll bar. This message is also sent to the owner of a vertical scroll bar control when a scroll event occurs in the control.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_VSCROLL

  WPARAM wParam,   // request and position

  LPARAM lParam    // handle to scroll bar (HWND)

);

Parameters

wParam

The low-order word specifies a scroll bar value that indicates the user's scrolling request. This parameter can be one of the following values.

Value

Meaning

SB_BOTTOM

Scrolls to the lower right.

SB_ENDSCROLL

Ends scroll.

SB_LINEDOWN

Scrolls one line down.

SB_LINEUP

Scrolls one line up.

SB_PAGEDOWN

Scrolls one page down.

SB_PAGEUP

Scrolls one page up.

SB_THUMBPOSITION

The user has dragged the scroll box (thumb) and released the mouse button. The high-order word indicates the position of the scroll box at the end of the drag operation.

SB_THUMBTRACK

The user is dragging the scroll box. This message is sent repeatedly until the user releases the mouse button. The high-order word indicates the position that the scroll box has been dragged to.

SB_TOP

Scrolls to the upper left.

 

The high-order word specifies the current position of the scroll box if the high-order word is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, this word is not used.

lParam

If the message is sent by a scroll bar, this parameter is the handle to the scroll bar control. If the message is not sent by a scroll bar, this parameter is NULL.

Return Values

If an application processes this message, it should return zero.

Remarks

The SB_THUMBTRACK request code is typically used by applications that provide feedback as the user drags the scroll box.

If an application scrolls the content of the window, it must also reset the position of the scroll box by using the SetScrollPos function.

Note that the WM_VSCROLL message carries only 16 bits of scroll box position data. Thus, applications that rely solely on WM_VSCROLL (and WM_HSCROLL) for scroll position data have a practical maximum position value of 65,535.

However, because the SetScrollInfo, SetScrollPos, SetScrollRange, GetScrollInfo, GetScrollPos, and GetScrollRange functions support 32-bit scroll bar position data, there is a way to circumvent the 16-bit barrier of the WM_HSCROLL and WM_VSCROLL messages. See GetScrollInfo for a description of the technique.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Scroll Bars Overview, Scroll Bar Messages, GetScrollInfo, GetScrollPos, GetScrollRange, SetScrollInfo, SetScrollPos, SetScrollRange, WM_HSCROLL

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Scroll Bars Overview, Scroll Bar Messages, GetScrollInfo, GetScrollPos, GetScrollRange, SetScrollInfo, SetScrollPos, SetScrollRange, WM_HSCROLL

 

 

 

   

Platform SDK: Windows User Interface

WM_INITMENU

The WM_INITMENU message is sent when a menu is about to become active. It occurs when the user clicks an item on the menu bar or presses a menu key. This allows the application to modify the menu before it is displayed.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_INITMENU

  WPARAM wParam,   // handle to menu (HMENU)

  LPARAM lParam    // not used

);

Parameters

wParam

Handle to the menu to be initialized.

lParam

This parameter is not used.

Return Values

If an application processes this message, it should return zero.

Remarks

A WM_INITMENU message is sent only when a menu is first accessed; only one WM_INITMENU message is generated for each access. For example, moving the mouse across several menu items while holding down the button does not generate new messages. WM_INITMENU does not provide information about menu items.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Accelerators Overview, Keyboard Accelerator Messages, WM_INITMENUPOPUP

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Accelerators Overview, Keyboard Accelerator Messages, WM_INITMENUPOPUP

 

 

 

   

Platform SDK: Windows User Interface

WM_INITMENUPOPUP

The WM_INITMENUPOPUP message is sent when a drop-down menu or submenu is about to become active. This allows an application to modify the menu before it is displayed, without changing the entire menu.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_INITMENUPOPUP

  WPARAM wParam,   // handle to menu (HMENU)

  LPARAM lParam    // item position and indicator

);

Parameters

wParam

Handle to the drop-down menu or submenu.

lParam

The low-order word specifies the zero-based relative position of the menu item that opens the drop-down menu or submenu.

The high-order word indicates whether the drop-down menu is the window menu. If the menu is the window menu, this parameter is TRUE; otherwise, it is FALSE.

Return Values

If an application processes this message, it should return zero.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Accelerators Overview, Keyboard Accelerator Messages, HIWORD, LOWORD, WM_INITMENU

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Accelerators Overview, Keyboard Accelerator Messages, HIWORD, LOWORD, WM_INITMENU

 

 

 

   

Platform SDK: Windows User Interface

WM_MENUSELECT

The WM_MENUSELECT message is sent to a menu's owner window when the user selects a menu item.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_MENUSELECT

  WPARAM wParam,   // menu item (UINT) and flags (UINT)

  LPARAM lParam    // handle to menu (HMENU)

);

Parameters

wParam

The low-order word specifies the menu item or submenu index. If the selected item is a command item, this parameter contains the identifier of the menu item. If the selected item opens a drop-down menu or submenu, this parameter contains the index of the drop-down menu or submenu in the main menu, and the lParam parameter contains the handle to the main (clicked) menu; use the GetSubMenu function to get the menu handle to the drop-down menu or submenu.

The high-order word specifies one or more menu flags. This parameter can be one or more of the following values.

Value

Description

MF_BITMAP

Item displays a bitmap.

MF_CHECKED

Item is checked.

MF_DISABLED

Item is disabled.

MF_GRAYED

Item is grayed.

MF_HILITE

Item is highlighted.

MF_MOUSESELECT

Item is selected with the mouse.

MF_OWNERDRAW

Item is an owner-drawn item.

MF_POPUP

Item opens a drop-down menu or submenu.

MF_SYSMENU

Item is contained in the window menu. The lParam parameter contains a handle to the menu associated with the message.

 

lParam

Handle to the menu that was clicked.

Return Values

If an application processes this message, it should return zero.

Remarks

If the high-order word of wParam contains 0xFFFF and the lParam parameter contains NULL, the system has closed the menu.

Do not use the value –1 for the high-order word of wParam, because this value is specified as (UINT) HIWORD(wParam). If the value is 0xFFFF, it would be interpreted as 0x0000FFFF, not –1, because of the cast to a UINT.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Accelerators Overview, Keyboard Accelerator Messages, GetSubMenu, HIWORD, LOWORD

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Accelerators Overview, Keyboard Accelerator Messages, GetSubMenu, HIWORD, LOWORD

 

 

 

   

Platform SDK: Windows User Interface

WM_MENUCHAR

The WM_MENUCHAR message is sent when a menu is active and the user presses a key that does not correspond to any mnemonic or accelerator key. This message is sent to the window that owns the menu.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_MENUCHAR

  WPARAM wParam,   // character code (TCHAR), type

  LPARAM lParam    // handle to menu (HMENU)

);

Parameters

wParam

The low-order word specifies the character code that corresponds to the key the user pressed.

The high-order word specifies the active menu type. This parameter can be one of the following values.

Value

Meaning

MF_POPUP

A drop-down menu, submenu, or shortcut menu.

MF_SYSMENU

The window menu.

 

lParam

Handle to the active menu.

Return Values

An application that processes this message should return one of the following values in the high-order word of the return value.

Value

Meaning

MNC_IGNORE

Informs the system that it should discard the character the user pressed and create a short beep on the system speaker.

MNC_CLOSE

Informs the system that it should close the active menu.

MNC_EXECUTE

Informs the system that it should choose the item specified in the low-order word of the return value. The owner window receives a WM_COMMAND message.

MNC_SELECT

Informs the system that it should select the item specified in the low-order word of the return value.

 

Remarks

The low-order word is ignored if the high-order word contains 0 or 1.

An application should process this message when an accelerator is used to select a menu item that displays a bitmap.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Accelerators Overview, Keyboard Accelerator Messages, HIWORD, LOWORD

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Accelerators Overview, Keyboard Accelerator Messages, HIWORD, LOWORD

 

 

 

   

Platform SDK: Windows User Interface

WM_ENTERIDLE

The WM_ENTERIDLE message is sent to the owner window of a modal dialog box or menu that is entering an idle state. A modal dialog box or menu enters an idle state when no messages are waiting in its queue after it has processed one or more previous messages.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_ENTERIDLE

  WPARAM wParam,   // idle reason

  LPARAM lParam    // handle to dialog box or owner (HWND)

);

Parameters

wParam

Specifies whether the message is the result of a dialog box or a menu being displayed. This parameter can be one of the following values.

Value

Meaning

MSGF_DIALOGBOX

The system is idle because a dialog box is displayed.

MSGF_MENU

The system is idle because a menu is displayed.

 

lParam

Handle to the dialog box (if wParam is MSGF_DIALOGBOX) or window containing the displayed menu (if wParam is MSGF_MENU).

Return Values

An application should return zero if it processes this message.

Remarks

You can suppress the WM_ENTERIDLE message for a dialog box by creating the dialog box with the DS_NOIDLEMSG style.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Dialog Boxes Overview, Dialog Box Messages, DefWindowProc

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Dialog Boxes Overview, Dialog Box Messages, DefWindowProc

 

 

 

   

Platform SDK: Windows User Interface

WM_MENURBUTTONUP

The WM_MENURBUTTONUP message is sent when the user releases the right mouse button while the cursor is on a menu item.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  WM_MENURBUTTONUP,   // message to send

  WPARAM wParam,   // mouse release position

  LPARAM lParam    // handle to menu (HMENU)

);

Parameters

wParam

Specifies the position of the item when the mouse was released.

lParam

Handle to the menu containing the item.

Remarks

The WM_MENURBUTTONUP message allows applications to provide a context-sensitive menu—also known as a shortcut menu—for the menu item specified in this message. To display a context-sensitive menu for a menu item, call the TrackPopupMenuEx function with TPM_RECURSE.

Requirements

  Windows NT/2000: Requires Windows 2000 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows 2000 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages

 

 

 

   

Platform SDK: Windows User Interface

WM_MENUDRAG

The WM_MENUDRAG message is sent to the owner of a drag-and-drop menu when the user drags a menu item.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  WM_MENUDRAG,     // message to send

  WPARAM wParam,   // starting position

  LPARAM lParam    // handle to menu (HMENU)

);

Parameters

wParam

Specifies the position of the item where the drag operation began.

lParam

Handle to the menu containing the item.

Return Values

The application should return one of the following values.

Value

Meaning

MND_CONTINUE

Menu should remain active. If the mouse is released, it should be ignored.

MND_ENDMENU

Menu should be ended.

 

Remarks

The application can call the DoDragDrop function in response to this message.

To create a drag-and-drop menu, call SetMenuInfo with MNS_DRAGDROP.

Requirements

  Windows NT/2000: Requires Windows 2000 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages, , SetMenuInfo

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows 2000 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages, , SetMenuInfo

 

 

 

   

Platform SDK: Windows User Interface

WM_MENUGETOBJECT

The WM_MENUGETOBJECT message is sent to the owner of a drag-and-drop menu when the mouse cursor enters a menu item or moves from the center of the item to the top or bottom of the item.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  WM_MENUGETOBJECT,   // message to send

  WPARAM wParam,   // not used

  LPARAM lParam    // menu information (PMENUGETOBJECTINFO)

);

Parameters

wParam

This parameter is not used.

lParam

Pointer to a MENUGETOBJECTINFO structure.

Return Values

The application should return one of the following values.

Values

Meaning

MNGO_NOERROR

An interface pointer was returned in the pvObj member of MENUGETOBJECTINFO

MNGO_NOINTERFACE

The interface is not supported.

 

Requirements

  Windows NT/2000: Requires Windows 2000 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows 2000 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages

 

 

 

   

Platform SDK: Windows User Interface

WM_UNINITMENUPOPUP

The WM_UNINITMENUPOPUP message is sent when a drop-down menu or submenu has been destroyed.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  WM_UNINITMENUPOPUP,   // message to send

  WPARAM wParam,   // handle to menu (HMENU)

  LPARAM lParam    // menu identifier

);

Parameters

wParam

Handle to the menu

lParam

The high-order word identifies the menu that was destroyed. Currently, it can only be MF_SYSMENU (the window menu).

Remarks

If an application receives a WM_INITMENUPOPUP message, it will receive a WM_UNINITMENUPOPUP message.

Requirements

  Windows NT/2000: Requires Windows 2000 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages, , HIWORD

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows 2000 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages, , HIWORD

 

 

 

   

Platform SDK: Windows User Interface

WM_MENUCOMMAND

The WM_MENUCOMMAND message is sent when the user makes a selection from a menu.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  WM_MENUCOMMAND,    // message to send

  WPARAM wParam,   // item index

  LPARAM lParam    // handle to menu (HMENU)

);

Parameters

wParam

Specifies the zero-based index of the item selected.

Windows 98: The high word is the zero-based index of the item selected. The low word is the item ID.

lParam

Handle to the menu for the item selected.

Remarks

The WM_MENUCOMMAND message gives you a handle to the menu--so you can access the menu data in the MENUINFO structure—and also gives you the index of the selected item, which is typically what applications need. In contrast, the WM_COMMAND message gives you the menu item identifier.

The WM_MENUCOMMAND message is sent only for menus that are defined with the MNS_NOTIFYBYPOS flag set in the dwStyle member of the MENUINFO structure.

Requirements

  Windows NT/2000: Requires Windows 2000 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows 2000 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages

 

 

 

   

Platform SDK: Windows User Interface

WM_CTLCOLOREDIT

An edit control that is not read-only or disabled sends the WM_CTLCOLOREDIT message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the edit control.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_CTLCOLOREDIT

  WPARAM wParam,   // handle to display context (HDC)

  LPARAM lParam    // handle to static control (HWND)

);

Parameters

wParam

Handle to the device context for the edit control window.

lParam

Handle to the edit control.

Return Values

If an application processes this message, it must return the handle of a brush. The system uses the brush to paint the background of the edit control.

Remarks

By default, the DefWindowProc function selects the default system colors for the edit control.

Read-only or disabled edit controls do not send the WM_CTLCOLOREDIT message; instead, they send the WM_CTLCOLORSTATIC message. However, for compatibility purposes, the system sends the WM_CTLCOLOREDIT message for read-only and disabled edit controls if the application was designed for Windows 3.1 or earlier.

The system does not automatically destroy the returned brush. It is the application's responsibility to destroy the brush when it is no longer needed.

The WM_CTLCOLOREDIT message is never sent between threads, it is only sent within the same thread.

If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

Rich Edit: This message is not supported. To set the background color for a rich edit control, use the EM_SETBKGNDCOLOR message.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Edit Controls Overview, Edit Control Messages, DefWindowProc, EM_SETBKGNDCOLOR, RealizePalette, SelectPalette, WM_CTLCOLORSTATIC

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Edit Controls Overview, Edit Control Messages, DefWindowProc, EM_SETBKGNDCOLOR, RealizePalette, SelectPalette, WM_CTLCOLORSTATIC

 

 

 

   

Platform SDK: Windows User Interface

WM_CTLCOLORLISTBOX

The WM_CTLCOLORLISTBOX message is sent to the parent window of a list box before the system draws the list box. By responding to this message, the parent window can set the text and background colors of the list box by using the specified display device context handle.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_CTLCOLORLISTBOX

  WPARAM wParam,   // handle to DC (HDC)

  LPARAM lParam    // handle to list box (HWND)

);

Parameters

wParam

Handle to the device context for the list box.

lParam

Handle to the list box.

Return Values

If an application processes this message, it must return a handle to a brush. The system uses the brush to paint the background of the list box.

Remarks

By default, the DefWindowProc function selects the default system colors for the list box.

The system does not automatically destroy the returned brush. It is the application's responsibility to destroy the brush when it is no longer needed.

The WM_CTLCOLORLISTBOX message is never sent between threads. It is sent only within one thread.

If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

List Boxes Overview, List Box Messages, DefWindowProc, RealizePalette, SelectPalette

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

List Boxes Overview, List Box Messages, DefWindowProc, RealizePalette, SelectPalette

 

 

 

   

Platform SDK: Windows User Interface

WM_CTLCOLORBTN

The WM_CTLCOLORBTN message is sent to the parent window of a button before drawing the button. The parent window can change the button's text and background colors. However, only owner-drawn buttons respond to the parent window processing this message.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_CTLCOLORBTN

  WPARAM wParam,   // handle to button display context (HDC)

  LPARAM lParam    // handle to button (HWND)

);

Parameters

wParam

Handle to the display context for the button.

lParam

Handle to the button.

Return Values

If an application processes this message, it must return a handle to a brush. The system uses the brush to paint the background of the button.

Remarks

By default, the DefWindowProc function selects the default system colors for the button. Buttons with the BS_PUSHBUTTON, BS_DEFPUSHBUTTON, or BS_PUSHLIKE styles do not use the returned brush. Buttons with these styles are always drawn with the default system colors. Drawing push buttons requires several different brushes-face, highlight and shadow-but the WM_CTLCOLORBTN message allows only one brush to be returned. To provide a custom appearance for push buttons, use an owner-drawn button.

The system does not automatically destroy the returned brush. It is the application's responsibility to destroy the brush when it is no longer needed.

The WM_CTLCOLORBTN message is never sent between threads. It is sent only within one thread.

The text color of a check box or radio button applies to the box or button, its check mark, and the text. The focus rectangle for these buttons remains the system default color (typically black). The text color of a group box applies to the text but not to the line that defines the box. The text color of a push button applies only to its focus rectangle; it does not affect the color of the text.

If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Buttons Overview, Button Messages, DefWindowProc, RealizePalette, SelectPalette,

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Buttons Overview, Button Messages, DefWindowProc, RealizePalette, SelectPalette,

 

 

 

   

Platform SDK: Windows User Interface

WM_CTLCOLORDLG

The WM_CTLCOLORDLG message is sent to a dialog box before the system draws the dialog box. By responding to this message, the dialog box can set its text and background colors using the specified display device context handle.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_CTLCOLORDLG

  WPARAM wParam,   // handle to DC (HDC)

  LPARAM lParam    // handle to dialog box (HWND)

);

Parameters

wParam

Handle to the device context for the dialog box.

lParam

Handle to the dialog box.

Return Values

If an application processes this message, it must return a handle to a brush. The system uses the brush to paint the background of the dialog box.

Remarks

By default, the DefWindowProc function selects the default system colors for the dialog box.

The system does not automatically destroy the returned brush. It is the application's responsibility to destroy the brush when it is no longer needed.

The WM_CTLCOLORDLG message is never sent between threads. It is sent only within one thread.

Note that the WM_CTLCOLORDLG message is sent to the dialog box itself; all of the other WM_CTLCOLOR* messages are sent to the owner of the control.

If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Dialog Boxes Overview, Dialog Box Messages, DefWindowProc, RealizePalette, SelectPalette, SetWindowLong

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Dialog Boxes Overview, Dialog Box Messages, DefWindowProc, RealizePalette, SelectPalette, SetWindowLong

 

 

 

   

Platform SDK: Windows User Interface

WM_CTLCOLORSTATIC

A static control, or an edit control that is read-only or disabled, sends the WM_CTLCOLORSTATIC message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the static control.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_CTLCOLORSTATIC

  WPARAM wParam,   // handle to DC (HDC)

  LPARAM lParam    // handle to static control (HWND)

);

Parameters

wParam

Handle to the device context for the static control window.

lParam

Handle to the static control.

Return Values

If an application processes this message, the return value is a handle to a brush that the system uses to paint the background of the static control.

Remarks

By default, the DefWindowProc function selects the default system colors for the static control.

Edit controls that are not read-only or disabled do not send the WM_CTLCOLORSTATIC message; instead, they send the WM_CTLCOLOREDIT message. However, for compatibility purposes, the system sends the WM_CTLCOLOREDIT message for read-only and disabled edit controls if the application was designed for Windows 3.1 or earlier.

The system does not automatically destroy the returned brush. It is the application's responsibility to destroy the brush when it is no longer needed.

The WM_CTLCOLORSTATIC message is never sent between threads; it is sent only within the same thread.

If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Static Controls Overview, Static Control Messages, DefWindowProc, RealizePalette, SelectPalette, WM_CTLCOLORBTN, WM_CTLCOLORDLG, WM_CTLCOLOREDIT, WM_CTLCOLORLISTBOX, WM_CTLCOLORMSGBOX, WM_CTLCOLORSCROLLBAR

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Static Controls Overview, Static Control Messages, DefWindowProc, RealizePalette, SelectPalette, WM_CTLCOLORBTN, WM_CTLCOLORDLG, WM_CTLCOLOREDIT, WM_CTLCOLORLISTBOX, WM_CTLCOLORMSGBOX, WM_CTLCOLORSCROLLBAR

 

 

 

   

Platform SDK: Windows User Interface

WM_MOUSEMOVE

The WM_MOUSEMOVE message is posted to a window when the cursor moves. If the mouse is not captured, the message is posted to the window that contains the cursor. Otherwise, the message is posted to the window that has captured the mouse.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_MOUSEMOVE

  WPARAM wParam,   // key indicators

  LPARAM lParam    // horizontal and vertical position

);

Parameters

wParam

Indicates whether various virtual keys are down. This parameter can be one or more of the following values.

Value

Description

MK_CONTROL

The CTRL key is down.

MK_LBUTTON

The left mouse button is down.

MK_MBUTTON

The middle mouse button is down.

MK_RBUTTON

The right mouse button is down.

MK_SHIFT

The SHIFT key is down.

MK_XBUTTON1

Windows 2000: The first X button is down.

MK_XBUTTON2

Windows 2000: The second X button is down.

 

lParam

The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

Use the following code to obtain the horizontal and vertical position:

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, MAKEPOINTS, POINTS, SetCapture

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, MAKEPOINTS, POINTS, SetCapture

 

 

 

   

Platform SDK: Windows User Interface

WM_LBUTTONDOWN

The WM_LBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_LBUTTONDOWN

  WPARAM wParam,   // key indicator

  LPARAM lParam    // horizontal and vertical position

);

Parameters

wParam

Indicates whether various virtual keys are down. This parameter can be one or more of the following values.

Value

Description

MK_CONTROL

The CTRL key is down.

MK_LBUTTON

The left mouse button is down.

MK_MBUTTON

The middle mouse button is down.

MK_RBUTTON

The right mouse button is down.

MK_SHIFT

The SHIFT key is down.

MK_XBUTTON1

Windows 2000: The first X button is down.

MK_XBUTTON2

Windows 2000: The second X button is down.

 

lParam

The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

Use the following code to obtain the horizontal and vertical position:

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

To detect that the ALT key was pressed, check whether GetKeyState(VK_MENU) < 0. Note, this must not be GetAsyncKeyState.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, GetKeyState, MAKEPOINTS, POINTS, SetCapture, WM_LBUTTONDBLCLK, WM_LBUTTONUP

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, GetKeyState, MAKEPOINTS, POINTS, SetCapture, WM_LBUTTONDBLCLK, WM_LBUTTONUP

 

 

 

   

Platform SDK: Windows User Interface

WM_LBUTTONUP

The WM_LBUTTONUP message is posted when the user releases the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_LBUTTONUP

  WPARAM wParam,   // key indicator

  LPARAM lParam    // horizontal and vertical position

);

Parameters

wParam

Indicates whether various virtual keys are down. This parameter can be one or more of the following values.

Value

Description

MK_CONTROL

The CTRL key is down.

MK_MBUTTON

The middle mouse button is down.

MK_RBUTTON

The right mouse button is down.

MK_SHIFT

The SHIFT key is down.

MK_XBUTTON1

Windows 2000: The first X button is down.

MK_XBUTTON2

Windows 2000: The second X button is down.

 

lParam

The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

Use the following code to obtain the horizontal and vertical position:

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, MAKEPOINTS, POINTS, SetCapture, WM_LBUTTONDBLCLK, WM_LBUTTONDOWN

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, MAKEPOINTS, POINTS, SetCapture, WM_LBUTTONDBLCLK, WM_LBUTTONDOWN

 

 

 

   

Platform SDK: Windows User Interface

WM_LBUTTONDBLCLK

The WM_LBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_LBUTTONDBLCLK

  WPARAM wParam,   // key indicator

  LPARAM lParam    // horizontal and vertical position

);

Parameters

wParam

Indicates whether various virtual keys are down. This parameter can be one or more of the following values.

Value

Description

MK_CONTROL

The CTRL key is down.

MK_LBUTTON

The left mouse button is down.

MK_MBUTTON

The middle mouse button is down.

MK_RBUTTON

The right mouse button is down.

MK_SHIFT

The SHIFT key is down.

MK_XBUTTON1

Windows 2000: The first X button is down.

MK_XBUTTON2

Windows 2000: The second X button is down.

 

lParam

The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

Use the following code to obtain the horizontal and vertical position:

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

Only windows that have the CS_DBLCLKS style can receive WM_LBUTTONDBLCLK messages, which the system generates whenever the user presses, releases, and again presses the left mouse button within the system's double-click time limit. Double-clicking the left mouse button actually generates a sequence of four messages: WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK, and WM_LBUTTONUP.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, GetDoubleClickTime, MAKEPOINTS, POINTS, SetCapture, SetDoubleClickTime, WM_LBUTTONDOWN, WM_LBUTTONUP

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, GetDoubleClickTime, MAKEPOINTS, POINTS, SetCapture, SetDoubleClickTime, WM_LBUTTONDOWN, WM_LBUTTONUP

 

 

 

   

Platform SDK: Windows User Interface

WM_RBUTTONDOWN

The WM_RBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_RBUTTONDOWN

  WPARAM wParam,   // key indicators

  LPARAM lParam    // horizontal and vertical position

);

Parameters

wParam

Indicates whether various virtual keys are down. This parameter can be one or more of the following values.

Value

Description

MK_CONTROL

The CTRL key is down.

MK_LBUTTON

The left mouse button is down.

MK_MBUTTON

The middle mouse button is down.

MK_RBUTTON

The right mouse button is down.

MK_SHIFT

The SHIFT key is down.

MK_XBUTTON1

Windows 2000: The first X button is down.

MK_XBUTTON2

Windows 2000: The second X button is down.

 

lParam

The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

Use the following code to obtain the horizontal and vertical position:

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

To detect that the ALT key was pressed, check whether GetKeyState(VK_MENU) < 0. Note, this must not be GetAsyncKeyState.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, GetKeyState, MAKEPOINTS, POINTS, SetCapture, WM_RBUTTONDBLCLK, WM_RBUTTONUP

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, GetKeyState, MAKEPOINTS, POINTS, SetCapture, WM_RBUTTONDBLCLK, WM_RBUTTONUP

 

 

 

   

Platform SDK: Windows User Interface

WM_RBUTTONUP

The WM_RBUTTONUP message is posted when the user releases the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_RBUTTONUP

  WPARAM wParam,   // key indicators

  LPARAM lParam    // horizontal and vertical position

);

Parameters

wParam

Indicates whether various virtual keys are down. This parameter can be one or more of the following values.

Value

Description

MK_CONTROL

The CTRL key is down.

MK_LBUTTON

The left mouse button is down.

MK_MBUTTON

The middle mouse button is down.

MK_SHIFT

The SHIFT key is down.

MK_XBUTTON1

Windows 2000: The first X button is down.

MK_XBUTTON2

Windows 2000: The second X button is down.

 

lParam

The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

Use the following code to obtain the horizontal and vertical position:

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, MAKEPOINTS, POINTS, SetCapture, WM_RBUTTONDBLCLK, WM_RBUTTONDOWN

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, MAKEPOINTS, POINTS, SetCapture, WM_RBUTTONDBLCLK, WM_RBUTTONDOWN

 

 

 

   

Platform SDK: Windows User Interface

WM_RBUTTONDBLCLK

The WM_RBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_RBUTTONDBLCLK

  WPARAM wParam,   // key indicators

  LPARAM lParam    // horizontal and vertical position

);

Parameters

wParam

Indicates whether various virtual keys are down. This parameter can be one or more of the following values.

Value

Description

MK_CONTROL

The CTRL key is down.

MK_LBUTTON

The left mouse button is down.

MK_MBUTTON

The middle mouse button is down.

MK_RBUTTON

The right mouse button is down.

MK_SHIFT

The SHIFT key is down.

MK_XBUTTON1

Windows 2000: The first X button is down.

MK_XBUTTON2

Windows 2000: The second X button is down.

 

lParam

The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

Only windows that have the CS_DBLCLKS style can receive WM_RBUTTONDBLCLK messages, which the system generates whenever the user presses, releases, and again presses the right mouse button within the system's double-click time limit. Double-clicking the right mouse button actually generates four messages: WM_RBUTTONDOWN, WM_RBUTTONUP, WM_RBUTTONDBLCLK, and WM_RBUTTONUP again.

Use the following code to obtain the horizontal and vertical position:

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, GetDoubleClickTime, MAKEPOINTS, POINTS, SetCapture, SetDoubleClickTime, WM_RBUTTONDOWN, WM_RBUTTONUP

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, GetDoubleClickTime, MAKEPOINTS, POINTS, SetCapture, SetDoubleClickTime, WM_RBUTTONDOWN, WM_RBUTTONUP

 

 

 

   

Platform SDK: Windows User Interface

WM_MBUTTONDOWN

The WM_MBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_MBUTTONDOWN

  WPARAM wParam,   // key indicator

  LPARAM lParam    // horizontal and vertical position

);

Parameters

wParam

Indicates whether various virtual keys are down. This parameter can be one or more of the following values.

Value

Description

MK_CONTROL

The CTRL key is down.

MK_LBUTTON

The left mouse button is down.

MK_MBUTTON

The middle mouse button is down.

MK_RBUTTON

The right mouse button is down.

MK_SHIFT

The SHIFT key is down.

MK_XBUTTON1

Windows 2000: The first X button is down.

MK_XBUTTON2

Windows 2000: The second X button is down.

 

lParam

The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

Use the following code to obtain the horizontal and vertical position:

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

To detect that the ALT key was pressed, check whether GetKeyState(VK_MENU) < 0. Note, this must not be GetAsyncKeyState.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, GetKeyState, MAKEPOINTS, POINTS, SetCapture, WM_MBUTTONDBLCLK, WM_MBUTTONUP

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, GetKeyState, MAKEPOINTS, POINTS, SetCapture, WM_MBUTTONDBLCLK, WM_MBUTTONUP

 

 

 

   

Platform SDK: Windows User Interface

WM_MBUTTONUP

The WM_MBUTTONUP message is posted when the user releases the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_MBUTTONUP

  WPARAM wParam,   // key indicator

  LPARAM lParam    // horizontal and vertical position

);

Parameters

wParam

Indicates whether various virtual keys are down. This parameter can be one or more of the following values.

Value

Description

MK_CONTROL

The CTRL key is down.

MK_LBUTTON

The left mouse button is down.

MK_RBUTTON

The right mouse button is down.

MK_SHIFT

The SHIFT key is down.

MK_XBUTTON1

Windows 2000: The first X button is down.

MK_XBUTTON2

Windows 2000: The second X button is down.

 

lParam

The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

Use the following code to obtain the horizontal and vertical position:

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, MAKEPOINTS, POINTS, SetCapture, WM_MBUTTONDBLCLK, WM_MBUTTONDOWN

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, MAKEPOINTS, POINTS, SetCapture, WM_MBUTTONDBLCLK, WM_MBUTTONDOWN

 

 

 

   

Platform SDK: Windows User Interface

WM_MBUTTONDBLCLK

The WM_MBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_MBUTTONDBLCKL

  WPARAM wParam,   // key indicator

  LPARAM lParam    // horizontal and vertical position

);

Parameters

wParam

Indicates whether various virtual keys are down. This parameter can be one or more of the following values.

Value

Description

MK_CONTROL

The CTRL key is down.

MK_LBUTTON

The left mouse button is down.

MK_MBUTTON

The middle mouse button is down.

MK_RBUTTON

The right mouse button is down.

MK_SHIFT

The SHIFT key is down.

MK_XBUTTON1

Windows 2000: The first X button is down.

MK_XBUTTON2

Windows 2000: The second X button is down.

 

lParam

The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

Use the following code to obtain the horizontal and vertical position:

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

Only windows that have the CS_DBLCLKS style can receive WM_MBUTTONDBLCLK messages, which the system generates when the user presses, releases, and again presses the middle mouse button within the system's double-click time limit. Double-clicking the middle mouse button actually generates four messages: WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MBUTTONDBLCLK, and WM_MBUTTONUP again.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, GetDoubleClickTime, MAKEPOINTS, POINTS, SetCapture, SetDoubleClickTime, WM_MBUTTONDOWN, WM_MBUTTONUP

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, GetDoubleClickTime, MAKEPOINTS, POINTS, SetCapture, SetDoubleClickTime, WM_MBUTTONDOWN, WM_MBUTTONUP

 

 

 

   

Platform SDK: Windows User Interface

WM_MOUSEWHEEL

The WM_MOUSEWHEEL message is sent to the focus window when the mouse wheel is rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_MOUSEWHEEL

  WPARAM wParam,   // key indicator and wheel rotation

  LPARAM lParam    // horizontal and vertical position

);

Parameters

wParam

The low-order word indicates whether various virtual keys are down. This parameter can be one or more of the following values.

Value

Description

MK_CONTROL

The CTRL key is down.

MK_LBUTTON

The left mouse button is down.

MK_MBUTTON

The middle mouse button is down.

MK_RBUTTON

The right mouse button is down.

MK_SHIFT

The SHIFT key is down.

MK_XBUTTON1

Windows 2000: The first X button is down.

MK_XBUTTON2

Windows 2000: The second X button is down.

 

The high-order word indicates the distance the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is 120. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user.

lParam

The low-order word specifies the x-coordinate of the pointer, relative to the upper-left corner of the screen.

The high-order word specifies the y-coordinate of the pointer, relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Remarks

Use the following code to crack the wParam parameter:

fwKeys = GET_KEYSTATE_WPARAM(wParam);

zDelta = GET_WHEEL_DELTA_WPARAM(wParam);

Use the following code to obtain the horizontal and vertical position:

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

The wheel rotation will be a multiple of WHEEL_DELTA, which is set at 120. This is the threshold for action to be taken, and one such action (for example, scrolling one increment) should occur for each delta.

The delta was set to 120 to allow Microsoft or other vendors to build finer-resolution wheels in the future, including perhaps a freely-rotating wheel with no notches. The expectation is that such a device would send more messages per rotation, but with a smaller value in each message. To support this possibility, you should either add the incoming delta values until WHEEL_DELTA is reached (so for a delta-rotation you get the same response), or scroll partial lines in response to the more frequent messages. You could also choose your scroll granularity and accumulate deltas until it is reached.

Windows 95 and Windows NT 3.51: Support for the mouse wheel is provided through a separately-running module, MSWheel, that generates a MSH_MOUSEWHEEL message. The MSWheel module, which consists of MSWheel.exe and MSWheel.dll, is installed with the IntelliPoint software that is shipped with the IntelliMouse® pointing device. In addition, MSH_MOUSEWHEEL is defined in the header file (ZMouse.h) that an application must use to implement support for the wheel via the MSWheel module.

MSH_MOUSEWHEEL

zDelta = (int) wParam; // wheel rotation

xPos = LOWORD(lParam); // horizontal position of pointer

yPos = HIWORD(lParam); // vertical position of pointer

Note, there is no fwKeys for MSH_MOUSEWHEEL. Otherwise, the parameters are exactly the same as for WM_MOUSEWHEEL.

It is up to the application to forward MSH_MOUSEWHEEL to any embedded objects or controls. The application is required to send the message to an active embedded OLE application. It is optional that the application sends it to a wheel-enabled control with focus. If the application does send the message to a control, it can check the return value to see if the message was processed. Controls are required to return a value of TRUE if they process the message.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_KEYSTATE_WPARAM, GET_X_LPARAM, GET_Y_LPARAM, GET_WHEEL_DELTA_WPARAM, GetSystemMetrics, HIWORD, LOWORD, mouse_event, SystemParametersInfo

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_KEYSTATE_WPARAM, GET_X_LPARAM, GET_Y_LPARAM, GET_WHEEL_DELTA_WPARAM, GetSystemMetrics, HIWORD, LOWORD, mouse_event, SystemParametersInfo

 

 

 

   

Platform SDK: Windows User Interface

WM_PARENTNOTIFY

The WM_PARENTNOTIFY message is sent to the parent of a child window when the child window is created or destroyed, or when the user clicks a mouse button while the cursor is over the child window. When the child window is being created, the system sends WM_PARENTNOTIFY just before the CreateWindow or CreateWindowEx function that creates the window returns. When the child window is being destroyed, the system sends the message before any processing to destroy the window takes place.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_PARENTNOTIFY

  WPARAM wParam,   // event and child window identifier

  LPARAM lParam    // child handle or cursor coordinates

);

Parameters

wParam

The low-order word of wParam specifies the event for which the parent is being notified. This parameter can be one of the following values.

Value

Meaning

WM_CREATE

The child window is being created.

WM_DESTROY

The child window is being destroyed.

WM_LBUTTONDOWN

The user has placed the cursor over the child window and has clicked the left mouse button.

WM_MBUTTONDOWN

The user has placed the cursor over the child window and has clicked the middle mouse button.

WM_RBUTTONDOWN

The user has placed the cursor over the child window and has clicked the right mouse button.

WM_XBUTTONDOWN

Windows 2000: The user has placed the cursor over the child window and has clicked the first or second X button.

 

The meaning of the high-order word of wParam depends on the value of the low-order word of wParam, as shown in the following table.

LOWORD(wParam)

Meaning of HIWORD(wParam)

WM_CREATE

Identifier of the child window.

WM_DESTROY

Identifier of the child window.

WM_LBUTTONDOWN

Undefined.

WM_MBUTTONDOWN

Undefined.

WM_RBUTTONDOWN

Undefined.

WM_XBUTTONDOWN

Windows 2000: Indicates which button was pressed. This parameter can be one of the following values:

XBUTTON1
XBUTTON2

 

lParam

The meaning of lParam depends on the value of the low-order word of wParam, as shown in the following table.

LOWORD(wParam)

Meaning of lParam

WM_CREATE

Handle of the child window.

WM_DESTROY

Handle of the child window.

WM_LBUTTONDOWN

The x-coordinate of the cursor is the low-order word, and the y-coordinate of the cursor is the high-order word.

WM_MBUTTONDOWN

The x-coordinate of the cursor is the low-order word, and the y-coordinate of the cursor is the high-order word.

WM_RBUTTONDOWN

The x-coordinate of the cursor is the low-order word, and the y-coordinate of the cursor is the high-order word.

WM_XBUTTONDOWN

The x-coordinate of the cursor is the low-order word, and the y-coordinate of the cursor is the high-order word.

 

Return Values

If an application processes this message, it should return zero.

Remarks

This message is also sent to all ancestor windows of the child window, including the top-level window.

All child windows, except those that have the WS_EX_NOPARENTNOTIFY extended window style, send this message to their parent windows. By default, child windows in a dialog box have the WS_EX_NOPARENTNOTIFY style, unless the CreateWindowEx function is called to create the child window without this style.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, CreateWindow, CreateWindowEx, HIWORD, LOWORD, WM_CREATE, WM_DESTROY, WM_LBUTTONDOWN, WM_MBUTTONDOWN, WM_RBUTTONDOWN, WM_XBUTTONDOWN

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, CreateWindow, CreateWindowEx, HIWORD, LOWORD, WM_CREATE, WM_DESTROY, WM_LBUTTONDOWN, WM_MBUTTONDOWN, WM_RBUTTONDOWN, WM_XBUTTONDOWN

 

 

 

   

Platform SDK: Windows User Interface

WM_ENTERMENULOOP

The WM_ENTERMENULOOP message informs an application's main window procedure that a menu modal loop has been entered.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  WM_ENTERMENULOOP// message to send

  WPARAM wParam,   // track popup menu indicator

  LPARAM lParam    // not used

);

Parameters

wParam

Specifies whether the window menu was entered using the TrackPopupMenu function. This parameter has a value of TRUE if the window menu was entered using TrackPopupMenu, and FALSE if it was not.

lParam

This parameter is not used.

Return Values

An application should return zero if it processes this message.

Remarks

The DefWindowProc function returns zero.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages, DefWindowProc, WM_EXITMENULOOP

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages, DefWindowProc, WM_EXITMENULOOP

 

 

 

   

Platform SDK: Windows User Interface

WM_EXITMENULOOP

The WM_EXITMENULOOP message informs an application's main window procedure that a menu modal loop has been exited.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  WM_EXITLOOP,     // message to send

  WPARAM wParam,   // menu status

  LPARAM lParam    // not used

);

Parameters

wParam

Specifies whether the menu is a shortcut menu. This parameter has a value of TRUE if it is a shortcut menu, FALSE if it is not.

lParam

This parameter is not used.

Return Values

An application should return zero if it processes this message.

Remarks

The DefWindowProc function returns zero.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages, DefWindowProc, WM_ENTERMENULOOP

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages, DefWindowProc, WM_ENTERMENULOOP

 

 

 

   

Platform SDK: Windows User Interface

WM_NEXTMENU

The WM_NEXTMENU message is sent to an application when the right or left arrow key is used to switch between the menu bar and the system menu.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  WM_NEXTMENU,     // message to send

  WPARAM wParam,   // virtual-key code

  LPARAM lParam    // menu information (LPMDINEXTMENU)

);

Parameters

wParam

Specifies the virtual-key code of the key.

lParam

Pointer to a MDINEXTMENU structure that contains information about the menu to be activated.

Remarks

In responding to this message, the application can specify the menu to switch to in the hmenuNext member of MDINEXTMENU and the window to receive the menu notification messages in the hwndNext member of the MDINEXTMENU structure. You must set both members for the changes to take effect (they are initially NULL).

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages, MDINEXTMENU

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Menus Overview, Menu Messages, MDINEXTMENU

 

 

 

   

Platform SDK: Windows User Interface

WM_SIZING

The WM_SIZING message is sent to a window that the user is resizing. By processing this message, an application can monitor the size and position of the drag rectangle and, if needed, change its size or position.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_SIZING

  WPARAM wParam,   // edge of window

  LPARAM lParam    // drag rectangle (LPRECT)

);

Parameters

wParam

Specifies which edge of the window is being sized. This parameter can be one or more of the following values.

Value

Meaning

WMSZ_BOTTOM

Bottom edge

WMSZ_BOTTOMLEFT

Bottom-left corner

WMSZ_BOTTOMRIGHT

Bottom-right corner

WMSZ_LEFT

Left edge

WMSZ_RIGHT

Right edge

WMSZ_TOP

Top edge

WMSZ_TOPLEFT

Top-left corner

WMSZ_TOPRIGHT

Top-right corner

 

lParam

Pointer to a RECT structure with the screen coordinates of the drag rectangle. To change the size or position of the drag rectangle, an application must change the members of this structure.

Return Values

An application should return TRUE if it processes this message.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, RECT, WM_MOVING, WM_SIZE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, RECT, WM_MOVING, WM_SIZE

 

 

 

   

Platform SDK: Windows User Interface

WM_CAPTURECHANGED

The WM_CAPTURECHANGED message is sent to the window that is losing the mouse capture.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_CAPTURECHANGED

  WPARAM wParam,   // not used

  LPARAM lParam    // handle to window (HWND)

);

Parameters

wParam

This parameter is not used.

lParam

Handle to the window gaining the mouse capture.

Return Values

An application should return zero if it processes this message.

Remarks

A window receives this message even if it calls ReleaseCapture itself. An application should not attempt to set the mouse capture in response to this message.

When it receives this message, a window should redraw itself, if necessary, to reflect the new mouse-capture state.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, ReleaseCapture, SetCapture

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, ReleaseCapture, SetCapture

 

 

 

   

Platform SDK: Windows User Interface

WM_MOVING

The WM_MOVING message is sent to a window that the user is moving. By processing this message, an application can monitor the size and position of the drag rectangle and, if needed, change its size or position.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_MOVING

  WPARAM wParam,   // edge of window

  LPARAM lParam    // drag rectangle (LPRECT)

);

Parameters

wParam

Indicates which edge of the window is being moved. This parameter can be a combination of the following values.

Value

Meaning

WMSZ_BOTTOM

Bottom edge

WMSZ_BOTTOMLEFT

Bottom-left corner

WMSZ_BOTTOMRIGHT

Bottom-right corner

WMSZ_LEFT

Left edge

WMSZ_RIGHT

Right edge

WMSZ_TOP

Top edge

WMSZ_TOPLEFT

Top-left corner

WMSZ_TOPRIGHT

Top-right corner

 

lParam

Pointer to a RECT structure with the screen coordinates of the drag rectangle. To change the size or position of the drag rectangle, an application must change the members of this structure.

Return Values

An application should return TRUE if it processes this message.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, RECT, WM_MOVE, WM_SIZING

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, RECT, WM_MOVE, WM_SIZING

 

 

 

   

Platform SDK: Hardware

WM_POWERBROADCAST

The WM_POWERBROADCAST message is broadcast to an application to notify it of power-management events.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_POWERBROADCAST

  WPARAM wParam,   // power-management event

  LPARAM lParam    // function-specific data

);

Parameters

wParam

Specifies the power-management event. This parameter can be one of the following events.

Event

Meaning

PBT_APMBATTERYLOW

Battery power is low.

PBT_APMOEMEVENT

OEM-defined event occurred.

PBT_APMPOWERSTATUSCHANGE

Power status has changed.

PBT_APMQUERYSUSPEND

Request for permission to suspend.

PBT_APMQUERYSUSPENDFAILED

Suspension request denied.

PBT_APMRESUMEAUTOMATIC

Operation resuming automatically after event.

PBT_APMRESUMECRITICAL

Operation resuming after critical suspension.

PBT_APMRESUMESUSPEND

Operation resuming after suspension.

PBT_APMSUSPEND

System is suspending operation.

 

lParam

Function-specific data. For most events, this parameter is reserved and not used.

However, if wParam is one of the resume events (PBT_APMRESUME*), the lParam parameter can specify the PBTF_APMRESUMEFROMFAILURE flag. This flag indicates that a suspend operation failed after the PBT_APMSUSPEND event was broadcast.

Return Values

Return TRUE to grant a request.

Return BROADCAST_QUERY_DENY to deny a request.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Power Management Overview, Power Management Messages

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Power Management Overview, Power Management Messages

 

 

 

   

Platform SDK: Hardware

WM_DEVICECHANGE

The WM_DEVICECHANGE device message notifies an application of a change to the hardware configuration of a device or the computer.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_DEVICECHANGE

  WPARAM wParam,   // device-change event

  LPARAM lParam    // event-specific data

);

Parameters

wParam

Specifies the event. This parameter can be one of the following values.

Value

Meaning

DBT_CONFIGCHANGECANCELED

A request to change the current configuration (dock or undock) has been canceled.

DBT_CONFIGCHANGED

The current configuration has changed, due to a dock or undock.

DBT_CUSTOMEVENT

Windows 98 and Windows 2000: A custom event has occurred.

DBT_DEVICEARRIVAL

A device has been inserted and is now available.

DBT_DEVICEQUERYREMOVE

Permission is requested to remove a device. Any application can deny this request and cancel the removal.

DBT_DEVICEQUERYREMOVEFAILED

A request to remove a device has been canceled.

DBT_DEVICEREMOVECOMPLETE

A device has been removed.

DBT_DEVICEREMOVEPENDING

A device is about to be removed. Cannot be denied.

DBT_DEVICETYPESPECIFIC

A device-specific event has occurred.

DBT_QUERYCHANGECONFIG

Permission is requested to change the current configuration (dock or undock).

DBT_USERDEFINED

The meaning of this message is user-defined.

 

lParam

Pointer to a structure that contains event-specific data. Its format depends on the value of the wParam parameter. For more information, refer to the documentation for each event.

Return Values

Return TRUE to grant the request.

Return BROADCAST_QUERY_DENY to deny the request.

Remarks

For devices that offer software-controllable features, such as ejection and locking, the system typically sends a DBT_DEVICEREMOVEPENDING message to let applications and device drivers end their use of the device gracefully. If the system forcibly removes a device, it may not send a DBT_DEVICEQUERYREMOVE message before doing so.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Device Management Overview, Device Management Messages, DBT_CONFIGCHANGECANCELED, DBT_CONFIGCHANGED, DBT_CUSTOMEVENT, DBT_DEVICEARRIVAL, DBT_DEVICEQUERYREMOVE, DBT_DEVICEQUERYREMOVEFAILED, DBT_DEVICEREMOVECOMPLETE, DBT_DEVICEREMOVEPENDING, DBT_DEVICETYPESPECIFIC, DBT_QUERYCHANGECONFIG, DBT_USERDEFINED

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Device Management Overview, Device Management Messages, DBT_CONFIGCHANGECANCELED, DBT_CONFIGCHANGED, DBT_CUSTOMEVENT, DBT_DEVICEARRIVAL, DBT_DEVICEQUERYREMOVE, DBT_DEVICEQUERYREMOVEFAILED, DBT_DEVICEREMOVECOMPLETE, DBT_DEVICEREMOVEPENDING, DBT_DEVICETYPESPECIFIC, DBT_QUERYCHANGECONFIG, DBT_USERDEFINED

 

 

 

   

Platform SDK: Windows User Interface

WM_MDICREATE

An application sends the WM_MDICREATE message to a multiple document interface (MDI) client window to create an MDI child window.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,          // handle to destination window

  WM_MDICREATE,         // message to send

  (WPARAM) wParam,      // not used; must be zero

  (LPARAM) lParam       // creation data (LPMDICREATESTRUCT)

);

Parameters

wParam

This parameter is not used.

lParam

Pointer to an MDICREATESTRUCT structure containing information that the system uses to create the MDI child window.

Return Values

If the message succeeds, the return value is the handle to the new child window.

If the message fails, the return value is NULL.

Remarks

The MDI child window is created with the style bits WS_CHILD, WS_CLIPSIBLINGS, WS_CLIPCHILDREN, WS_SYSMENU, WS_CAPTION, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX, plus additional style bits specified in the MDICREATESTRUCT structure. The system adds the title of the new child window to the window menu of the frame window. An application should use this message to create all child windows of the client window.

If an MDI client window receives any message that changes the activation of its child windows while the active child window is maximized, the system restores the active child window and maximizes the newly activated child window.

When an MDI child window is created, the system sends the WM_CREATE message to the window. The lParam parameter of the WM_CREATE message contains a pointer to a CREATESTRUCT structure. The lpCreateParams member of this structure contains a pointer to the MDICREATESTRUCT structure passed with the WM_MDICREATE message that created the MDI child window.

An application should not send a second WM_MDICREATE message while a WM_MDICREATE message is still being processed. For example, it should not send a WM_MDICREATE message while an MDI child window is processing its WM_MDICREATE message.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, CreateMDIWindow, CREATESTRUCT, MDICREATESTRUCT, WM_CREATE, WM_MDIDESTROY

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, CreateMDIWindow, CREATESTRUCT, MDICREATESTRUCT, WM_CREATE, WM_MDIDESTROY

 

 

 

   

Platform SDK: Windows User Interface

WM_MDIDESTROY

An application sends the WM_MDIDESTROY message to a multiple document interface (MDI) client window to close an MDI child window.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_MDIDESTROY,            // message to send

  (WPARAM) wParam,          // handle to child window (HWND)

  (LPARAM) lParam           // not used; must be zero

);

Parameters

wParam

Handle to the MDI child window to be closed.

lParam

This parameter is not used.

Return Values

This message always returns zero.

Remarks

This message removes the title of the MDI child window from the MDI frame window and deactivates the child window. An application should use this message to close all MDI child windows.

If an MDI client window receives a message that changes the activation of its child windows and the active MDI child window is maximized, the system restores the active child window and maximizes the newly activated child window.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, WM_MDICREATE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, WM_MDICREATE

 

 

 

   

Platform SDK: Windows User Interface

WM_MDIACTIVATE

An application sends the WM_MDIACTIVATE message to a multiple document interface (MDI) client window to instruct the client window to activate a different MDI child window.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_MDIACTIVE,             // message to send

  (WPARAM) wParam,          // handle to child window (HWND)

  (LPARAM) lParam           // not used; must be zero

);

Parameters

wParam

Handle to the MDI child window to be activated.

lParam

This parameter is not used.

Return Values

If an application sends this message to an MDI client window, the return value is zero.

An MDI child window should return zero if it processes this message.

Remarks

As the client window processes this message, it sends WM_MDIACTIVATE to the child window being deactivated and to the child window being activated. The message parameters received by an MDI child window are as follows:

wParam

Handle to the MDI child window being deactivated.

lParam

Handle to the MDI child window being activated.

An MDI child window is activated independently of the MDI frame window. When the frame window becomes active, the child window last activated by using the WM_MDIACTIVATE message receives the WM_NCACTIVATE message to draw an active window frame and title bar; the child window does not receive another WM_MDIACTIVATE message.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, WM_MDIGETACTIVE, WM_MDINEXT, WM_NCACTIVATE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, WM_MDIGETACTIVE, WM_MDINEXT, WM_NCACTIVATE

 

 

 

   

Platform SDK: Windows User Interface

WM_MDIRESTORE

An application sends the WM_MDIRESTORE message to a multiple document interface (MDI) client window to restore an MDI child window from maximized or minimized size.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_MDIRESTORE,            // message to send

  (WPARAM) wParam,          // handle to child window (HWND)

  (LPARAM) lParam           // not used; must be zero

);

Parameters

wParam

Handle to the MDI child window to be restored.

lParam

This parameter is not used.

Return Values

The return value is always zero.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, WM_MDIMAXIMIZE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, WM_MDIMAXIMIZE

 

 

 

   

Platform SDK: Windows User Interface

WM_MDINEXT

An application sends the WM_MDINEXT message to a multiple document interface (MDI) client window to activate the next or previous child window.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_MDINEXT,               // message to send

  (WPARAM) wParam,          // handle to child window (HWND)

  (LPARAM) lParam           // next or previous indicator

);

Parameters

wParam

Handle to the MDI child window. The system activates the child window that is immediately before or after the specified child window, depending on the value of the fNext parameter. If the hwndChild parameter is NULL, the system activates the child window that is immediately before or after the currently active child window.

lParam

If this parameter is zero, the system activates the next MDI child window and places the child window identified by the hwndChild parameter behind all other child windows. If this parameter is nonzero, the system activates the previous child window, placing it in front of the child window identified by hwndChild.

Return Values

The return value is always zero.

Remarks

If an MDI client window receives any message that changes the activation of its child windows while the active MDI child window is maximized, the system restores the active child window and maximizes the newly activated child window.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, WM_MDIACTIVATE, WM_MDIGETACTIVE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, WM_MDIACTIVATE, WM_MDIGETACTIVE

 

 

 

   

Platform SDK: Windows User Interface

WM_MDIMAXIMIZE

An application sends the WM_MDIMAXIMIZE message to a multiple document interface (MDI) client window to maximize an MDI child window. The system resizes the child window to make its client area fill the client window. The system places the child window's window menu icon in the rightmost position of the frame window's menu bar, and places the child window's restore icon in the leftmost position. The system also appends the title bar text of the child window to that of the frame window.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_MDIMAXIMIZE,           // message to send

  (WPARAM) wParam,          // handle to child window (HWND)

  (LPARAM) lParam           // not used; must be zero

);

Parameters

wParam

Handle to the MDI child window to be maximized.

lParam

This parameter is not used.

Return Values

The return value is always zero.

Remarks

If an MDI client window receives any message that changes the activation of its child windows while the currently active MDI child window is maximized, the system restores the active child window and maximizes the newly activated child window.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, WM_MDIRESTORE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, WM_MDIRESTORE

 

 

 

   

Platform SDK: Windows User Interface

WM_MDITILE

An application sends the WM_MDITILE message to a multiple document interface (MDI) client window to arrange all of its MDI child windows in a tile format.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_MDITILE,               // message to send

  (WPARAM) wParam,          // tiling option

  (LPARAM) lParam           // not used; must be zero

);

Parameters

wParam

Specifies the tiling option. This parameter can be one of the following values, optionally combined with MDITILE_SKIPDISABLED to prevent disabled MDI child windows from being tiled.

Value

Meaning

MDITILE_HORIZONTAL

Tiles windows horizontally.

MDITILE_VERTICAL

Tiles windows vertically.

 

lParam

This parameter is not used.

Return Values

If the message succeeds, the return value is TRUE.

If the message fails, the return value is FALSE.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, WM_MDICASCADE, WM_MDIICONARRANGE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, WM_MDICASCADE, WM_MDIICONARRANGE

 

 

 

   

Platform SDK: Windows User Interface

WM_MDICASCADE

An application sends the WM_MDICASCADE message to a multiple document interface (MDI) client window to arrange all its child windows in a cascade format.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_MDICASCADE,            // message to send

  (WPARAM) wParam,          // cascade option

  (LPARAM) lParam           // not used; must be zero

);

Parameters

wParam

Specifies the cascade behavior. This parameter can be one or more of the following values.

Value

Meaning

MDITILE_SKIPDISABLED

Prevents disabled MDI child windows from being cascaded.

MDITILE_ZORDER

Windows 2000: Arranges the windows in Z order.

 

lParam

This parameter is not used.

Return Values

If the message succeeds, the return value is TRUE.

If the message fails, the return value is FALSE.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, WM_MDIICONARRANGE, WM_MDITILE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, WM_MDIICONARRANGE, WM_MDITILE

 

 

 

   

Platform SDK: Windows User Interface

WM_MDIICONARRANGE

An application sends the WM_MDIICONARRANGE message to a multiple document interface (MDI) client window to arrange all minimized MDI child windows. It does not affect child windows that are not minimized.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_MDIICONARRANGE,        // message to send

  (WPARAM) wParam,          // not used; must be zero

  (LPARAM) lParam           // not used; must be zero

);

Parameters

This message has no parameters.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, WM_MDICASCADE, WM_MDITILE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, WM_MDICASCADE, WM_MDITILE

 

 

 

   

Platform SDK: Windows User Interface

WM_MDIGETACTIVE

An application sends the WM_MDIGETACTIVE message to a multiple document interface (MDI) client window to retrieve the handle to the active MDI child window.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_MDIGETACTIVE,          // message to send

  (WPARAM) wParam,          // not used; must be zero

  (LPARAM) lParam           // maximized state (LPBOOL)

);

Parameters

wParam

This parameter is not used.

lParam

Specifies the maximized state. If this parameter is not NULL, it is a pointer to a value that indicates the maximized state of the MDI child window. If the value is TRUE, the window is maximized; a value of FALSE indicates that it is not. If this parameter is NULL, the parameter is ignored.

Return Values

The return value is the handle to the active MDI child window.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages

 

 

 

   

Platform SDK: Windows User Interface

WM_MDISETMENU

An application sends the WM_MDISETMENU message to a multiple document interface (MDI) client window to replace the entire menu of an MDI frame window, to replace the window menu of the frame window, or both.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_MDISETMENU,            // message to send

  (WPARAM) wParam,          // handle to menu (HMENU)

  (LPARAM) lParam           // handle to window menu (HMENU)

);

Parameters

wParam

Handle to the new frame window menu. If this parameter is NULL, the frame window menu is not changed.

lParam

Handle to the new window menu. If this parameter is NULL, the window menu is not changed.

Return Values

If the message succeeds, the return value is the handle to the old frame window menu.

If the message fails, the return value is zero.

Remarks

After sending this message, an application must call the DrawMenuBar function to update the menu bar.

If this message replaces the window menu, the MDI child window menu items are removed from the previous window menu and added to the new window menu.

If an MDI child window is maximized and this message replaces the MDI frame window menu, the window menu icon and restore icon are removed from the previous frame window menu and added to the new frame window menu.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, DrawMenuBar, WM_MDIREFRESHMENU

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, DrawMenuBar, WM_MDIREFRESHMENU

 

 

 

   

Platform SDK: Windows User Interface

WM_ENTERSIZEMOVE

The WM_ENTERSIZEMOVE message is sent one time to a window after it enters the moving or sizing modal loop. The window enters the moving or sizing modal loop when the user clicks the window's title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. The operation is complete when DefWindowProc returns.

The system sends the WM_ENTERSIZEMOVE message regardless of whether the dragging of full windows is enabled.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_ENTERSIZEMOVE

  WPARAM wParam,   // not used

  LPARAM lParam    // not used

);

Parameters

This message has no parameters.

Return Values

An application should return zero if it processes this message.

Requirements

  Windows NT/2000: Requires Windows NT 3.51 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, WM_EXITSIZEMOVE, WM_SYSCOMMAND

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.51 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, WM_EXITSIZEMOVE, WM_SYSCOMMAND

 

 

 

   

Platform SDK: Windows User Interface

WM_EXITSIZEMOVE

The WM_EXITSIZEMOVE message is sent one time to a window, after it has exited the moving or sizing modal loop. The window enters the moving or sizing modal loop when the user clicks the window's title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. The operation is complete when DefWindowProc returns.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_EXITSIZEMOVE

  WPARAM wParam,   // not used

  LPARAM lParam    // not used

);

Parameters

This message has no parameters.

Return Values

An application should return zero if it processes this message.

Requirements

  Windows NT/2000: Requires Windows NT 3.51 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, WM_ENTERSIZEMOVE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.51 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Windows Overview, Window Messages, DefWindowProc, WM_ENTERSIZEMOVE

WM_DROPFILES

Sent when the user drops a file on the window of an application that has registered itself as a recipient of dropped files.

WM_DROPFILES 
    hDrop = (HDROP) wParam; 

Parameters

hDrop

Handle to an internal structure describing the dropped files. Pass this handle DragFinish, DragQueryFile, or DragQueryPoint to retrieve information about the dropped files.

Return Values

An application should return zero if it processes this message.

Remarks

The HDROP handle is declared in Shellapi.h. You must include this header in your build to use WM_DROPFILES. For further discussion of how to use drag-drop to transfer shell data, see Transferring Shell Data Using Drag-Drop or the Clipboard.

See Also

DragAcceptFiles

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in winuser.h.

 

 

 

   

Platform SDK: Windows User Interface

WM_MDIREFRESHMENU

An application sends the WM_MDIREFRESHMENU message to a multiple document interface (MDI) client window to refresh the window menu of the MDI frame window.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_MDIREFRESHMENU,        // message to send

  (WPARAM) wParam,          // not used; must be zero

  (LPARAM) lParam           // not used; must be zero

);

Parameters

This message has no parameters.

Return Values

If the message succeeds, the return value is the handle to the frame window menu.

If the message fails, the return value is NULL.

Remarks

After sending this message, an application must call the DrawMenuBar function to update the menu bar.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, DrawMenuBar, WM_MDISETMENU

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Multiple Document Interface Overview, Multiple Document Interface Messages, DrawMenuBar, WM_MDISETMENU

 

 

 

   

Platform SDK: International Features

WM_IME_SETCONTEXT

The WM_IME_SETCONTEXT message is sent to an application when a window of the application is activated. If the application has created an IME window, it should call the ImmIsUIMessagefunction. Otherwise, it should pass this message to the DefWindowProc function.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  WM_IME_SETCONTEXT// message to send

  WPARAM wParam,   // (BOOL) active status

  LPARAM lParam    // display options

);

Parameters

wParam

Indicates if the window is active. If this parameter is TRUE, the input context is active. Otherwise, the context is inactive.

lParam

Specifies the display options. This parameter can be one or more of the following values.

Value

Description

ISC_SHOWUICOMPOSITIONWINDOW

Shows the composition window by UI window.

ISC_SHOWUIGUIDWINDOW

Shows the guide window by UI window.

ISC_SHOWUISOFTKBD

Shows the soft keyboard by UI window.

ISC_SHOWUICANDIDATEWINDOW

Shows the candidate window of Index 0 by UI window.

ISC_SHOWUICANDIDATEWINDOW << 1

Shows the candidate window of Index 1 by UI window.

ISC_SHOWUICANDIDATEWINDOW << 2

Shows the candidate window of Index 2 by UI window.

ISC_SHOWUICANDIDATEWINDOW << 3

Shows the candidate window of Index 3 by UI window.

 

Return Values

Returns the value returned by DefWindowProc or ImmIsUIMessage.

Remarks

If the application draws the composition window, the default IME window does not need to show its composition window. In this case, the application must clear the ISC_SHOWUICOMPOSITIONWINDOW value from the lParam parameter before passing the message to the DefWindowProc or ImmIsUIMessage functions. Likewise, if an application wants to display a certain UI window, it should remove the corresponding value so IME will not display it.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Imm.h; include Windows.h.

See Also

Input Method Editor Overview, Input Method Editor Messages, DefWindowProc, ImmIsUIMessage

Built on Tuesday, November 07, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Imm.h; include Windows.h.

See Also

Input Method Editor Overview, Input Method Editor Messages, DefWindowProc, ImmIsUIMessage

 

 

 

 

 

 

 

   

Platform SDK: International Features

WM_IME_NOTIFY

The WM_IME_NOTIFY message is sent to an application to notify it of changes to the IME window. An application processes this message if it is responsible for managing the IME window.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  WM_IME_NOTIFY,   // message to send

  WPARAM wParam,   // notification command

  LPARAM lParam    // command-specific data

);

Parameters

wParam

Specifies the command. This parameter can be one of the following values:

IMN_CHANGECANDIDATE
IMN_CLOSECANDIDATE
IMN_CLOSESTATUSWINDOW
IMN_GUIDELINE
IMN_OPENCANDIDATE
IMN_OPENSTATUSWINDOW
IMN_SETCANDIDATEPOS
IMN_SETCOMPOSITIONFONT
IMN_SETCOMPOSITIONWINDOW
IMN_SETCONVERSIONMODE
IMN_SETOPENSTATUS
IMN_SETSENTENCEMODE
IMN_SETSTATUSWINDOWPOS

lParam

Specifies command-specific data. Its format depends on the value of the wParam parameter. For more information, refer to the documentation for each command.

Return Values

The return value depends on the command sent.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Imm.h; include Windows.h.

See Also

Input Method Editor Overview, Input Method Editor Messages, IMN_CHANGECANDIDATE, IMN_CLOSECANDIDATE, IMN_CLOSESTATUSWINDOW, IMN_GUIDELINE, IMN_OPENCANDIDATE, IMN_OPENSTATUSWINDOW, IMN_SETCANDIDATEPOS, IMN_SETCOMPOSITIONFONT, IMN_SETCOMPOSITIONWINDOW, IMN_SETCONVERSIONMODE, IMN_SETOPENSTATUS, IMN_SETSENTENCEMODE, IMN_SETSTATUSWINDOWPOS

Built on Tuesday, November 07, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Imm.h; include Windows.h.

See Also

Input Method Editor Overview, Input Method Editor Messages, IMN_CHANGECANDIDATE, IMN_CLOSECANDIDATE, IMN_CLOSESTATUSWINDOW, IMN_GUIDELINE, IMN_OPENCANDIDATE, IMN_OPENSTATUSWINDOW, IMN_SETCANDIDATEPOS, IMN_SETCOMPOSITIONFONT, IMN_SETCOMPOSITIONWINDOW, IMN_SETCONVERSIONMODE, IMN_SETOPENSTATUS, IMN_SETSENTENCEMODE, IMN_SETSTATUSWINDOWPOS

 

 

 

 

 

 

 

 

   

Platform SDK: International Features

WM_IME_CONTROL

The WM_IME_CONTROL message directs the IME window to carry out the requested command. An application uses this message to control the IME window created by the application.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  HWND hWnd,              // handle to destination window

  WM_IME_CONTROL,         // message to send

  WPARAM wParam,          // IME command

  LPARAM lParam           // command-specific data

);

Parameters

wParam

Specifies the command. This parameter can be one of the following values:

IMC_CLOSESTATUSWINDOW
IMC_GETCANDIDATEPOS
IMC_GETCOMPOSITIONFONT
IMC_GETCOMPOSITIONWINDOW
IMC_GETSTATUSWINDOWPOS
IMC_OPENSTATUSWINDOW
IMC_SETCANDIDATEPOS
IMC_SETCOMPOSITIONFONT
IMC_SETCOMPOSITIONWINDOW
IMC_SETSTATUSWINDOWPOS

lParam

Specifies command-specific data. Its format depends on the value of the wParam parameter. For more information, refer to the documentation for each command.

Return Values

The message returns a command-specific value.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Imm.h; include Windows.h.

See Also

Input Method Editor Overview, Input Method Editor Messages, IMC_CLOSESTATUSWINDOW, IMC_GETCANDIDATEPOS, IMC_GETCOMPOSITIONFONT, IMC_GETCOMPOSITIONWINDOW, IMC_GETSTATUSWINDOWPOS, IMC_OPENSTATUSWINDOW, IMC_SETCANDIDATEPOS, IMC_SETCOMPOSITIONFONT, IMC_SETCOMPOSITIONWINDOW, IMC_SETSTATUSWINDOWPOS

Built on Tuesday, November 07, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Imm.h; include Windows.h.

See Also

Input Method Editor Overview, Input Method Editor Messages, IMC_CLOSESTATUSWINDOW, IMC_GETCANDIDATEPOS, IMC_GETCOMPOSITIONFONT, IMC_GETCOMPOSITIONWINDOW, IMC_GETSTATUSWINDOWPOS, IMC_OPENSTATUSWINDOW, IMC_SETCANDIDATEPOS, IMC_SETCOMPOSITIONFONT, IMC_SETCOMPOSITIONWINDOW, IMC_SETSTATUSWINDOWPOS

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: International Features

WM_IME_SELECT

The WM_IME_SELECT message is sent to an application when the system is about to change the current IME. An application that has created an IME window should pass this message to that window so that it can retrieve the keyboard layout handle for the newly selected IME.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  WM_IME_SELECT,   // message to send

  WPARAM wParam,   // selection indicator

  LPARAM lParam    // input locale identifier (HANDLE)

);

Parameters

wParam

Selection indicator. If TRUE, the specified IME is selected; if FALSE, the specified IME is no longer selected.

lParam

Input locale identifier associated with the IME.

Return Values

This message has no return value.

Remarks

The DefWindowProc function processes this message by passing the information to the default IME window.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Imm.h; include Windows.h.

See Also

Input Method Editor Overview, Input Method Editor Messages, DefWindowProc

Built on Tuesday, November 07, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Imm.h; include Windows.h.

See Also

Input Method Editor Overview, Input Method Editor Messages, DefWindowProc

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: International Features

WM_IME_CHAR

The WM_IME_CHAR message is sent to an application when the IME gets a character of the conversion result. Unlike the WM_CHAR message for a non-Unicode window, this message can include double-byte as well as single-byte character values. For a Unicode window, this message is the same as WM_CHAR.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  WM_IME_CHAR,     // message

  WPARAM wParam,   // character code

  LPARAM lParam    // key indicators

);

Parameters

wParam

DBCS: Specifies a single- or double-byte character value. For a double-byte character, (BYTE)(wParam >> 8) contains the lead byte. Note that the parentheses are necessary because the cast operator has higher precedence than the shift operator.

Unicode: Specifies a Unicode character value.

lParam

Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown following.

Bit

Meaning

0-15

Repeat count: Since the first byte and second byte is continuous, this is always 1.

16-23

Scan code: Scan code for a complete Asian character.

24

Extended key

25-28

Not used.

29

Context code.

30

Previous key state.

31

Transition state.

 

Remarks

For a non-Unicode window, if the WM_IME_CHAR message includes a double-byte character and the application passes this message to DefWindowProc, the IME converts this message into two WM_CHAR messages, each containing one byte of the double-byte character.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Imm.h; include Windows.h.

See Also

Input Method Editor Overview, Input Method Editor Messages, DefWindowProc, WM_CHAR

Built on Tuesday, November 07, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Imm.h; include Windows.h.

See Also

Input Method Editor Overview, Input Method Editor Messages, DefWindowProc, WM_CHAR

 

 

 

 

 

 

 

 

 

   

Platform SDK: International Features

WM_IME_REQUEST

The WM_IME_REQUEST message provides a group of commands to request information from an application.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  WM_IME_REQUEST// message to send

  WPARAM wParam,   // request command

  LPARAM lParam    // command-specific data

);

Parameters

wParam

Request command. This parameter can be one of the following values.

IMR_CANDIDATEWINDOW
IMR_COMPOSITIONFONT
IMR_COMPOSITIONWINDOW
IMR_CONFIRMRECONVERTSTRING
IMR_DOCUMENTFEED
IMR_QUERYCHARPOSITION
IMR_RECONVERTSTRING

lParam

Request-specific data. For more information, see the description for each command.

Return Values

Returns a request-specific value. For more information, see the description for each command.

Requirements

  Windows NT/2000: Requires Windows 2000 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Imm.h; include Windows.h.

See Also

Input Method Editor Overview, Input Method Editor Messages, IMR_CANDIDATEWINDOW, IMR_COMPOSITIONFONT, IMR_COMPOSITIONWINDOW, IMR_CONFIRMRECONVERTSTRING, IMR_DOCUMENTFEED, IMR_QUERYCHARPOSITION, IMR_RECONVERTSTRING

Built on Tuesday, November 07, 2000

Requirements

  Windows NT/2000: Requires Windows 2000 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Imm.h; include Windows.h.

See Also

Input Method Editor Overview, Input Method Editor Messages, IMR_CANDIDATEWINDOW, IMR_COMPOSITIONFONT, IMR_COMPOSITIONWINDOW, IMR_CONFIRMRECONVERTSTRING, IMR_DOCUMENTFEED, IMR_QUERYCHARPOSITION, IMR_RECONVERTSTRING

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: International Features

WM_IME_KEYDOWN

The WM_IME_KEYDOWN message is sent to an application by the IME to notify the application of a key press. An application can process this message or pass it to the DefWindowProc function to generate a matching WM_KEYDOWN message. This message is usually generated by the IME to keep message order.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  WM_IME_KEYDOWN,   // message to send

  WPARAM wParam,   // virtual-key code

  LPARAM lParam    // key data

);

Parameters

wParam

Specifies the virtual-key code of the key.

lParam

Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table.

Bit

Meaning

0-15

Repeat count.

16-23

Scan code.

24

Extended key. This value is 1 if it is an extended key; otherwise, it is zero.

25-28

Not used.

29

Context code. This value is always zero.

30

Previous key state. This value is 1 is the key is down or zero is it is up.

31

Transition state. This value is always zero.

 

Return Values

An application should return zero if it processes this message.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Imm.h; include Windows.h.

See Also

Input Method Editor Overview, Input Method Editor Messages, DefWindowProc, WM_KEYDOWN

Built on Tuesday, November 07, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Imm.h; include Windows.h.

See Also

Input Method Editor Overview, Input Method Editor Messages, DefWindowProc, WM_KEYDOWN

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: International Features

WM_IME_KEYUP

The WM_IME_KEYUP message is sent to an application by the IME to notify the application of a key release. An application can process this message or pass it to the DefWindowProc function to generate a matching WM_KEYUP message. This message is usually generated by the IME to keep message order.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  WM_IME_KEYUP,    // message to send

  WPARAM wParam,   // virtual-key code

  LPARAM lParam    // key data

);

Parameters

wParam

Specifies the virtual-key code of the key.

lParam

Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown following.

Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following.

Bit

Meaning

0-15

Repeat count. This value is always 1.

16-23

Scan code.

24

Extended key. This value is 1 if it is an extended key; otherwise, it is zero.

25-28

Not used.

29

Context code. This value is always zero.

30

Previous key state. This value is always 1.

31

Transition state. This value is always 1.

 

Return Values

An application should return zero if it processes this message.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Imm.h; include Windows.h.

See Also

Input Method Editor Overview, Input Method Editor Messages, DefWindowProc, WM_KEYUP

Built on Tuesday, November 07, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Imm.h; include Windows.h.

See Also

Input Method Editor Overview, Input Method Editor Messages, DefWindowProc, WM_KEYUP

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Windows User Interface

WM_MOUSEHOVER

The WM_MOUSEHOVER message is posted to a window when the cursor hovers over the client area of the window for the period of time specified in a prior call to TrackMouseEvent.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_MOUSEHOVER

  WPARAM wParam,   // key indicator

  LPARAM lParam    // horizontal and vertical position

);

Parameters

wParam

Indicates whether various virtual keys are down. This parameter can be one or more of the following values.

Value

Description

MK_CONTROL

The CTRL key is depressed.

MK_LBUTTON

The left mouse button is depressed.

MK_MBUTTON

The middle mouse button is depressed.

MK_RBUTTON

The right mouse button is depressed.

MK_SHIFT

The SHIFT key is depressed.

MK_XBUTTON1

Windows 2000: The first X button is down.

MK_XBUTTON2

Windows 2000: The second X button is down.

 

lParam

The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

Hover tracking stops when WM_MOUSEHOVER is generated. The application must call TrackMouseEvent again if it requires further tracking of mouse hover behavior.

Use the following code to obtain the horizontal and vertical position:

xPos = GET_X_LPARAM(lParam);

yPos = GET_Y_LPARAM(lParam);

You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, MAKEPOINTS, POINTS, SetCapture, TrackMouseEvent, TRACKMOUSEEVENT, WM_MOUSEHOVER

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GET_X_LPARAM, GET_Y_LPARAM, GetCapture, MAKEPOINTS, POINTS, SetCapture, TrackMouseEvent, TRACKMOUSEEVENT, WM_MOUSEHOVER

 

 

 

 

 

   

Platform SDK: Windows User Interface

WM_MOUSELEAVE

The WM_MOUSELEAVE message is posted to a window when the cursor leaves the client area of the window specified in a prior call to TrackMouseEvent.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_MOUSELEAVE

  WPARAM wParam,   // not used

  LPARAM lParam    // not used

);

Parameters

This message has no parameters.

Return Values

If an application processes this message, it should return zero.

Remarks

All tracking requested by TrackMouseEvent is canceled when this message is generated. The application must call TrackMouseEvent when the mouse reenters its window if it requires further tracking of mouse hover behavior.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GetCapture, SetCapture, TrackMouseEvent, TRACKMOUSEEVENT, WM_NCMOUSELEAVE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 98 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Mouse Input Overview, Mouse Input Messages, GetCapture, SetCapture, TrackMouseEvent, TRACKMOUSEEVENT, WM_NCMOUSELEAVE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Interprocess Communications

WM_CUT

An application sends a WM_CUT message to an edit control or combo box to delete (cut) the current selection, if any, in the edit control and copy the deleted text to the clipboard in CF_TEXT format.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_CUT,                   // message to send

  (WPARAM) wParam,          // not used; must be zero

  (LPARAM) lParam          // not used; must be zero

);

Parameters

This message has no parameters.

Return Values

This message does not return a value.

Remarks

The deletion performed by the WM_CUT message can be undone by sending the edit control an EM_UNDO message.

To delete the current selection without placing the deleted text on the clipboard, use the WM_CLEAR message.

When sent to a combo box, the WM_CUT message is handled by its edit control. This message has no effect when sent to a combo box with the CBS_DROPDOWNLIST style.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, EM_UNDO, WM_CLEAR, WM_COPY, WM_PASTE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, EM_UNDO, WM_CLEAR, WM_COPY, WM_PASTE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Interprocess Communications

WM_COPY

An application sends the WM_COPY message to an edit control or combo box to copy the current selection to the clipboard in CF_TEXT format.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_COPY,                  // message to send

  (WPARAM) wParam,          // not used; must be zero

  (LPARAM) lParam          // not used; must be zero

);

Parameters

This message has no parameters.

Return Values

This message does not return a value.

Remarks

When sent to a combo box, the WM_COPY message is handled by its edit control. This message has no effect when sent to a combo box with the CBS_DROPDOWNLIST style.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, WM_CLEAR, WM_CUT, WM_PASTE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, WM_CLEAR, WM_CUT, WM_PASTE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Interprocess Communications

WM_PASTE

An application sends a WM_PASTE message to an edit control or combo box to copy the current content of the clipboard to the edit control at the current caret position. Data is inserted only if the clipboard contains data in CF_TEXT format.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_PASTE,                 // message to send

  (WPARAM) wParam,          // not used; must be zero

  (LPARAM) lParam          // not used; must be zero

);

Parameters

This message has no parameters.

Return Values

This message does not return a value.

Remarks

When sent to a combo box, the WM_PASTE message is handled by its edit control. This message has no effect when sent to a combo box with the CBS_DROPDOWNLIST style.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, WM_CLEAR, WM_COPY, WM_CUT

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, WM_CLEAR, WM_COPY, WM_CUT

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Interprocess Communications

WM_CLEAR

An application sends a WM_CLEAR message to an edit control or combo box to delete (clear) the current selection, if any, from the edit control.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_CLEAR,                 // message to send

  (WPARAM) wParam,          // not used; must be zero

  (LPARAM) lParam          // not used; must be zero

);

Parameters

This message has no parameters.

Return Values

This message does not return a value.

Remarks

The deletion performed by the WM_CLEAR message can be undone by sending the edit control an EM_UNDO message.

To delete the current selection and place the deleted content on the clipboard, use the WM_CUT message.

When sent to a combo box, the WM_CLEAR message is handled by its edit control. This message has no effect when sent to a combo box with the CBS_DROPDOWNLIST style.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, EM_UNDO, WM_COPY, WM_CUT, WM_PASTE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, EM_UNDO, WM_COPY, WM_CUT, WM_PASTE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Windows User Interface

WM_UNDO

An application sends a WM_UNDO message to an edit control to undo the last operation. When this message is sent to an edit control, the previously deleted text is restored or the previously added text is deleted.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

  (HWND) hWnd,              // handle to destination window

  WM_UNDO,                  // message to send

  (WPARAM) wParam,          // not used; must be zero

  (LPARAM) lParam          // not used; must be zero

);

Parameters

This message has no parameters.

Return Values

If the message succeeds, the return value is TRUE.

If the message fails, the return value is FALSE.

Remarks

Rich Edit: This message is not supported.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Edit Controls Overview, Edit Control Messages, WM_CLEAR, WM_COPY, WM_CUT, WM_PASTE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Edit Controls Overview, Edit Control Messages, WM_CLEAR, WM_COPY, WM_CUT, WM_PASTE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Interprocess Communications

WM_RENDERFORMAT

The WM_RENDERFORMAT message is sent to the clipboard owner if it has delayed rendering a specific clipboard format and if an application has requested data in that format. The clipboard owner must render data in the specified format and place it on the clipboard by calling the SetClipboardData function.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_RENDERFORMAT

  WPARAM wParam,   // clipboard format (UINT)

  LPARAM lParam    // not used

);

Parameters

wParam

Specifies the clipboard format to be rendered.

lParam

This parameter is not used.

Return Values

If an application processes this message, it should return zero.

Remarks

When responding to a WM_RENDERFORMAT message, the clipboard owner must not open the clipboard before calling SetClipboardData.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, SetClipboardData, WM_RENDERALLFORMATS

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, SetClipboardData, WM_RENDERALLFORMATS

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Interprocess Communications

WM_RENDERALLFORMATS

The WM_RENDERALLFORMATS message is sent to the clipboard owner before it is destroyed, if the clipboard owner has delayed rendering one or more clipboard formats. For the content of the clipboard to remain available to other applications, the clipboard owner must render data in all the formats it is capable of generating, and place the data on the clipboard by calling the SetClipboardData function.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_RENDERALLFORMATS

  WPARAM wParam,   // not used

  LPARAM lParam    // not used

);

Parameters

This message has no parameters.

Return Values

If an application processes this message, it should return zero.

Remarks

When responding to a WM_RENDERALLFORMATS message, the clipboard owner must call the OpenClipboard and EmptyClipboard functions before calling SetClipboardData.

When the application returns, the system removes any unrendered formats from the list of available clipboard formats. For information about delayed rendering, see SetClipboardData.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, EmptyClipboard, OpenClipboard, SetClipboardData, WM_RENDERFORMAT

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, EmptyClipboard, OpenClipboard, SetClipboardData, WM_RENDERFORMAT

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Interprocess Communications

WM_DESTROYCLIPBOARD

The WM_DESTROYCLIPBOARD message is sent to the clipboard owner when a call to the EmptyClipboard function empties the clipboard.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_DESTROYCLIPBOARD

  WPARAM wParam,   // not used

  LPARAM lParam    // not used

);

Parameters

This message has no parameters.

Return Values

If an application processes this message, it should return zero.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, EmptyClipboard

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, EmptyClipboard

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Interprocess Communications

WM_DRAWCLIPBOARD

The WM_DRAWCLIPBOARD message is sent to the first window in the clipboard viewer chain when the content of the clipboard changes. This enables a clipboard viewer window to display the new content of the clipboard.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_DRAWCLIPBOARD

  WPARAM wParam,   // not used

  LPARAM lParam    // not used

);

Parameters

This message has no parameters.

Remarks

Only clipboard viewer windows receive this message. These are windows that have been added to the clipboard viewer chain by using the SetClipboardViewer function.

Each window that receives the WM_DRAWCLIPBOARD message must call the SendMessage function to pass the message on to the next window in the clipboard viewer chain. The handle to the next window in the chain is returned by SetClipboardViewer, and may change in response to a WM_CHANGECBCHAIN message.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, SendMessage, SetClipboardViewer, WM_CHANGECBCHAIN

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, SendMessage, SetClipboardViewer, WM_CHANGECBCHAIN

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Interprocess Communications

WM_PAINTCLIPBOARD

The WM_PAINTCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area needs repainting.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_PAINTCLIPBOARD

  WPARAM wParam,   // handle to window (HWND)

  LPARAM lParam    // handle to memory object (HGLOBAL)

);

Parameters

wParam

Handle to the clipboard viewer window.

lParam

Handle to a global memory object that contains a PAINTSTRUCT structure. The structure defines the part of the client area to paint.

Return Values

If an application processes this message, it should return zero.

Remarks

To determine whether the entire client area or just a portion of it needs repainting, the clipboard owner must compare the dimensions of the drawing area given in the rcpaint member of PAINTSTRUCT to the dimensions given in the most recent WM_SIZECLIPBOARD message.

The clipboard owner must use the GlobalLock function to lock the memory that contains the PAINTSTRUCT structure. Before returning, the clipboard owner must unlock that memory by using the GlobalUnlock function.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, GlobalLock, GlobalUnlock, PAINTSTRUCT, WM_SIZECLIPBOARD

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, GlobalLock, GlobalUnlock, PAINTSTRUCT, WM_SIZECLIPBOARD

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Interprocess Communications

WM_VSCROLLCLIPBOARD

The WM_VSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's vertical scroll bar. The owner should scroll the clipboard image and update the scroll bar values.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,      // handle to window

  UINT uMsg,      // WM_VSCROLLCLIPBOARD

  WPARAM wParam// handle to window (HWND)

  LPARAM lParam   // scroll bar code and scroll box position

);

Parameters

wParam

Handle to the clipboard viewer window.

lParam

The low-order word of lParam specifies a scroll bar event. This parameter can be one of the following values.

Value

Meaning

SB_BOTTOM

Scroll to lower right.

SB_ENDSCROLL

End scroll.

SB_LINEDOWN

Scroll one line down.

SB_LINEUP

Scroll one line up.

SB_PAGEDOWN

Scroll one page down.

SB_PAGEUP

Scroll one page up.

SB_THUMBPOSITION

Scroll to absolute position. The current position is specified by the high-order word.

SB_TOP

Scroll to upper left.

 

The high-order word of lParam specifies the current position of the scroll box if the low-order word of lParam is SB_THUMBPOSITION; otherwise, the high-order word of lParam is not used.

Return Values

If an application processes this message, it should return zero.

Remarks

The clipboard owner can use the ScrollWindow function to scroll the image in the clipboard viewer window and invalidate the appropriate region.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, HIWORD, LOWORD, ScrollWindow

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, HIWORD, LOWORD, ScrollWindow

 

 

 

 

 

 

 

 

 

   

Platform SDK: Interprocess Communications

WM_SIZECLIPBOARD

The WM_SIZECLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area has changed size.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_SIZECLIPBOARD

  WPARAM wParam,   // handle to window (HWND)

  LPARAM lParam    // handle to memory object (HGLOBAL)

);

Parameters

wParam

Handle to the clipboard viewer window.

lParam

Handle to a global memory object that contains a RECT structure. The structure specifies the new dimensions of the clipboard viewer's client area.

Return Values

If an application processes this message, it should return zero.

Remarks

When the clipboard viewer window is about to be destroyed or resized, a WM_SIZECLIPBOARD message is sent with a null rectangle (0, 0, 0, 0) as the new size. This permits the clipboard owner to free its display resources.

The clipboard owner must use the GlobalLock function to lock the memory object that contains RECT. Before returning, the clipboard owner must unlock the object by using the GlobalUnlock function.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, GlobalLock, GlobalUnlock, RECT

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, GlobalLock, GlobalUnlock, RECT

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Interprocess Communications

WM_ASKCBFORMATNAME

The WM_ASKCBFORMATNAME message is sent to the clipboard owner by a clipboard viewer window to request the name of a CF_OWNERDISPLAY clipboard format.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_ASKCBFORMATNAME

  WPARAM wParam,   // size of buffer

  LPARAM lParam    // format name (LPTSTR)

);

Parameters

wParam

Specifies the size, in characters, of the buffer pointed to by the lParam parameter.

lParam

Pointer to the buffer that is to receive the clipboard format name.

Return Values

If an application processes this message, it should return zero.

Remarks

In response to this message, the clipboard owner should copy the name of the owner-display format to the specified buffer, not exceeding the buffer size specified by the wParam parameter.

A clipboard viewer window sends this message to the clipboard owner to determine the name of the CF_OWNERDISPLAY format — for example, to initialize a menu listing available formats.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Interprocess Communications

WM_CHANGECBCHAIN

The WM_CHANGECBCHAIN message is sent to the first window in the clipboard viewer chain when a window is being removed from the chain.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_CHANGECBCHAIN

  WPARAM wParam,   // handle to window to be removed (HWND)

  LPARAM lParam    // handle to next window in chain (HWND)

);

Parameters

wParam

Handle to the window being removed from the clipboard viewer chain.

lParam

Handle to the next window in the chain following the window being removed. This parameter is NULL if the window being removed is the last window in the chain.

Return Values

If an application processes this message, it should return zero.

Remarks

Each clipboard viewer window saves the handle to the next window in the clipboard viewer chain. Initially, this handle is the return value of the SetClipboardViewer function.

When a clipboard viewer window receives the WM_CHANGECBCHAIN message, it should call the SendMessage function to pass the message to the next window in the chain, unless the next window is the window being removed. In this case, the clipboard viewer should save the handle specified by the lParam parameter as the next window in the chain.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, SendMessage, SetClipboardViewer

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, SendMessage, SetClipboardViewer

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Interprocess Communications

WM_HSCROLLCLIPBOARD

The WM_HSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window. This occurs when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's horizontal scroll bar. The owner should scroll the clipboard image and update the scroll bar values.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,      // handle to window

  UINT uMsg,      // WM_HSCROLLCLIPBOARD

  WPARAM wParam// handle to window (HWND)

  LPARAM lParam   // scroll bar code and scroll box position

);

Parameters

wParam

Handle to the clipboard viewer window.

lParam

The low-order word of lParam specifies a scroll bar event. This parameter can be one of the following values.

Value

Meaning

SB_ENDSCROLL

End scroll.

SB_LEFT

Scroll to upper left.

SB_RIGHT

Scroll to lower right.

SB_LINELEFT

Scrolls left by one unit.

SB_LINERIGHT

Scrolls right by one unit.

SB_PAGELEFT

Scrolls left by the width of the window.

SB_PAGERIGHT

Scrolls right by the width of the window.

SB_THUMBPOSITION

Scroll to absolute position. The current position is specified by the high-order word.

 

The high-order word of lParam specifies the current position of the scroll box if the low-order word of lParam is SB_THUMBPOSITION; otherwise, the high-order word is not used.

Return Values

If an application processes this message, it should return zero.

Remarks

The clipboard owner can use the ScrollWindow function to scroll the image in the clipboard viewer window and invalidate the appropriate region.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, HIWORD, LOWORD, ScrollWindow

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Clipboard Overview, Clipboard Messages, HIWORD, LOWORD, ScrollWindow

 

 

 

 

 

 

 

 

 

   

Platform SDK: Windows GDI

WM_QUERYNEWPALETTE

The WM_QUERYNEWPALETTE message informs a window that it is about to receive the keyboard focus, giving the window the opportunity to realize its logical palette when it receives the focus.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_QUERYNEWPALETTE

  WPARAM wParam,   // not used

  LPARAM lParam    // not used

);

Parameters

This message has no parameters.

Return Values

If the window realizes its logical palette, it must return TRUE; otherwise, it must return FALSE.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Colors Overview, Color Messages, WM_PALETTECHANGED, WM_PALETTEISCHANGING

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Colors Overview, Color Messages, WM_PALETTECHANGED, WM_PALETTEISCHANGING

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Windows GDI

WM_PALETTECHANGED

The WM_PALETTECHANGED message is sent to all top-level and overlapped windows after the window with the keyboard focus has realized its logical palette, thereby changing the system palette. This message enables a window that uses a color palette but does not have the keyboard focus to realize its logical palette and update its client area.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_PALETTECHANGED

  WPARAM wParam,   // handle to window (HWND)

  LPARAM lParam    // not used

);

Parameters

wParam

Handle to the window that caused the system palette to change.

lParam

This parameter is not used.

Remarks

This message must be sent to all top-level and overlapped windows, including the one that changed the system palette. If any child windows use a color palette, this message must be passed on to them as well.

To avoid creating an infinite loop, a window that receives this message must not realize its palette, unless it determines that wParam does not contain its own window handle.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Colors Overview, Color Messages, WM_PALETTEISCHANGING, WM_QUERYNEWPALETTE

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Colors Overview, Color Messages, WM_PALETTEISCHANGING, WM_QUERYNEWPALETTE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Windows User Interface

WM_HOTKEY

The WM_HOTKEY message is posted when the user presses a hot key registered by the RegisterHotKeyfunction. The message is placed at the top of the message queue associated with the thread that registered the hot key.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_HOTKEY

  WPARAM wParam,   // hot key identifier

  LPARAM lParam    // options and virtual-key code

);

Parameters

wParam

Specifies the identifier of the hot key that generated the message. If the message was generated by a system-defined hot key, this parameter will be one of the following values.

Value

Meaning

IDHOT_SNAPDESKTOP

The "snap desktop" hot key was pressed.

IDHOT_SNAPWINDOW

The "snap window" hot key was pressed.

 

lParam

The low-order word specifies the keys that were to be pressed in combination with the key specified by the high-order word to generate the WM_HOTKEY message. This word can be one or more of the following values.

Value

Meaning

MOD_ALT

Either ALT key was held down.

MOD_CONTROL

Either CTRL key was held down.

MOD_SHIFT

Either SHIFT key was held down.

MOD_WIN

Either WINDOWS key was held down. These keys are labeled with the Microsoft Windows logo.

 

The high-order word specifies the virtual key code of the hot key.

Remarks

WM_HOTKEY is unrelated to the WM_GETHOTKEY and WM_SETHOTKEY hot keys. The WM_HOTKEY message is sent for generic hot keys while the WM_SETHOTKEY and WM_GETHOTKEY messages relate to window activation hot keys.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, RegisterHotKey, WM_GETHOTKEY, WM_SETHOTKEY

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Keyboard Input Overview, Keyboard Input Messages, RegisterHotKey, WM_GETHOTKEY, WM_SETHOTKEY

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Windows GDI

WM_PRINT

The WM_PRINT message is sent to a window to request that it draw itself in the specified device context, most commonly in a printer device context.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_PRINT

  WPARAM wParam,   // handle to DC (HDC)

  LPARAM lParam    // drawing options

);

Parameters

wParam

Handle to the device context to draw in.

lParam

Specifies the drawing options. This parameter can be one or more of the following values.

Value

Meaning

PRF_CHECKVISIBLE

Draws the window only if it is visible.

PRF_CHILDREN

Draws all visible children windows.

PRF_CLIENT

Draws the client area of the window.

PRF_ERASEBKGND

Erases the background before drawing the window.

PRF_NONCLIENT

Draws the nonclient area of the window.

PRF_OWNED

Draws all owned windows.

 

Remarks

The DefWindowProc function processes this message based on which drawing option is specified: if PRF_CHECKVISIBLE is specified and the window is not visible, do nothing, if PRF_NONCLIENT is specified, draw the nonclient area in the specified device context, if PRF_ERASEBKGND is specified, send the window a WM_ERASEBKGND message, if PRF_CLIENT is specified, send the window a WM_PRINTCLIENT message, if PRF_CHILDREN is set, send each visible child window a WM_PRINT message, if PRF_OWNED is set, send each visible owned window a WM_PRINT message.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Painting and Drawing Overview, Painting and Drawing Messages, DefWindowProc, WM_ERASEBKGND, WM_PRINTCLIENT

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Painting and Drawing Overview, Painting and Drawing Messages, DefWindowProc, WM_ERASEBKGND, WM_PRINTCLIENT

 

 

 

 

 

 

 

 

 

 

 

 

   

Platform SDK: Windows GDI

WM_PRINTCLIENT

The WM_PRINTCLIENT message is sent to a window to request that it draw its client area in the specified device context, most commonly in a printer device context.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(

  HWND hwnd,       // handle to window

  UINT uMsg,       // WM_PRINTCLIENT

  WPARAM wParam,   // handle to DC (HDC)

  LPARAM lParam    // drawing options

);

Parameters

wParam

Handle to the device context to draw in.

lParam

Specifies drawing options. This parameter can be one or more of the following values.

Value

Meaning

PRF_CHECKVISIBLE

Draws the window only if it is visible.

PRF_CHILDREN

Draws all visible children windows.

PRF_CLIENT

Draws the client area of the window.

PRF_ERASEBKGND

Erases the background before drawing the window.

PRF_NONCLIENT

Draws the nonclient area of the window.

PRF_OWNED

Draws all owned windows.

 

Remarks

A window can process this message in much the same manner as WM_PAINT, except that BeginPaint and EndPaint need not be called (a device context is provided), and the window should draw its entire client area rather than just the invalid region.

Windows that can be used anywhere in the system, such as controls, should process this message. It is probably worthwhile for other windows to process this message as well because it is relatively easy to implement.

The AnimateWindow function requires that the window being animated implement the WM_PRINTCLIENT message.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Painting and Drawing Overview, Painting and Drawing Messages, AnimateWindow, BeginPaint, EndPaint, WM_PAINT

Built on Thursday, October 12, 2000

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Painting and Drawing Overview, Painting and Drawing Messages, AnimateWindow, BeginPaint, EndPaint, WM_PAINT

原文地址:https://www.cnblogs.com/qiyebao/p/2507761.html