0% found this document useful (0 votes)
191 views

Win API

Uploaded by

paliadoyo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
191 views

Win API

Uploaded by

paliadoyo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 826

Contents

Windows and Messages


Olectl.h
Overview
Winbase.h
Overview
WinMain function
Windef.h
Overview
Windowsx.h
Overview
GET_X_LPARAM macro
GET_Y_LPARAM macro
Winuser.h
Overview
AdjustWindowRect function
AdjustWindowRectEx function
AllowSetForegroundWindow function
ALTTABINFO structure
AnimateWindow function
ANIMATIONINFO structure
AnyPopup function
ArrangeIconicWindows function
AUDIODESCRIPTION structure
BeginDeferWindowPos function
BringWindowToTop function
BroadcastSystemMessage function
BroadcastSystemMessageExA function
BroadcastSystemMessageExW function
BroadcastSystemMessageW function
BSMINFO structure
CalculatePopupWindowPosition function
CallMsgFilterA function
CallMsgFilterW function
CallNextHookEx function
CallWindowProcA function
CallWindowProcW function
CascadeWindows function
CBT_CREATEWNDA structure
CBT_CREATEWNDW structure
CBTACTIVATESTRUCT structure
CHANGEFILTERSTRUCT structure
ChangeWindowMessageFilter function
ChangeWindowMessageFilterEx function
ChildWindowFromPoint function
ChildWindowFromPointEx function
CLIENTCREATESTRUCT structure
CloseWindow function
CreateMDIWindowA function
CreateMDIWindowW function
CREATESTRUCTA structure
CREATESTRUCTW structure
CreateWindowA macro
CreateWindowExA function
CreateWindowExW function
CreateWindowW macro
CWPRETSTRUCT structure
CWPSTRUCT structure
DEBUGHOOKINFO structure
DeferWindowPos function
DefFrameProcA function
DefFrameProcW function
DefMDIChildProcA function
DefMDIChildProcW function
DefWindowProcA function
DefWindowProcW function
DeregisterShellHookWindow function
DestroyWindow function
DispatchMessage function
DispatchMessageA function
DispatchMessageW function
EndDeferWindowPos function
EndTask function
EnumChildWindows function
EnumPropsA function
EnumPropsExA function
EnumPropsExW function
EnumPropsW function
EnumThreadWindows function
EnumWindows function
EVENTMSG structure
FindWindowA function
FindWindowExA function
FindWindowExW function
FindWindowW function
GetAltTabInfoA function
GetAltTabInfoW function
GetAncestor function
GetClassInfoA function
GetClassInfoExA function
GetClassInfoExW function
GetClassInfoW function
GetClassLongA function
GetClassLongPtrA function
GetClassLongPtrW function
GetClassLongW function
GetClassName function
GetClassNameA function
GetClassNameW function
GetClassWord function
GetClientRect function
GetDesktopWindow function
GetForegroundWindow function
GetGUIThreadInfo function
GetInputState function
GetLastActivePopup function
GetLayeredWindowAttributes function
GetMessage function
GetMessageA function
GetMessageExtraInfo function
GetMessagePos function
GetMessageTime function
GetMessageW function
GetNextWindow macro
GetParent function
GetProcessDefaultLayout function
GetPropA function
GetPropW function
GetQueueStatus function
GetShellWindow function
GetSysColor function
GetSystemMetrics function
GetTitleBarInfo function
GetTopWindow function
GetWindow function
GetWindowDisplayAffinity function
GetWindowInfo function
GetWindowLongA function
GetWindowLongPtrA function
GetWindowLongPtrW function
GetWindowLongW function
GetWindowModuleFileNameA function
GetWindowModuleFileNameW function
GetWindowPlacement function
GetWindowRect function
GetWindowTextA function
GetWindowTextLengthA function
GetWindowTextLengthW function
GetWindowTextW function
GetWindowThreadProcessId function
GUITHREADINFO structure
HOOKPROC callback function
InSendMessage function
InSendMessageEx function
InternalGetWindowText function
IsChild function
IsGUIThread function
IsHungAppWindow function
IsIconic function
IsProcessDPIAware function
IsWindow function
IsWindowUnicode function
IsWindowVisible function
IsZoomed function
KBDLLHOOKSTRUCT structure
KillTimer function
LockSetForegroundWindow function
LogicalToPhysicalPoint function
MAKELPARAM macro
MAKELRESULT macro
MAKEWPARAM macro
MDICREATESTRUCTA structure
MDICREATESTRUCTW structure
MINIMIZEDMETRICS structure
MINMAXINFO structure
MOUSEHOOKSTRUCT structure
MOUSEHOOKSTRUCTEX structure
MoveWindow function
MSG structure
MSLLHOOKSTRUCT structure
NCCALCSIZE_PARAMS structure
NONCLIENTMETRICSA structure
NONCLIENTMETRICSW structure
OpenIcon function
PeekMessageA function
PeekMessageW function
PhysicalToLogicalPoint function
PostMessageA function
PostMessageW function
PostQuitMessage function
PostThreadMessageA function
PostThreadMessageW function
PROPENUMPROCA callback function
PROPENUMPROCEXA callback function
PROPENUMPROCEXW callback function
PROPENUMPROCW callback function
RealChildWindowFromPoint function
RealGetWindowClassW function
RegisterClassA function
RegisterClassExA function
RegisterClassExW function
RegisterClassW function
RegisterShellHookWindow function
RegisterWindowMessageA function
RegisterWindowMessageW function
RemovePropA function
RemovePropW function
ReplyMessage function
SENDASYNCPROC callback function
SendMessage function
SendMessageA function
SendMessageCallbackA function
SendMessageCallbackW function
SendMessageTimeoutA function
SendMessageTimeoutW function
SendMessageW function
SendNotifyMessageA function
SendNotifyMessageW function
SetClassLongA function
SetClassLongPtrA function
SetClassLongPtrW function
SetClassLongW function
SetClassWord function
SetCoalescableTimer function
SetForegroundWindow function
SetLayeredWindowAttributes function
SetMessageExtraInfo function
SetParent function
SetProcessDefaultLayout function
SetProcessDPIAware function
SetPropA function
SetPropW function
SetSysColors function
SetTimer function
SetWindowDisplayAffinity function
SetWindowLongA function
SetWindowLongPtrA function
SetWindowLongPtrW function
SetWindowLongW function
SetWindowPlacement function
SetWindowPos function
SetWindowsHookExA function
SetWindowsHookExW function
SetWindowTextA function
SetWindowTextW function
ShowOwnedPopups function
ShowWindow function
ShowWindowAsync function
SoundSentry function
STYLESTRUCT structure
SwitchToThisWindow function
SystemParametersInfoA function
SystemParametersInfoW function
TileWindows function
TIMERPROC callback function
TITLEBARINFO structure
TITLEBARINFOEX structure
TranslateMDISysAccel function
TranslateMessage function
UnhookWindowsHookEx function
UnregisterClassA function
UnregisterClassW function
UpdateLayeredWindow function
UPDATELAYEREDWINDOWINFO structure
WaitMessage function
WindowFromPhysicalPoint function
WindowFromPoint function
WINDOWINFO structure
WINDOWPLACEMENT structure
WINDOWPOS structure
WNDCLASSA structure
WNDCLASSEXA structure
WNDCLASSEXW structure
WNDCLASSW structure
Windows and Messages
2/1/2021 • 22 minutes to read • Edit Online

Overview of the Windows and Messages technology.


The Windows and Messages technology is not associated with any headers.
For programming guidance for this technology, see:
Windows and Messages

Functions
T IT L E DESC RIP T IO N

AdjustWindowRect Calculates the required size of the window rectangle, based


on the desired client-rectangle size. The window rectangle
can then be passed to the CreateWindow function to create
a window whose client area is the desired size.

AdjustWindowRectEx Calculates the required size of the window rectangle, based


on the desired size of the client rectangle. The window
rectangle can then be passed to the CreateWindowEx
function to create a window whose client area is the desired
size.

AllowSetForegroundWindow Enables the specified process to set the foreground window


using the SetForegroundWindow function. The calling
process must already be able to set the foreground window.
For more information, see Remarks later in this topic.

AnimateWindow Enables you to produce special effects when showing or


hiding windows. There are four types of animation:_roll, slide,
collapse or expand, and alpha-blended fade.

AnyPopup Indicates whether an owned, visible, top-level pop-up, or


overlapped window exists on the screen. The function
searches the entire screen, not just the calling application's
client area.

ArrangeIconicWindows Arranges all the minimized (iconic) child windows of the


specified parent window.

BeginDeferWindowPos Allocates memory for a multiple-window- position structure


and returns the handle to the structure.

BringWindowToTop Brings the specified window to the top of the Z order. If the
window is a top-level window, it is activated. If the window is
a child window, the top-level parent window associated with
the child window is activated.

BroadcastSystemMessage Sends a message to the specified recipients.


T IT L E DESC RIP T IO N

BroadcastSystemMessageExA Sends a message to the specified recipients.

BroadcastSystemMessageExW Sends a message to the specified recipients.

BroadcastSystemMessageW Sends a message to the specified recipients.

CalculatePopupWindowPosition Calculates an appropriate pop-up window position using the


specified anchor point, pop-up window size, flags, and the
optional exclude rectangle.

CallMsgFilterA Passes the specified message and hook code to the hook
procedures associated with the WH_SYSMSGFILTER and
WH_MSGFILTER hooks.

CallMsgFilterW Passes the specified message and hook code to the hook
procedures associated with the WH_SYSMSGFILTER and
WH_MSGFILTER hooks.

CallNextHookEx Passes the hook information to the next hook procedure in


the current hook chain. A hook procedure can call this
function either before or after processing the hook
information.

CallWindowProcA Passes message information to the specified window


procedure.

CallWindowProcW Passes message information to the specified window


procedure.

CascadeWindows Cascades the specified child windows of the specified parent


window.

ChangeWindowMessageFilter Adds or removes a message from the User Interface


Privilege Isolation (UIPI) message filter.

ChangeWindowMessageFilterEx Modifies the User Interface Privilege Isolation (UIPI) message


filter for a specified window.

ChildWindowFromPoint Determines which, if any, of the child windows belonging to


a parent window contains the specified point. The search is
restricted to immediate child windows. Grandchildren, and
deeper descendant windows are not searched.

ChildWindowFromPointEx Determines which, if any, of the child windows belonging to


the specified parent window contains the specified point.

CloseWindow Minimizes (but does not destroy) the specified window.

CreateMDIWindowA Creates a multiple-document interface (MDI) child window.

CreateMDIWindowW Creates a multiple-document interface (MDI) child window.

CreateWindowA Creates an overlapped, pop-up, or child window.


T IT L E DESC RIP T IO N

CreateWindowExA Creates an overlapped, pop-up, or child window with an


extended window style; otherwise, this function is identical
to the CreateWindow function.

CreateWindowExW Creates an overlapped, pop-up, or child window with an


extended window style; otherwise, this function is identical
to the CreateWindow function.

CreateWindowW Creates an overlapped, pop-up, or child window.

DeferWindowPos Updates the specified multiple-window � position structure


for the specified window.

DefFrameProcA Provides default processing for any window messages that


the window procedure of a multiple-document interface
(MDI) frame window does not process.

DefFrameProcW Provides default processing for any window messages that


the window procedure of a multiple-document interface
(MDI) frame window does not process.

DefMDIChildProcA Provides default processing for any window message that


the window procedure of a multiple-document interface
(MDI) child window does not process.

DefMDIChildProcW Provides default processing for any window message that


the window procedure of a multiple-document interface
(MDI) child window does not process.

DefWindowProcA Calls the default window procedure to provide default


processing for any window messages that an application
does not process.

DefWindowProcW Calls the default window procedure to provide default


processing for any window messages that an application
does not process.

DeregisterShellHookWindow Unregisters a specified Shell window that is registered to


receive Shell hook messages.

DestroyWindow Destroys the specified window.

DispatchMessage Dispatches a message to a window procedure. It is typically


used to dispatch a message retrieved by the GetMessage
function.

DispatchMessageA Dispatches a message to a window procedure. It is typically


used to dispatch a message retrieved by the GetMessage
function.

DispatchMessageW Dispatches a message to a window procedure. It is typically


used to dispatch a message retrieved by the GetMessage
function.
T IT L E DESC RIP T IO N

EndDeferWindowPos Simultaneously updates the position and size of one or more


windows in a single screen-refreshing cycle.

EndTask Forcibly closes the specified window.

EnumChildWindows Enumerates the child windows that belong to the specified


parent window by passing the handle to each child window,
in turn, to an application-defined callback function.

EnumPropsA Enumerates all entries in the property list of a window by


passing them, one by one, to the specified callback function.
EnumProps continues until the last entry is enumerated or
the callback function returns FALSE.

EnumPropsExA Enumerates all entries in the property list of a window by


passing them, one by one, to the specified callback function.
EnumPropsEx continues until the last entry is enumerated or
the callback function returns FALSE.

EnumPropsExW Enumerates all entries in the property list of a window by


passing them, one by one, to the specified callback function.
EnumPropsEx continues until the last entry is enumerated or
the callback function returns FALSE.

EnumPropsW Enumerates all entries in the property list of a window by


passing them, one by one, to the specified callback function.
EnumProps continues until the last entry is enumerated or
the callback function returns FALSE.

EnumThreadWindows Enumerates all nonchild windows associated with a thread


by passing the handle to each window, in turn, to an
application-defined callback function.

EnumWindows Enumerates all top-level windows on the screen by passing


the handle to each window, in turn, to an application-defined
callback function. EnumWindows continues until the last
top-level window is enumerated or the callback function
returns FALSE.

FindWindowA Retrieves a handle to the top-level window whose class


name and window name match the specified strings. This
function does not search child windows. This function does
not perform a case-sensitive search.

FindWindowExA Retrieves a handle to a window whose class name and


window name match the specified strings. The function
searches child windows, beginning with the one following
the specified child window. This function does not perform a
case-sensitive search.

FindWindowExW Retrieves a handle to a window whose class name and


window name match the specified strings. The function
searches child windows, beginning with the one following
the specified child window. This function does not perform a
case-sensitive search.
T IT L E DESC RIP T IO N

FindWindowW Retrieves a handle to the top-level window whose class


name and window name match the specified strings. This
function does not search child windows. This function does
not perform a case-sensitive search.

GET_X_LPARAM Retrieves the signed x-coordinate from the specified


LPARAM value.

GET_Y_LPARAM Retrieves the signed y-coordinate from the given LPARAM


value.

GetAltTabInfoA Retrieves status information for the specified window if it is


the application-switching (ALT+TAB) window.

GetAltTabInfoW Retrieves status information for the specified window if it is


the application-switching (ALT+TAB) window.

GetAncestor Retrieves the handle to the ancestor of the specified window.

GetClassInfoA Retrieves information about a window class.

GetClassInfoExA Retrieves information about a window class, including a


handle to the small icon associated with the window class.
The GetClassInfo function does not retrieve a handle to the
small icon.

GetClassInfoExW Retrieves information about a window class, including a


handle to the small icon associated with the window class.
The GetClassInfo function does not retrieve a handle to the
small icon.

GetClassInfoW Retrieves information about a window class.

GetClassLongA Retrieves the specified 32-bit (DWORD) value from the


WNDCLASSEX structure associated with the specified
window.

GetClassLongPtrA Retrieves the specified value from the WNDCLASSEX


structure associated with the specified window.

GetClassLongPtrW Retrieves the specified value from the WNDCLASSEX


structure associated with the specified window.

GetClassLongW Retrieves the specified 32-bit (DWORD) value from the


WNDCLASSEX structure associated with the specified
window.

GetClassName Retrieves the name of the class to which the specified


window belongs.

GetClassNameA Retrieves the name of the class to which the specified


window belongs.
T IT L E DESC RIP T IO N

GetClassNameW Retrieves the name of the class to which the specified


window belongs.

GetClassWord Retrieves the 16-bit (WORD) value at the specified offset into
the extra class memory for the window class to which the
specified window belongs.

GetClientRect Retrieves the coordinates of a window's client area.

GetDesktopWindow Retrieves a handle to the desktop window. The desktop


window covers the entire screen. The desktop window is the
area on top of which other windows are painted.

GetForegroundWindow Retrieves a handle to the foreground window (the window


with which the user is currently working). The system assigns
a slightly higher priority to the thread that creates the
foreground window than it does to other threads.

GetGUIThreadInfo Retrieves information about the active window or a specified


GUI thread.

GetInputState Determines whether there are mouse-button or keyboard


messages in the calling thread's message queue.

GetLastActivePopup Determines which pop-up window owned by the specified


window was most recently active.

GetLayeredWindowAttributes Retrieves the opacity and transparency color key of a layered


window.

GetMessage Retrieves a message from the calling thread's message


queue. The function dispatches incoming sent messages
until a posted message is available for retrieval.

GetMessageA Retrieves a message from the calling thread's message


queue. The function dispatches incoming sent messages
until a posted message is available for retrieval.

GetMessageExtraInfo Retrieves the extra message information for the current


thread. Extra message information is an application- or
driver-defined value associated with the current thread's
message queue.

GetMessagePos Retrieves the cursor position for the last message retrieved
by the GetMessage function.

GetMessageTime Retrieves the message time for the last message retrieved by
the GetMessage function.

GetMessageW Retrieves a message from the calling thread's message


queue. The function dispatches incoming sent messages
until a posted message is available for retrieval.
T IT L E DESC RIP T IO N

GetNextWindow Retrieves a handle to the next or previous window in the Z-


Order. The next window is below the specified window; the
previous window is above.

GetParent Retrieves a handle to the specified window's parent or owner.

GetProcessDefaultLayout Retrieves the default layout that is used when windows are
created with no parent or owner.

GetPropA Retrieves a data handle from the property list of the


specified window. The character string identifies the handle
to be retrieved. The string and handle must have been
added to the property list by a previous call to the SetProp
function.

GetPropW Retrieves a data handle from the property list of the


specified window. The character string identifies the handle
to be retrieved. The string and handle must have been
added to the property list by a previous call to the SetProp
function.

GetQueueStatus Retrieves the type of messages found in the calling thread's


message queue.

GetShellWindow Retrieves a handle to the Shell's desktop window.

GetSysColor Retrieves the current color of the specified display element.

GetSystemMetrics Retrieves the specified system metric or system configuration


setting.

GetTitleBarInfo Retrieves information about the specified title bar.

GetTopWindow Examines the Z order of the child windows associated with


the specified parent window and retrieves a handle to the
child window at the top of the Z order.

GetWindow Retrieves a handle to a window that has the specified


relationship (Z-Order or owner) to the specified window.

GetWindowDisplayAffinity Retrieves the current display affinity setting, from any


process, for a given window.

GetWindowInfo Retrieves information about the specified window.

GetWindowLongA Retrieves information about the specified window.

GetWindowLongPtrA Retrieves information about the specified window. The


function also retrieves the value at a specified offset into the
extra window memory.

GetWindowLongPtrW Retrieves information about the specified window. The


function also retrieves the value at a specified offset into the
extra window memory.
T IT L E DESC RIP T IO N

GetWindowLongW Retrieves information about the specified window.

GetWindowModuleFileNameA Retrieves the full path and file name of the module
associated with the specified window handle.

GetWindowModuleFileNameW Retrieves the full path and file name of the module
associated with the specified window handle.

GetWindowPlacement Retrieves the show state and the restored, minimized, and
maximized positions of the specified window.

GetWindowRect Retrieves the dimensions of the bounding rectangle of the


specified window. The dimensions are given in screen
coordinates that are relative to the upper-left corner of the
screen.

GetWindowTextA Copies the text of the specified window's title bar (if it has
one) into a buffer. If the specified window is a control, the
text of the control is copied. However, GetWindowText
cannot retrieve the text of a control in another application.

GetWindowTextLengthA Retrieves the length, in characters, of the specified window's


title bar text (if the window has a title bar).

GetWindowTextLengthW Retrieves the length, in characters, of the specified window's


title bar text (if the window has a title bar).

GetWindowTextW Copies the text of the specified window's title bar (if it has
one) into a buffer. If the specified window is a control, the
text of the control is copied. However, GetWindowText
cannot retrieve the text of a control in another application.

GetWindowThreadProcessId Retrieves the identifier of the thread that created the


specified window and, optionally, the identifier of the process
that created the window.

HOOKPROC An application-defined or library-defined callback function


used with the SetWindowsHookEx function. The system calls
this function after the SendMessage function is called. The
hook procedure can examine the message; it cannot modify
it.

InSendMessage Determines whether the current window procedure is


processing a message that was sent from another thread (in
the same process or a different process) by a call to the
SendMessage function.

InSendMessageEx Determines whether the current window procedure is


processing a message that was sent from another thread (in
the same process or a different process).

InternalGetWindowText Copies the text of the specified window's title bar (if it has
one) into a buffer.
T IT L E DESC RIP T IO N

IsChild Determines whether a window is a child window or


descendant window of a specified parent window.

IsGUIThread Determines whether the calling thread is already a GUI


thread. It can also optionally convert the thread to a GUI
thread.

IsHungAppWindow Determines whether the system considers that a specified


application is not responding.

IsIconic Determines whether the specified window is minimized


(iconic).

IsProcessDPIAware IsProcessDPIAware may be altered or unavailable. Instead,


use GetProcessDPIAwareness.

IsWindow Determines whether the specified window handle identifies


an existing window.

IsWindowUnicode Determines whether the specified window is a native


Unicode window.

IsWindowVisible Determines the visibility state of the specified window.

IsZoomed Determines whether a window is maximized.

KillTimer Destroys the specified timer.

LockSetForegroundWindow The foreground process can call the


LockSetForegroundWindow function to disable calls to the
SetForegroundWindow function.

LogicalToPhysicalPoint Converts the logical coordinates of a point in a window to


physical coordinates.

MAKELPARAM Creates a value for use as an lParam parameter in a


message. The macro concatenates the specified values.

MAKELRESULT Creates a value for use as a return value from a window


procedure. The macro concatenates the specified values.

MAKEWPARAM Creates a value for use as a wParam parameter in a message.


The macro concatenates the specified values.

MoveWindow Changes the position and dimensions of the specified


window.

OpenIcon Restores a minimized (iconic) window to its previous size and


position; it then activates the window.

PeekMessageA Dispatches incoming sent messages, checks the thread


message queue for a posted message, and retrieves the
message (if any exist).
T IT L E DESC RIP T IO N

PeekMessageW Dispatches incoming sent messages, checks the thread


message queue for a posted message, and retrieves the
message (if any exist).

PhysicalToLogicalPoint Converts the physical coordinates of a point in a window to


logical coordinates.

PostMessageA Places (posts) a message in the message queue associated


with the thread that created the specified window and
returns without waiting for the thread to process the
message.

PostMessageW Places (posts) a message in the message queue associated


with the thread that created the specified window and
returns without waiting for the thread to process the
message.

PostQuitMessage Indicates to the system that a thread has made a request to


terminate (quit). It is typically used in response to a
WM_DESTROY message.

PostThreadMessageA Posts a message to the message queue of the specified


thread. It returns without waiting for the thread to process
the message.

PostThreadMessageW Posts a message to the message queue of the specified


thread. It returns without waiting for the thread to process
the message.

PROPENUMPROCA An application-defined callback function used with the


EnumProps function.

PROPENUMPROCEXA Application-defined callback function used with the


EnumPropsEx function.

PROPENUMPROCEXW Application-defined callback function used with the


EnumPropsEx function.

PROPENUMPROCW An application-defined callback function used with the


EnumProps function.

RealChildWindowFromPoint Retrieves a handle to the child window at the specified point.


The search is restricted to immediate child windows;
grandchildren and deeper descendant windows are not
searched.

RealGetWindowClassW Retrieves a string that specifies the window type.

RegisterClassA Registers a window class for subsequent use in calls to the


CreateWindow or CreateWindowEx function.

RegisterClassExA Registers a window class for subsequent use in calls to the


CreateWindow or CreateWindowEx function.
T IT L E DESC RIP T IO N

RegisterClassExW Registers a window class for subsequent use in calls to the


CreateWindow or CreateWindowEx function.

RegisterClassW Registers a window class for subsequent use in calls to the


CreateWindow or CreateWindowEx function.

RegisterShellHookWindow Registers a specified Shell window to receive certain


messages for events or notifications that are useful to Shell
applications.

RegisterWindowMessageA Defines a new window message that is guaranteed to be


unique throughout the system. The message value can be
used when sending or posting messages.

RegisterWindowMessageW Defines a new window message that is guaranteed to be


unique throughout the system. The message value can be
used when sending or posting messages.

RemovePropA Removes an entry from the property list of the specified


window. The specified character string identifies the entry to
be removed.

RemovePropW Removes an entry from the property list of the specified


window. The specified character string identifies the entry to
be removed.

ReplyMessage Replies to a message sent from another thread by the


SendMessage function.

SENDASYNCPROC An application-defined callback function used with the


SendMessageCallback function.

SendMessage Sends the specified message to a window or windows. The


SendMessage function calls the window procedure for the
specified window and does not return until the window
procedure has processed the message.

SendMessageA Sends the specified message to a window or windows. The


SendMessage function calls the window procedure for the
specified window and does not return until the window
procedure has processed the message.

SendMessageCallbackA Sends the specified message to a window or windows.

SendMessageCallbackW Sends the specified message to a window or windows.

SendMessageTimeoutA Sends the specified message to one or more windows.

SendMessageTimeoutW Sends the specified message to one or more windows.

SendMessageW Sends the specified message to a window or windows. The


SendMessage function calls the window procedure for the
specified window and does not return until the window
procedure has processed the message.
T IT L E DESC RIP T IO N

SendNotifyMessageA Sends the specified message to a window or windows.

SendNotifyMessageW Sends the specified message to a window or windows.

SetClassLongA Replaces the specified 32-bit (long) value at the specified


offset into the extra class memory or the WNDCLASSEX
structure for the class to which the specified window
belongs.

SetClassLongPtrA Replaces the specified value at the specified offset in the


extra class memory or the WNDCLASSEX structure for the
class to which the specified window belongs.

SetClassLongPtrW Replaces the specified value at the specified offset in the


extra class memory or the WNDCLASSEX structure for the
class to which the specified window belongs.

SetClassLongW Replaces the specified 32-bit (long) value at the specified


offset into the extra class memory or the WNDCLASSEX
structure for the class to which the specified window
belongs.

SetClassWord Replaces the 16-bit (WORD) value at the specified offset into
the extra class memory for the window class to which the
specified window belongs.

SetCoalescableTimer Creates a timer with the specified time-out value and


coalescing tolerance delay.

SetForegroundWindow Brings the thread that created the specified window into the
foreground and activates the window.

SetLayeredWindowAttributes Sets the opacity and transparency color key of a layered


window.

SetMessageExtraInfo Sets the extra message information for the current thread.

SetParent Changes the parent window of the specified child window.

SetProcessDefaultLayout Changes the default layout when windows are created with
no parent or owner only for the currently running process.

SetProcessDPIAware SetProcessDPIAware may be altered or unavailable. Instead,


use SetProcessDPIAwareness.

SetPropA Adds a new entry or changes an existing entry in the


property list of the specified window.

SetPropW Adds a new entry or changes an existing entry in the


property list of the specified window.

SetSysColors Sets the colors for the specified display elements.

SetTimer Creates a timer with the specified time-out value.


T IT L E DESC RIP T IO N

SetWindowDisplayAffinity Stores the display affinity setting in kernel mode on the


hWnd associated with the window.

SetWindowLongA Changes an attribute of the specified window. The function


also sets the 32-bit (long) value at the specified offset into
the extra window memory.

SetWindowLongPtrA Changes an attribute of the specified window.

SetWindowLongPtrW Changes an attribute of the specified window.

SetWindowLongW Changes an attribute of the specified window. The function


also sets the 32-bit (long) value at the specified offset into
the extra window memory.

SetWindowPlacement Sets the show state and the restored, minimized, and
maximized positions of the specified window.

SetWindowPos Changes the size, position, and Z order of a child, pop-up, or


top-level window. These windows are ordered according to
their appearance on the screen. The topmost window
receives the highest rank and is the first window in the Z
order.

SetWindowsHookExA Installs an application-defined hook procedure into a hook


chain.

SetWindowsHookExW Installs an application-defined hook procedure into a hook


chain.

SetWindowTextA Changes the text of the specified window's title bar (if it has
one). If the specified window is a control, the text of the
control is changed. However, SetWindowText cannot change
the text of a control in another application.

SetWindowTextW Changes the text of the specified window's title bar (if it has
one). If the specified window is a control, the text of the
control is changed. However, SetWindowText cannot change
the text of a control in another application.

ShowOwnedPopups Shows or hides all pop-up windows owned by the specified


window.

ShowWindow Sets the specified window's show state.

ShowWindowAsync Sets the show state of a window without waiting for the
operation to complete.

SoundSentry Triggers a visual signal to indicate that a sound is playing.

SwitchToThisWindow Switches focus to the specified window and brings it to the


foreground.
T IT L E DESC RIP T IO N

SystemParametersInfoA Retrieves or sets the value of one of the system-wide


parameters.

SystemParametersInfoW Retrieves or sets the value of one of the system-wide


parameters.

TileWindows Tiles the specified child windows of the specified parent


window.

TIMERPROC An application-defined callback function that processes


WM_TIMER messages. The TIMERPROC type defines a
pointer to this callback function. TimerProc is a placeholder
for the application-defined function name.

TranslateMDISysAccel Processes accelerator keystrokes for window menu


commands of the multiple-document interface (MDI) child
windows associated with the specified MDI client window.

TranslateMessage Translates virtual-key messages into character messages. The


character messages are posted to the calling thread's
message queue, to be read the next time the thread calls the
GetMessage or PeekMessage function.

UnhookWindowsHookEx Removes a hook procedure installed in a hook chain by the


SetWindowsHookEx function.

UnregisterClassA Unregisters a window class, freeing the memory required for


the class.

UnregisterClassW Unregisters a window class, freeing the memory required for


the class.

UpdateLayeredWindow Updates the position, size, shape, content, and translucency


of a layered window.

WaitMessage Yields control to other threads when a thread has no other


messages in its message queue. The WaitMessage function
suspends the thread and does not return until a new
message is placed in the thread's message queue.

WindowFromPhysicalPoint Retrieves a handle to the window that contains the specified


physical point.

WindowFromPoint Retrieves a handle to the window that contains the specified


point.

WinMain The user-provided entry point for a graphical Windows-


based application.

Structures
T IT L E DESC RIP T IO N

ALTTABINFO Contains status information for the application-switching


(ALT+TAB) window.

ANIMATIONINFO Describes the animation effects associated with user actions.

AUDIODESCRIPTION Contains information associated with audio descriptions. This


structure is used with the SystemParametersInfo function
when the SPI_GETAUDIODESCRIPTION or
SPI_SETAUDIODESCRIPTION action value is specified.

BSMINFO Contains information about a window that denied a request


from BroadcastSystemMessageEx.

CBT_CREATEWNDA Contains information passed to a WH_CBT hook procedure,


CBTProc, before a window is created.

CBT_CREATEWNDW Contains information passed to a WH_CBT hook procedure,


CBTProc, before a window is created.

CBTACTIVATESTRUCT Contains information passed to a WH_CBT hook procedure,


CBTProc, before a window is activated.

CHANGEFILTERSTRUCT Contains extended result information obtained by calling the


ChangeWindowMessageFilterEx function.

CLIENTCREATESTRUCT Contains information about the menu and first multiple-


document interface (MDI) child window of an MDI client
window.

CREATESTRUCTA Defines the initialization parameters passed to the window


procedure of an application. These members are identical to
the parameters of the CreateWindowEx function.

CREATESTRUCTW Defines the initialization parameters passed to the window


procedure of an application. These members are identical to
the parameters of the CreateWindowEx function.

CWPRETSTRUCT Defines the message parameters passed to a


WH_CALLWNDPROCRET hook procedure, CallWndRetProc.

CWPSTRUCT Defines the message parameters passed to a


WH_CALLWNDPROC hook procedure, CallWndProc.

DEBUGHOOKINFO Contains debugging information passed to a WH_DEBUG


hook procedure, DebugProc.

EVENTMSG Contains information about a hardware message sent to the


system message queue. This structure is used to store
message information for the JournalPlaybackProc callback
function.

GUITHREADINFO Contains information about a GUI thread.


T IT L E DESC RIP T IO N

KBDLLHOOKSTRUCT Contains information about a low-level keyboard input


event.

MDICREATESTRUCTA Contains information about the class, title, owner, location,


and size of a multiple-document interface (MDI) child
window.

MDICREATESTRUCTW Contains information about the class, title, owner, location,


and size of a multiple-document interface (MDI) child
window.

MINIMIZEDMETRICS Contains the scalable metrics associated with minimized


windows.

MINMAXINFO Contains information about a window's maximized size and


position and its minimum and maximum tracking size.

MOUSEHOOKSTRUCT Contains information about a mouse event passed to a


WH_MOUSE hook procedure, MouseProc.

MOUSEHOOKSTRUCTEX Contains information about a mouse event passed to a


WH_MOUSE hook procedure, MouseProc. This is an
extension of the MOUSEHOOKSTRUCT structure that
includes information about wheel movement or the use of
the X button.

MSG Contains message information from a thread's message


queue.

MSLLHOOKSTRUCT Contains information about a low-level mouse input event.

NCCALCSIZE_PARAMS Contains information that an application can use while


processing the WM_NCCALCSIZE message to calculate the
size, position, and valid contents of the client area of a
window.

NONCLIENTMETRICSA Contains the scalable metrics associated with the nonclient


area of a nonminimized window.

NONCLIENTMETRICSW Contains the scalable metrics associated with the nonclient


area of a nonminimized window.

STYLESTRUCT Contains the styles for a window.

TITLEBARINFO Contains title bar information.

TITLEBARINFOEX Expands on the information described in the TITLEBARINFO


structure by including the coordinates of each element of
the title bar.

UPDATELAYEREDWINDOWINFO Used by UpdateLayeredWindowIndirect to provide position,


size, shape, content, and translucency information for a
layered window.
T IT L E DESC RIP T IO N

WINDOWINFO Contains window information.

WINDOWPLACEMENT Contains information about the placement of a window on


the screen.

WINDOWPOS Contains information about the size and position of a


window.

WNDCLASSA Contains the window class attributes that are registered by


the RegisterClass function.

WNDCLASSEXA Contains window class information.

WNDCLASSEXW Contains window class information.

WNDCLASSW Contains the window class attributes that are registered by


the RegisterClass function.
olectl.h header
2/1/2021 • 2 minutes to read • Edit Online

This header is used by Automation. For more information, see:


Automation olectl.h contains the following programming interfaces:

Functions
T IT L E DESC RIP T IO N

DllRegisterServer Instructs an in-process server to create its registry entries


for all classes supported in this server module.

DllUnregisterServer Instructs an in-process server to remove only those entries


created through DllRegisterServer.

OleCreateFontIndirect Creates and initializes a standard font object using an initial


description of the font's properties in a FONTDESC structure.

OleCreatePictureIndirect Creates a new picture object initialized according to a


PICTDESC structure.

OleCreatePropertyFrame Invokes a new property frame, that is, a property sheet


dialog box, whose parent is hwndOwner, where the dialog is
positioned at the point (x,y) in the parent window and has
the caption lpszCaption.

OleCreatePropertyFrameIndirect Creates a property frame, that is, a property sheet dialog


box, based on a structure (OCPFIPARAMS) that contains the
parameters, rather than specifying separate parameters as
when calling OleCreatePropertyFrame.

OleIconToCursor Converts an icon to a cursor.

OleLoadPicture Creates a new picture object and initializes it from the


contents of a stream. This is equivalent to calling
OleCreatePictureIndirect with NULL as the first parameter,
followed by a call to IPersistStream::Load.

OleLoadPictureEx Creates a new picture object and initializes it from the


contents of a stream. This is equivalent to calling
OleCreatePictureIndirect with NULL as the first parameter,
followed by a call to IPersistStream::Load.

OleLoadPictureFile Creates an IPictureDisp object from a picture file on disk.

OleLoadPictureFileEx Loads a picture from a file.


T IT L E DESC RIP T IO N

OleLoadPicturePath Creates a new picture object and initializes it from the


contents of a stream. This is equivalent to calling
OleCreatePictureIndirect(NULL, ...) followed by
IPersistStream::Load.

OleSavePictureFile Saves a picture to a file.

OleTranslateColor Converts an OLE_COLOR type to a COLORREF.

Structures
T IT L E DESC RIP T IO N

FONTDESC Contains parameters used to create a font object through


the OleCreateFontIndirect function.

OCPFIPARAMS Contains parameters used to invoke a property sheet dialog


box through the OleCreatePropertyFrameIndirect function.

PICTDESC Contains parameters to create a picture object through the


OleCreatePictureIndirect function.
winbase.h header
2/1/2021 • 37 minutes to read • Edit Online

This header is used by Backup. For more information, see:


Backup winbase.h contains the following programming interfaces:

Functions
T IT L E DESC RIP T IO N

_lclose The _lclose function closes the specified file so that it is no


longer available for reading or writing. This function is
provided for compatibility with 16-bit versions of Windows.
Win32-based applications should use the CloseHandle
function.

_lcreat Creates or opens the specified file.

_llseek Repositions the file pointer for the specified file.

_lopen The _lopen function opens an existing file and sets the file
pointer to the beginning of the file. This function is provided
for compatibility with 16-bit versions of Windows. Win32-
based applications should use the CreateFile function.

_lread The _lread function reads data from the specified file. This
function is provided for compatibility with 16-bit versions of
Windows. Win32-based applications should use the ReadFile
function.

_lwrite Writes data to the specified file.

AccessCheckAndAuditAlarmA Determines whether a security descriptor grants a specified


set of access rights to the client being impersonated by the
calling thread.

AccessCheckByTypeAndAuditAlarmA Determines whether a security descriptor grants a specified


set of access rights to the client being impersonated by the
calling thread.

AccessCheckByTypeResultListAndAuditAlarmA Determines whether a security descriptor grants a specified


set of access rights to the client being impersonated by the
calling thread.

AccessCheckByTypeResultListAndAuditAlarmByHandleA Determines whether a security descriptor grants a specified


set of access rights to the client that the calling thread is
impersonating.

ActivateActCtx The ActivateActCtx function activates the specified activation


context.
T IT L E DESC RIP T IO N

AddAtomA Adds a character string to the local atom table and returns a
unique value (an atom) identifying the string.

AddAtomW Adds a character string to the local atom table and returns a
unique value (an atom) identifying the string.

AddConditionalAce Adds a conditional access control entry (ACE) to the


specified access control list (ACL).

AddIntegrityLabelToBoundaryDescriptor Adds a new required security identifier (SID) to the specified


boundary descriptor.

AddRefActCtx The AddRefActCtx function increments the reference count


of the specified activation context.

AddSecureMemoryCacheCallback Registers a callback function to be called when a secured


memory range is freed or its protections are changed.

ApplicationRecoveryFinished Indicates that the calling application has completed its data
recovery.

ApplicationRecoveryInProgress Indicates that the calling application is continuing to recover


data.

BackupEventLogA Saves the specified event log to a backup file.

BackupEventLogW Saves the specified event log to a backup file.

BackupRead Back up a file or directory, including the security information.

BackupSeek Seeks forward in a data stream initially accessed by using the


BackupRead or BackupWrite function.

BackupWrite Restore a file or directory that was backed up using


BackupRead.

BeginUpdateResourceA Retrieves a handle that can be used by the UpdateResource


function to add, delete, or replace resources in a binary
module.

BeginUpdateResourceW Retrieves a handle that can be used by the UpdateResource


function to add, delete, or replace resources in a binary
module.

BindIoCompletionCallback Associates the I/O completion port owned by the thread


pool with the specified file handle. On completion of an I/O
request involving this file, a non-I/O worker thread will
execute the specified callback function.

BuildCommDCBA Fills a specified DCB structure with values specified in a


device-control string.
T IT L E DESC RIP T IO N

BuildCommDCBAndTimeoutsA Translates a device-definition string into appropriate device-


control block codes and places them into a device control
block.

BuildCommDCBAndTimeoutsW Translates a device-definition string into appropriate device-


control block codes and places them into a device control
block.

BuildCommDCBW Fills a specified DCB structure with values specified in a


device-control string.

CallNamedPipeA Connects to a message-type pipe (and waits if an instance of


the pipe is not available), writes to and reads from the pipe,
and then closes the pipe.

CheckNameLegalDOS8Dot3A Determines whether the specified name can be used to


create a file on a FAT file system.

CheckNameLegalDOS8Dot3W Determines whether the specified name can be used to


create a file on a FAT file system.

ClearCommBreak Restores character transmission for a specified


communications device and places the transmission line in a
nonbreak state.

ClearCommError Retrieves information about a communications error and


reports the current status of a communications device.

ClearEventLogA Clears the specified event log, and optionally saves the
current copy of the log to a backup file.

ClearEventLogW Clears the specified event log, and optionally saves the
current copy of the log to a backup file.

CloseEncryptedFileRaw Closes an encrypted file after a backup or restore operation,


and frees associated system resources.

CloseEventLog Closes the specified event log.

CommConfigDialogA Displays a driver-supplied configuration dialog box.

CommConfigDialogW Displays a driver-supplied configuration dialog box.

ConvertFiberToThread Converts the current fiber into a thread.

ConvertThreadToFiber Converts the current thread into a fiber. You must convert a
thread into a fiber before you can schedule other fibers.

ConvertThreadToFiberEx Converts the current thread into a fiber. You must convert a
thread into a fiber before you can schedule other fibers.

CopyContext Copies a source context structure (including any XState) onto


an initialized destination context structure.
T IT L E DESC RIP T IO N

CopyFile Copies an existing file to a new file.

CopyFile2 Copies an existing file to a new file, notifying the application


of its progress through a callback function.

CopyFileA Copies an existing file to a new file.

CopyFileExA Copies an existing file to a new file, notifying the application


of its progress through a callback function.

CopyFileExW Copies an existing file to a new file, notifying the application


of its progress through a callback function.

CopyFileTransactedA Copies an existing file to a new file as a transacted operation,


notifying the application of its progress through a callback
function.

CopyFileTransactedW Copies an existing file to a new file as a transacted operation,


notifying the application of its progress through a callback
function.

CopyFileW Copies an existing file to a new file.

CreateActCtxA The CreateActCtx function creates an activation context.

CreateActCtxW The CreateActCtx function creates an activation context.

CreateBoundaryDescriptorA Creates a boundary descriptor.

CreateDirectory Creates a new directory.

CreateDirectoryExA Creates a new directory with the attributes of a specified


template directory.

CreateDirectoryExW Creates a new directory with the attributes of a specified


template directory.

CreateDirectoryTransactedA Creates a new directory as a transacted operation, with the


attributes of a specified template directory.

CreateDirectoryTransactedW Creates a new directory as a transacted operation, with the


attributes of a specified template directory.

CreateFiber Allocates a fiber object, assigns it a stack, and sets up


execution to begin at the specified start address, typically
the fiber function. This function does not schedule the fiber.

CreateFiberEx Allocates a fiber object, assigns it a stack, and sets up


execution to begin at the specified start address, typically
the fiber function. This function does not schedule the fiber.

CreateFileMappingA Creates or opens a named or unnamed file mapping object


for a specified file.
T IT L E DESC RIP T IO N

CreateFileMappingNumaA Creates or opens a named or unnamed file mapping object


for a specified file and specifies the NUMA node for the
physical memory.

CreateFileTransactedA Creates or opens a file, file stream, or directory as a


transacted operation.

CreateFileTransactedW Creates or opens a file, file stream, or directory as a


transacted operation.

CreateHardLinkA Establishes a hard link between an existing file and a new file.

CreateHardLinkTransactedA Establishes a hard link between an existing file and a new file
as a transacted operation.

CreateHardLinkTransactedW Establishes a hard link between an existing file and a new file
as a transacted operation.

CreateHardLinkW Establishes a hard link between an existing file and a new file.

CreateJobObjectA Creates or opens a job object.

CreateMailslotA Creates a mailslot with the specified name and returns a


handle that a mailslot server can use to perform operations
on the mailslot.

CreateMailslotW Creates a mailslot with the specified name and returns a


handle that a mailslot server can use to perform operations
on the mailslot.

CreateNamedPipeA Creates an instance of a named pipe and returns a handle


for subsequent pipe operations.

CreatePrivateNamespaceA Creates a private namespace.

CreateProcessWithLogonW Creates a new process and its primary thread. Then the new
process runs the specified executable file in the security
context of the specified credentials (user, domain, and
password). It can optionally load the user profile for a
specified user.

CreateProcessWithTokenW Creates a new process and its primary thread. The new
process runs in the security context of the specified token. It
can optionally load the user profile for the specified user.

CreateSemaphoreA Creates or opens a named or unnamed semaphore object.

CreateSemaphoreExA Creates or opens a named or unnamed semaphore object


and returns a handle to the object.

CreateSymbolicLinkA Creates a symbolic link.

CreateSymbolicLinkTransactedA Creates a symbolic link as a transacted operation.


T IT L E DESC RIP T IO N

CreateSymbolicLinkTransactedW Creates a symbolic link as a transacted operation.

CreateSymbolicLinkW Creates a symbolic link.

CreateTapePartition Reformats a tape.

CreateUmsCompletionList Creates a user-mode scheduling (UMS) completion list.

CreateUmsThreadContext Creates a user-mode scheduling (UMS) thread context to


represent a UMS worker thread.

DeactivateActCtx The DeactivateActCtx function deactivates the activation


context corresponding to the specified cookie.

DebugBreakProcess Causes a breakpoint exception to occur in the specified


process. This allows the calling thread to signal the debugger
to handle the exception.

DebugSetProcessKillOnExit Sets the action to be performed when the calling thread


exits.

DecryptFileA Decrypts an encrypted file or directory.

DecryptFileW Decrypts an encrypted file or directory.

DefineDosDeviceA Defines, redefines, or deletes MS-DOS device names.

DeleteAtom Decrements the reference count of a local string atom. If the


atom's reference count is reduced to zero, DeleteAtom
removes the string associated with the atom from the local
atom table.

DeleteFiber Deletes an existing fiber.

DeleteFile Deletes an existing file.

DeleteFileTransactedA Deletes an existing file as a transacted operation.

DeleteFileTransactedW Deletes an existing file as a transacted operation.

DeleteTimerQueue Deletes a timer queue. Any pending timers in the queue are
canceled and deleted.

DeleteUmsCompletionList Deletes the specified user-mode scheduling (UMS)


completion list. The list must be empty.

DeleteUmsThreadContext Deletes the specified user-mode scheduling (UMS) thread


context. The thread must be terminated.

DeleteVolumeMountPointA Deletes a drive letter or mounted folder.


T IT L E DESC RIP T IO N

DequeueUmsCompletionListItems Retrieves user-mode scheduling (UMS) worker threads from


the specified UMS completion list.

DeregisterEventSource Closes the specified event log.

DestroyThreadpoolEnvironment Deletes the specified callback environment. Call this function


when the callback environment is no longer needed for
creating new thread pool objects.

DisableThreadProfiling Disables thread profiling.

DnsHostnameToComputerNameA Converts a DNS-style host name to a NetBIOS-style


computer name.

DnsHostnameToComputerNameW Converts a DNS-style host name to a NetBIOS-style


computer name.

DosDateTimeToFileTime Converts MS-DOS date and time values to a file time.

EnableThreadProfiling Enables thread profiling on the specified thread.

EncryptFileA Encrypts a file or directory.

EncryptFileW Encrypts a file or directory.

EndUpdateResourceA Commits or discards changes made prior to a call to


UpdateResource.

EndUpdateResourceW Commits or discards changes made prior to a call to


UpdateResource.

EnterUmsSchedulingMode Converts the calling thread into a user-mode scheduling


(UMS) scheduler thread.

EnumResourceLanguagesA Enumerates language-specific resources, of the specified


type and name, associated with a binary module.

EnumResourceLanguagesW Enumerates language-specific resources, of the specified


type and name, associated with a binary module.

EnumResourceNamesA Enumerates resources of a specified type within a binary


module.

EnumResourceTypesA Enumerates resource types within a binary module.

EnumResourceTypesW Enumerates resource types within a binary module.

EraseTape Erases all or part of a tape.

EscapeCommFunction Directs the specified communications device to perform an


extended function.
T IT L E DESC RIP T IO N

ExecuteUmsThread Runs the specified UMS worker thread.

FatalExit Transfers execution control to the debugger. The behavior of


the debugger thereafter is specific to the type of debugger
used.

FileEncryptionStatusA Retrieves the encryption status of the specified file.

FileEncryptionStatusW Retrieves the encryption status of the specified file.

FileTimeToDosDateTime Converts a file time to MS-DOS date and time values.

FindActCtxSectionGuid The FindActCtxSectionGuid function retrieves information on


a specific GUID in the current activation context and returns
a ACTCTX_SECTION_KEYED_DATA structure.

FindActCtxSectionStringA The FindActCtxSectionString function retrieves information


on a specific string in the current activation context and
returns a ACTCTX_SECTION_KEYED_DATA structure.

FindActCtxSectionStringW The FindActCtxSectionString function retrieves information


on a specific string in the current activation context and
returns a ACTCTX_SECTION_KEYED_DATA structure.

FindAtomA Searches the local atom table for the specified character
string and retrieves the atom associated with that string.

FindAtomW Searches the local atom table for the specified character
string and retrieves the atom associated with that string.

FindFirstFileNameTransactedW Creates an enumeration of all the hard links to the specified


file as a transacted operation. The function returns a handle
to the enumeration that can be used on subsequent calls to
the FindNextFileNameW function.

FindFirstFileTransactedA Searches a directory for a file or subdirectory with a name


that matches a specific name as a transacted operation.

FindFirstFileTransactedW Searches a directory for a file or subdirectory with a name


that matches a specific name as a transacted operation.

FindFirstStreamTransactedW Enumerates the first stream in the specified file or directory


as a transacted operation.

FindFirstVolumeA Retrieves the name of a volume on a computer.

FindFirstVolumeMountPointA Retrieves the name of a mounted folder on the specified


volume.

FindFirstVolumeMountPointW Retrieves the name of a mounted folder on the specified


volume.

FindNextVolumeA Continues a volume search started by a call to the


FindFirstVolume function.
T IT L E DESC RIP T IO N

FindNextVolumeMountPointA Continues a mounted folder search started by a call to the


FindFirstVolumeMountPoint function.

FindNextVolumeMountPointW Continues a mounted folder search started by a call to the


FindFirstVolumeMountPoint function.

FindResourceA Determines the location of a resource with the specified type


and name in the specified module.

FindResourceExA Determines the location of the resource with the specified


type, name, and language in the specified module.

FindVolumeMountPointClose Closes the specified mounted folder search handle.

FormatMessage Formats a message string.

FormatMessageA Formats a message string.

FormatMessageW Formats a message string.

GetActiveProcessorCount Returns the number of active processors in a processor


group or in the system.

GetActiveProcessorGroupCount Returns the number of active processor groups in the


system.

GetApplicationRecoveryCallback Retrieves a pointer to the callback routine registered for the


specified process. The address returned is in the virtual
address space of the process.

GetApplicationRestartSettings Retrieves the restart information registered for the specified


process.

GetAtomNameA Retrieves a copy of the character string associated with the


specified local atom.

GetAtomNameW Retrieves a copy of the character string associated with the


specified local atom.

GetBinaryTypeA Determines whether a file is an executable (.exe) file, and if


so, which subsystem runs the executable file.

GetBinaryTypeW Determines whether a file is an executable (.exe) file, and if


so, which subsystem runs the executable file.

GetCommConfig Retrieves the current configuration of a communications


device.

GetCommMask Retrieves the value of the event mask for a specified


communications device.

GetCommModemStatus Retrieves the modem control-register values.


T IT L E DESC RIP T IO N

GetCommPorts Gets an array that contains the well-formed COM ports.

GetCommProperties Retrieves information about the communications properties


for a specified communications device.

GetCommState Retrieves the current control settings for a specified


communications device.

GetCommTimeouts Retrieves the time-out parameters for all read and write
operations on a specified communications device.

GetCompressedFileSizeTransactedA Retrieves the actual number of bytes of disk storage used to


store a specified file as a transacted operation.

GetCompressedFileSizeTransactedW Retrieves the actual number of bytes of disk storage used to


store a specified file as a transacted operation.

GetComputerNameA Retrieves the NetBIOS name of the local computer. This


name is established at system startup, when the system
reads it from the registry.

GetComputerNameW Retrieves the NetBIOS name of the local computer. This


name is established at system startup, when the system
reads it from the registry.

GetCurrentActCtx The GetCurrentActCtx function returns the handle to the


active activation context of the calling thread.

GetCurrentDirectory Retrieves the current directory for the current process.

GetCurrentHwProfileA Retrieves information about the current hardware profile for


the local computer.

GetCurrentHwProfileW Retrieves information about the current hardware profile for


the local computer.

GetCurrentUmsThread Returns the user-mode scheduling (UMS) thread context of


the calling UMS thread.

GetDefaultCommConfigA Retrieves the default configuration for the specified


communications device.

GetDefaultCommConfigW Retrieves the default configuration for the specified


communications device.

GetDevicePowerState Retrieves the current power state of the specified device.

GetDllDirectoryA Retrieves the application-specific portion of the search path


used to locate DLLs for the application.

GetDllDirectoryW Retrieves the application-specific portion of the search path


used to locate DLLs for the application.
T IT L E DESC RIP T IO N

GetEnabledXStateFeatures Gets a mask of enabled XState features on x86 or x64


processors.

GetEnvironmentVariable Retrieves the contents of the specified variable from the


environment block of the calling process.

GetEventLogInformation Retrieves information about the specified event log.

GetFileAttributesTransactedA Retrieves file system attributes for a specified file or directory


as a transacted operation.

GetFileAttributesTransactedW Retrieves file system attributes for a specified file or directory


as a transacted operation.

GetFileBandwidthReservation Retrieves the bandwidth reservation properties of the


volume on which the specified file resides.

GetFileInformationByHandleEx Retrieves file information for the specified file.

GetFileSecurityA Obtains specified information about the security of a file or


directory. The information obtained is constrained by the
caller's access rights and privileges.

GetFirmwareEnvironmentVariableA Retrieves the value of the specified firmware environment


variable.

GetFirmwareEnvironmentVariableExA Retrieves the value of the specified firmware environment


variable and its attributes.

GetFirmwareEnvironmentVariableExW Retrieves the value of the specified firmware environment


variable and its attributes.

GetFirmwareEnvironmentVariableW Retrieves the value of the specified firmware environment


variable.

GetFirmwareType Retrieves the firmware type of the local computer.

GetFullPathNameTransactedA Retrieves the full path and file name of the specified file as a
transacted operation.

GetFullPathNameTransactedW Retrieves the full path and file name of the specified file as a
transacted operation.

GetLogicalDriveStringsA Fills a buffer with strings that specify valid drives in the
system.

GetLongPathNameTransactedA Converts the specified path to its long form as a transacted


operation.

GetLongPathNameTransactedW Converts the specified path to its long form as a transacted


operation.

GetMailslotInfo Retrieves information about the specified mailslot.


T IT L E DESC RIP T IO N

GetMaximumProcessorCount Returns the maximum number of logical processors that a


processor group or the system can have.

GetMaximumProcessorGroupCount Returns the maximum number of processor groups that the


system can have.

GetNamedPipeClientComputerNameA Retrieves the client computer name for the specified named
pipe.

GetNamedPipeClientProcessId Retrieves the client process identifier for the specified named
pipe.

GetNamedPipeClientSessionId Retrieves the client session identifier for the specified named
pipe.

GetNamedPipeHandleStateA Retrieves information about a specified named pipe.

GetNamedPipeServerProcessId Retrieves the server process identifier for the specified


named pipe.

GetNamedPipeServerSessionId Retrieves the server session identifier for the specified named
pipe.

GetNextUmsListItem Returns the next user-mode scheduling (UMS) thread


context in a list of thread contexts.

GetNumaAvailableMemoryNode Retrieves the amount of memory available in the specified


node.

GetNumaAvailableMemoryNodeEx Retrieves the amount of memory that is available in a node


specified as a USHORT value.

GetNumaNodeNumberFromHandle Retrieves the NUMA node associated with the file or I/O
device represented by the specified file handle.

GetNumaNodeProcessorMask Retrieves the processor mask for the specified node.

GetNumaProcessorNode Retrieves the node number for the specified processor.

GetNumaProcessorNodeEx Retrieves the node number as a USHORT value for the


specified logical processor.

GetNumaProximityNode Retrieves the NUMA node number that corresponds to the


specified proximity domain identifier.

GetNumberOfEventLogRecords Retrieves the number of records in the specified event log.

GetOldestEventLogRecord Retrieves the absolute record number of the oldest record in


the specified event log.

GetPrivateProfileInt Retrieves an integer associated with a key in the specified


section of an initialization file.
T IT L E DESC RIP T IO N

GetPrivateProfileIntA Retrieves an integer associated with a key in the specified


section of an initialization file.

GetPrivateProfileIntW Retrieves an integer associated with a key in the specified


section of an initialization file.

GetPrivateProfileSection Retrieves all the keys and values for the specified section of
an initialization file.

GetPrivateProfileSectionA Retrieves all the keys and values for the specified section of
an initialization file.

GetPrivateProfileSectionNames Retrieves the names of all sections in an initialization file.

GetPrivateProfileSectionNamesA Retrieves the names of all sections in an initialization file.

GetPrivateProfileSectionNamesW Retrieves the names of all sections in an initialization file.

GetPrivateProfileSectionW Retrieves all the keys and values for the specified section of
an initialization file.

GetPrivateProfileString Retrieves a string from the specified section in an


initialization file.

GetPrivateProfileStringA Retrieves a string from the specified section in an


initialization file.

GetPrivateProfileStringW Retrieves a string from the specified section in an


initialization file.

GetPrivateProfileStruct Retrieves the data associated with a key in the specified


section of an initialization file.

GetPrivateProfileStructA Retrieves the data associated with a key in the specified


section of an initialization file.

GetPrivateProfileStructW Retrieves the data associated with a key in the specified


section of an initialization file.

GetProcessAffinityMask Retrieves the process affinity mask for the specified process
and the system affinity mask for the system.

GetProcessDEPPolicy Gets the data execution prevention (DEP) and DEP-ATL


thunk emulation settings for the specified 32-bit
process.Windows XP with SP3: Gets the DEP and DEP-ATL
thunk emulation settings for the current process.

GetProcessIoCounters Retrieves accounting information for all I/O operations


performed by the specified process.

GetProcessWorkingSetSize Retrieves the minimum and maximum working set sizes of


the specified process.
T IT L E DESC RIP T IO N

GetProfileIntA Retrieves an integer from a key in the specified section of the


Win.ini file.

GetProfileIntW Retrieves an integer from a key in the specified section of the


Win.ini file.

GetProfileSectionA Retrieves all the keys and values for the specified section of
the Win.ini file.

GetProfileSectionW Retrieves all the keys and values for the specified section of
the Win.ini file.

GetProfileStringA Retrieves the string associated with a key in the specified


section of the Win.ini file.

GetProfileStringW Retrieves the string associated with a key in the specified


section of the Win.ini file.

GetShortPathNameA Retrieves the short path form of the specified path.

GetSystemDEPPolicy Gets the data execution prevention (DEP) policy setting for
the system.

GetSystemPowerStatus Retrieves the power status of the system. The status


indicates whether the system is running on AC or DC power,
whether the battery is currently charging, how much battery
life remains, and if battery saver is on or off.

GetSystemRegistryQuota Retrieves the current size of the registry and the maximum
size that the registry is allowed to attain on the system.

GetTapeParameters Retrieves information that describes the tape or the tape


drive.

GetTapePosition Retrieves the current address of the tape, in logical or


absolute blocks.

GetTapeStatus Determines whether the tape device is ready to process tape


commands.

GetTempFileName Creates a name for a temporary file. If a unique file name is


generated, an empty file is created and the handle to it is
released; otherwise, only a file name is generated.

GetThreadSelectorEntry Retrieves a descriptor table entry for the specified selector


and thread.

GetUmsCompletionListEvent Retrieves a handle to the event associated with the specified


user-mode scheduling (UMS) completion list.

GetUmsSystemThreadInformation Queries whether the specified thread is a UMS scheduler


thread, a UMS worker thread, or a non-UMS thread.
T IT L E DESC RIP T IO N

GetUserNameA Retrieves the name of the user associated with the current
thread.

GetUserNameW Retrieves the name of the user associated with the current
thread.

GetVolumeNameForVolumeMountPointA Retrieves a volume GUID path for the volume that is


associated with the specified volume mount point ( drive
letter, volume GUID path, or mounted folder).

GetVolumePathNameA Retrieves the volume mount point where the specified path
is mounted.

GetVolumePathNamesForVolumeNameA Retrieves a list of drive letters and mounted folder paths for
the specified volume.

GetXStateFeaturesMask Returns the mask of XState features set within a CONTEXT


structure.

GlobalAddAtomA Adds a character string to the global atom table and returns
a unique value (an atom) identifying the string.

GlobalAddAtomExA Adds a character string to the global atom table and returns
a unique value (an atom) identifying the string.

GlobalAddAtomExW Adds a character string to the global atom table and returns
a unique value (an atom) identifying the string.

GlobalAddAtomW Adds a character string to the global atom table and returns
a unique value (an atom) identifying the string.

GlobalAlloc Allocates the specified number of bytes from the heap.

GlobalDeleteAtom Decrements the reference count of a global string atom. If


the atom's reference count reaches zero, GlobalDeleteAtom
removes the string associated with the atom from the global
atom table.

GlobalDiscard Discards the specified global memory block.

GlobalFindAtomA Searches the global atom table for the specified character
string and retrieves the global atom associated with that
string.

GlobalFindAtomW Searches the global atom table for the specified character
string and retrieves the global atom associated with that
string.

GlobalFlags Retrieves information about the specified global memory


object.

GlobalFree Frees the specified global memory object and invalidates its
handle.
T IT L E DESC RIP T IO N

GlobalGetAtomNameA Retrieves a copy of the character string associated with the


specified global atom.

GlobalGetAtomNameW Retrieves a copy of the character string associated with the


specified global atom.

GlobalHandle Retrieves the handle associated with the specified pointer to


a global memory block.

GlobalLock Locks a global memory object and returns a pointer to the


first byte of the object's memory block.

GlobalMemoryStatus Retrieves information about the system's current usage of


both physical and virtual memory.

GlobalReAlloc Changes the size or attributes of a specified global memory


object. The size can increase or decrease.

GlobalSize Retrieves the current size of the specified global memory


object, in bytes.

GlobalUnlock Decrements the lock count associated with a memory object


that was allocated with GMEM_MOVEABLE.

HasOverlappedIoCompleted Provides a high performance test operation that can be used


to poll for the completion of an outstanding I/O operation.

InitAtomTable Initializes the local atom table and sets the number of hash
buckets to the specified size.

InitializeContext Initializes a CONTEXT structure inside a buffer with the


necessary size and alignment.

InitializeContext2 Initializes a CONTEXT structure inside a buffer with the


necessary size and alignment, with the option to specify an
XSTATE compaction mask.

InitializeThreadpoolEnvironment Initializes a callback environment.

InterlockedExchangeSubtract Performs an atomic subtraction of two values.

IsBadCodePtr Determines whether the calling process has read access to


the memory at the specified address.

IsBadReadPtr Verifies that the calling process has read access to the
specified range of memory.

IsBadStringPtrA Verifies that the calling process has read access to the
specified range of memory.

IsBadStringPtrW Verifies that the calling process has read access to the
specified range of memory.
T IT L E DESC RIP T IO N

IsBadWritePtr Verifies that the calling process has write access to the
specified range of memory.

IsNativeVhdBoot Indicates if the OS was booted from a VHD container.

IsSystemResumeAutomatic Determines the current state of the computer.

IsTextUnicode Determines if a buffer is likely to contain a form of Unicode


text.

LoadModule Loads and executes an application or creates a new instance


of an existing application.

LoadPackagedLibrary Loads the specified packaged module and its dependencies


into the address space of the calling process.

LocalAlloc Allocates the specified number of bytes from the heap.

LocalFlags Retrieves information about the specified local memory


object.

LocalFree Frees the specified local memory object and invalidates its
handle.

LocalHandle Retrieves the handle associated with the specified pointer to


a local memory object.

LocalLock Locks a local memory object and returns a pointer to the


first byte of the object's memory block.

LocalReAlloc Changes the size or the attributes of a specified local


memory object. The size can increase or decrease.

LocalSize Retrieves the current size of the specified local memory


object, in bytes.

LocalUnlock Decrements the lock count associated with a memory object


that was allocated with LMEM_MOVEABLE.

LocateXStateFeature Retrieves a pointer to the processor state for an XState


feature within a CONTEXT structure.

LogonUserA The Win32 LogonUser function attempts to log a user on to


the local computer. LogonUser returns a handle to a user
token that you can use to impersonate user.

LogonUserExA The LogonUserEx function attempts to log a user on to the


local computer.

LogonUserExW The LogonUserEx function attempts to log a user on to the


local computer.
T IT L E DESC RIP T IO N

LogonUserW The Win32 LogonUser function attempts to log a user on to


the local computer. LogonUser returns a handle to a user
token that you can use to impersonate user.

LookupAccountNameA Accepts the name of a system and an account as input. It


retrieves a security identifier (SID) for the account and the
name of the domain on which the account was found.

LookupAccountNameW Accepts the name of a system and an account as input. It


retrieves a security identifier (SID) for the account and the
name of the domain on which the account was found.

LookupAccountSidA Accepts a security identifier (SID) as input. It retrieves the


name of the account for this SID and the name of the first
domain on which this SID is found.

LookupAccountSidLocalA Retrieves the name of the account for the specified SID on
the local machine.

LookupAccountSidLocalW Retrieves the name of the account for the specified SID on
the local machine.

LookupAccountSidW Accepts a security identifier (SID) as input. It retrieves the


name of the account for this SID and the name of the first
domain on which this SID is found.

LookupPrivilegeDisplayNameA Retrieves the display name that represents a specified


privilege.

LookupPrivilegeDisplayNameW Retrieves the display name that represents a specified


privilege.

LookupPrivilegeNameA Retrieves the name that corresponds to the privilege


represented on a specific system by a specified locally unique
identifier (LUID).

LookupPrivilegeNameW Retrieves the name that corresponds to the privilege


represented on a specific system by a specified locally unique
identifier (LUID).

LookupPrivilegeValueA Retrieves the locally unique identifier (LUID) used on a


specified system to locally represent the specified privilege
name.

LookupPrivilegeValueW Retrieves the locally unique identifier (LUID) used on a


specified system to locally represent the specified privilege
name.

lstrcatA Appends one string to another.Warning Do not use.

lstrcatW Appends one string to another.Warning Do not use.

lstrcmpA Compares two character strings. The comparison is case-


sensitive.
T IT L E DESC RIP T IO N

lstrcmpiA Compares two character strings. The comparison is not case-


sensitive.

lstrcmpiW Compares two character strings. The comparison is not case-


sensitive.

lstrcmpW Compares two character strings. The comparison is case-


sensitive.

lstrcpyA Copies a string to a buffer.

lstrcpynA Copies a specified number of characters from a source string


into a buffer.Warning Do not use.

lstrcpynW Copies a specified number of characters from a source string


into a buffer.Warning Do not use.

lstrcpyW Copies a string to a buffer.

lstrlenA Determines the length of the specified string (not including


the terminating null character).

lstrlenW Determines the length of the specified string (not including


the terminating null character).

MAKEINTATOM Converts the specified atom into a string, so it can be


passed to functions which accept either atoms or strings.

MapUserPhysicalPagesScatter Maps previously allocated physical memory pages at a


specified address in an Address Windowing Extensions (AWE)
region.

MapViewOfFileExNuma Maps a view of a file mapping into the address space of a


calling process and specifies the NUMA node for the physical
memory.

MoveFile Moves an existing file or a directory, including its children.

MoveFileA Moves an existing file or a directory, including its children.

MoveFileExA Moves an existing file or directory, including its children, with


various move options.

MoveFileExW Moves an existing file or directory, including its children, with


various move options.

MoveFileTransactedA Moves an existing file or a directory, including its children, as


a transacted operation.

MoveFileTransactedW Moves an existing file or a directory, including its children, as


a transacted operation.

MoveFileW Moves an existing file or a directory, including its children.


T IT L E DESC RIP T IO N

MoveFileWithProgressA Moves a file or directory, including its children. You can


provide a callback function that receives progress
notifications.

MoveFileWithProgressW Moves a file or directory, including its children. You can


provide a callback function that receives progress
notifications.

MulDiv Multiplies two 32-bit values and then divides the 64-bit
result by a third 32-bit value.

NotifyChangeEventLog Enables an application to receive notification when an event


is written to the specified event log.

ObjectCloseAuditAlarmA Generates an audit message in the security event log when a


handle to a private object is deleted.

ObjectDeleteAuditAlarmA Generates audit messages when an object is deleted.

ObjectOpenAuditAlarmA Generates audit messages when a client application


attempts to gain access to an object or to create a new one.

ObjectPrivilegeAuditAlarmA Generates an audit message in the security event log.

OpenBackupEventLogA Opens a handle to a backup event log created by the


BackupEventLog function.

OpenBackupEventLogW Opens a handle to a backup event log created by the


BackupEventLog function.

OpenCommPort Attempts to open a communication device.

OpenEncryptedFileRawA Opens an encrypted file in order to backup (export) or


restore (import) the file.

OpenEncryptedFileRawW Opens an encrypted file in order to backup (export) or


restore (import) the file.

OpenEventLogA Opens a handle to the specified event log.

OpenEventLogW Opens a handle to the specified event log.

OpenFile Creates, opens, reopens, or deletes a file.

OpenFileById Opens the file that matches the specified identifier.

OpenFileMappingA Opens a named file mapping object.

OpenJobObjectA Opens an existing job object.

OpenPrivateNamespaceA Opens a private namespace.


T IT L E DESC RIP T IO N

OperationEnd Notifies the system that the application is about to end an


operation.

OperationStart Notifies the system that the application is about to start an


operation.

PowerClearRequest Decrements the count of power requests of the specified


type for a power request object.

PowerCreateRequest Creates a new power request object.

PowerSetRequest Increments the count of power requests of the specified type


for a power request object.

PrepareTape Prepares the tape to be accessed or removed.

PrivilegedServiceAuditAlarmA Generates an audit message in the security event log.

PulseEvent Sets the specified event object to the signaled state and then
resets it to the nonsignaled state after releasing the
appropriate number of waiting threads.

PurgeComm Discards all characters from the output or input buffer of a


specified communications resource. It can also terminate
pending read or write operations on the resource.

QueryActCtxSettingsW The QueryActCtxSettingsW function specifies the activation


context, and the namespace and name of the attribute that
is to be queried.

QueryActCtxW The QueryActCtxW function queries the activation context.

QueryDosDeviceA Retrieves information about MS-DOS device names.

QueryFullProcessImageNameA Retrieves the full name of the executable image for the
specified process.

QueryFullProcessImageNameW Retrieves the full name of the executable image for the
specified process.

QueryThreadProfiling Determines whether thread profiling is enabled for the


specified thread.

QueryUmsThreadInformation Retrieves information about the specified user-mode


scheduling (UMS) worker thread.

ReadDirectoryChangesExW Retrieves information that describes the changes within the


specified directory, which can include extended information if
that information type is specified.

ReadDirectoryChangesW Retrieves information that describes the changes within the


specified directory.
T IT L E DESC RIP T IO N

ReadEncryptedFileRaw Backs up (export) encrypted files.

ReadEventLogA Reads the specified number of entries from the specified


event log.

ReadEventLogW Reads the specified number of entries from the specified


event log.

ReadThreadProfilingData Reads the specified profiling data associated with the thread.

RegisterApplicationRecoveryCallback Registers the active instance of an application for recovery.

RegisterApplicationRestart Registers the active instance of an application for restart.

RegisterEventSourceA Retrieves a registered handle to the specified event log.

RegisterEventSourceW Retrieves a registered handle to the specified event log.

RegisterWaitForSingleObject Directs a wait thread in the thread pool to wait on the


object.

ReleaseActCtx The ReleaseActCtx function decrements the reference count


of the specified activation context.

RemoveDirectoryTransactedA Deletes an existing empty directory as a transacted


operation.

RemoveDirectoryTransactedW Deletes an existing empty directory as a transacted


operation.

RemoveSecureMemoryCacheCallback Unregisters a callback function that was previously


registered with the AddSecureMemoryCacheCallback
function.

ReOpenFile Reopens the specified file system object with different access
rights, sharing mode, and flags.

ReplaceFileA Replaces one file with another file, with the option of creating
a backup copy of the original file.

ReplaceFileW Replaces one file with another file, with the option of creating
a backup copy of the original file.

ReportEventA Writes an entry at the end of the specified event log.

ReportEventW Writes an entry at the end of the specified event log.

RequestWakeupLatency Has no effect and returns STATUS_NOT_SUPPORTED. This


function is provided only for compatibility with earlier
versions of Windows.Windows Server 2008 and
Windows Vista: Has no effect and always returns success.
T IT L E DESC RIP T IO N

SetCommBreak Suspends character transmission for a specified


communications device and places the transmission line in a
break state until the ClearCommBreak function is called.

SetCommConfig Sets the current configuration of a communications device.

SetCommMask Specifies a set of events to be monitored for a


communications device.

SetCommState Configures a communications device according to the


specifications in a device-control block (a DCB structure). The
function reinitializes all hardware and control settings, but it
does not empty output or input queues.

SetCommTimeouts Sets the time-out parameters for all read and write
operations on a specified communications device.

SetCurrentDirectory Changes the current directory for the current process.

SetDefaultCommConfigA Sets the default configuration for a communications device.

SetDefaultCommConfigW Sets the default configuration for a communications device.

SetDllDirectoryA Adds a directory to the search path used to locate DLLs for
the application.

SetDllDirectoryW Adds a directory to the search path used to locate DLLs for
the application.

SetEnvironmentVariable Sets the contents of the specified environment variable for


the current process.

SetFileAttributesTransactedA Sets the attributes for a file or directory as a transacted


operation.

SetFileAttributesTransactedW Sets the attributes for a file or directory as a transacted


operation.

SetFileBandwidthReservation Requests that bandwidth for the specified file stream be


reserved. The reservation is specified as a number of bytes in
a period of milliseconds for I/O requests on the specified file
handle.

SetFileCompletionNotificationModes Sets the notification modes for a file handle, allowing you to
specify how completion notifications work for the specified
file.

SetFileSecurityA Sets the security of a file or directory object.

SetFileShortNameA Sets the short name for the specified file.

SetFileShortNameW Sets the short name for the specified file.


T IT L E DESC RIP T IO N

SetFirmwareEnvironmentVariableA Sets the value of the specified firmware environment


variable.

SetFirmwareEnvironmentVariableExA Sets the value of the specified firmware environment variable


as the attributes that indicate how this variable is stored and
maintained.

SetFirmwareEnvironmentVariableExW Sets the value of the specified firmware environment variable


and the attributes that indicate how this variable is stored
and maintained.

SetFirmwareEnvironmentVariableW Sets the value of the specified firmware environment


variable.

SetHandleCount

SetMailslotInfo Sets the time-out value used by the specified mailslot for a
read operation.

SetProcessAffinityMask Sets a processor affinity mask for the threads of the specified
process.

SetProcessDEPPolicy Changes data execution prevention (DEP) and DEP-ATL


thunk emulation settings for a 32-bit process.

SetProcessWorkingSetSize Sets the minimum and maximum working set sizes for the
specified process.

SetSearchPathMode Sets the per-process mode that the SearchPath function uses
when locating files.

SetSystemPowerState Suspends the system by shutting power down. Depending


on the ForceFlag parameter, the function either suspends
operation immediately or requests permission from all
applications and device drivers before doing so.

SetTapeParameters Specifies the block size of a tape or configures the tape


device.

SetTapePosition Sets the tape position on the specified device.

SetThreadAffinityMask Sets a processor affinity mask for the specified thread.

SetThreadExecutionState Enables an application to inform the system that it is in use,


thereby preventing the system from entering sleep or
turning off the display while the application is running.

SetThreadpoolCallbackCleanupGroup Associates the specified cleanup group with the specified


callback environment.

SetThreadpoolCallbackLibrary Ensures that the specified DLL remains loaded as long as


there are outstanding callbacks.

SetThreadpoolCallbackPersistent Specifies that the callback should run on a persistent thread.


T IT L E DESC RIP T IO N

SetThreadpoolCallbackPool Sets the thread pool to be used when generating callbacks.

SetThreadpoolCallbackPriority Specifies the priority of a callback function relative to other


work items in the same thread pool.

SetThreadpoolCallbackRunsLong Indicates that callbacks associated with this callback


environment may not return quickly.

SetUmsThreadInformation Sets application-specific context information for the specified


user-mode scheduling (UMS) worker thread.

SetupComm Initializes the communications parameters for a specified


communications device.

SetVolumeLabelA Sets the label of a file system volume.

SetVolumeLabelW Sets the label of a file system volume.

SetVolumeMountPointA Associates a volume with a drive letter or a directory on


another volume.

SetVolumeMountPointW Associates a volume with a drive letter or a directory on


another volume.

SetXStateFeaturesMask Sets the mask of XState features set within a CONTEXT


structure.

SwitchToFiber Schedules a fiber. The function must be called on a fiber.

TransmitCommChar Transmits a specified character ahead of any pending data in


the output buffer of the specified communications device.

UmsThreadYield Yields control to the user-mode scheduling (UMS) scheduler


thread on which the calling UMS worker thread is running.

UnregisterApplicationRecoveryCallback Removes the active instance of an application from the


recovery list.

UnregisterApplicationRestart Removes the active instance of an application from the


restart list.

UnregisterWait Cancels a registered wait operation issued by the


RegisterWaitForSingleObject function.

UpdateResourceA Adds, deletes, or replaces a resource in a portable executable


(PE) file.

UpdateResourceW Adds, deletes, or replaces a resource in a portable executable


(PE) file.

VerifyVersionInfoA Compares a set of operating system version requirements to


the corresponding values for the currently running version
of the system.
T IT L E DESC RIP T IO N

VerifyVersionInfoW Compares a set of operating system version requirements to


the corresponding values for the currently running version
of the system.

WaitCommEvent Waits for an event to occur for a specified communications


device. The set of events that are monitored by this function
is contained in the event mask associated with the device
handle.

WaitNamedPipeA Waits until either a time-out interval elapses or an instance


of the specified named pipe is available for connection (that
is, the pipe's server process has a pending
ConnectNamedPipe operation on the pipe).

WinExec Runs the specified application.

WinMain The user-provided entry point for a graphical Windows-


based application.

Wow64EnableWow64FsRedirection Enables or disables file system redirection for the calling


thread.

Wow64GetThreadSelectorEntry Retrieves a descriptor table entry for the specified selector


and WOW64 thread.

WriteEncryptedFileRaw Restores (import) encrypted files.

WritePrivateProfileSectionA Replaces the keys and values for the specified section in an
initialization file.

WritePrivateProfileSectionW Replaces the keys and values for the specified section in an
initialization file.

WritePrivateProfileStringA Copies a string into the specified section of an initialization


file.

WritePrivateProfileStringW Copies a string into the specified section of an initialization


file.

WritePrivateProfileStructA Copies data into a key in the specified section of an


initialization file. As it copies the data, the function calculates
a checksum and appends it to the end of the data.

WritePrivateProfileStructW Copies data into a key in the specified section of an


initialization file. As it copies the data, the function calculates
a checksum and appends it to the end of the data.

WriteProfileSectionA Replaces the contents of the specified section in the Win.ini


file with specified keys and values.

WriteProfileSectionW Replaces the contents of the specified section in the Win.ini


file with specified keys and values.

WriteProfileStringA Copies a string into the specified section of the Win.ini file.
T IT L E DESC RIP T IO N

WriteProfileStringW Copies a string into the specified section of the Win.ini file.

WriteTapemark Writes a specified number of filemarks, setmarks, short


filemarks, or long filemarks to a tape device.

WTSGetActiveConsoleSessionId Retrieves the session identifier of the console session.

ZombifyActCtx The ZombifyActCtx function deactivates the specified


activation context, but does not deallocate it.

Callback functions
T IT L E DESC RIP T IO N

LPPROGRESS_ROUTINE An application-defined callback function used with the


CopyFileEx, MoveFileTransacted, and MoveFileWithProgress
functions.

PCOPYFILE2_PROGRESS_ROUTINE An application-defined callback function used with the


CopyFile2 function.

PFE_EXPORT_FUNC An application-defined callback function used with


ReadEncryptedFileRaw.

PFE_IMPORT_FUNC An application-defined callback function used with


WriteEncryptedFileRaw. The system calls ImportCallback one
or more times, each time to retrieve a portion of a backup
file's data.

PFIBER_START_ROUTINE An application-defined function used with the CreateFiber


function. It serves as the starting address for a fiber.

Structures
T IT L E DESC RIP T IO N

ACTCTX_SECTION_KEYED_DATA The ACTCTX_SECTION_KEYED_DATA structure is used by the


FindActCtxSectionString and FindActCtxSectionGuid
functions to return the activation context information along
with either the GUID or 32-bit integer-tagged activation
context section.

ACTCTXA The ACTCTX structure is used by the CreateActCtx function


to create the activation context.

ACTCTXW The ACTCTX structure is used by the CreateActCtx function


to create the activation context.

COMMCONFIG Contains information about the configuration state of a


communications device.

COMMPROP Contains information about a communications driver.


T IT L E DESC RIP T IO N

COMMTIMEOUTS Contains the time-out parameters for a communications


device.

COMSTAT Contains information about a communications device.

COPYFILE2_EXTENDED_PARAMETERS Contains extended parameters for the CopyFile2 function.

COPYFILE2_MESSAGE Passed to the CopyFile2ProgressRoutine callback function


with information about a pending copy operation.

DCB Defines the control setting for a serial communications


device.

EVENTLOG_FULL_INFORMATION Indicates whether the event log is full.

FILE_ALIGNMENT_INFO Contains alignment information for a file.

FILE_ALLOCATION_INFO Contains the total number of bytes that should be allocated


for a file.

FILE_ATTRIBUTE_TAG_INFO Receives the requested file attribute information. Used for


any handles.

FILE_BASIC_INFO Contains the basic information for a file. Used for file
handles.

FILE_COMPRESSION_INFO Receives file compression information.

FILE_DISPOSITION_INFO Indicates whether a file should be deleted. Used for any


handles.

FILE_END_OF_FILE_INFO Contains the specified value to which the end of the file
should be set.

FILE_FULL_DIR_INFO Contains directory information for a file.

FILE_ID_BOTH_DIR_INFO Contains information about files in the specified directory.

FILE_ID_DESCRIPTOR Specifies the type of ID that is being used.

FILE_ID_EXTD_DIR_INFO Contains identification information for a file.

FILE_ID_INFO Contains identification information for a file.

FILE_IO_PRIORITY_HINT_INFO Specifies the priority hint for a file I/O operation.

FILE_NAME_INFO Receives the file name.

FILE_REMOTE_PROTOCOL_INFO Contains file remote protocol information.

FILE_RENAME_INFO Contains the name to which the file should be renamed.


T IT L E DESC RIP T IO N

FILE_STANDARD_INFO Receives extended information for the file.

FILE_STORAGE_INFO Contains directory information for a file.

FILE_STREAM_INFO Receives file stream information for the specified file.

HW_PROFILE_INFOA Contains information about a hardware profile.

HW_PROFILE_INFOW Contains information about a hardware profile.

MEMORYSTATUS Contains information about the current state of both


physical and virtual memory.

OFSTRUCT Contains information about a file that the OpenFile function


opened or attempted to open.

OPERATION_END_PARAMETERS This structure is used by the OperationEnd function.

OPERATION_START_PARAMETERS This structure is used by the OperationStart function.

STARTUPINFOEXA Specifies the window station, desktop, standard handles, and


attributes for a new process. It is used with the
CreateProcess and CreateProcessAsUser functions.

STARTUPINFOEXW Specifies the window station, desktop, standard handles, and


attributes for a new process. It is used with the
CreateProcess and CreateProcessAsUser functions.

SYSTEM_POWER_STATUS Contains information about the power status of the system.

UMS_SCHEDULER_STARTUP_INFO Specifies attributes for a user-mode scheduling (UMS)


scheduler thread.

UMS_SYSTEM_THREAD_INFORMATION Specifies a UMS scheduler thread, UMS worker thread, or


non-UMS thread. The GetUmsSystemThreadInformation
function uses this structure.

WIN32_STREAM_ID Contains stream data.

Enumerations
T IT L E DESC RIP T IO N

COPYFILE2_COPY_PHASE Indicates the phase of a copy at the time of an error.

COPYFILE2_MESSAGE_ACTION Returned by the CopyFile2ProgressRoutine callback function


to indicate what action should be taken for the pending
copy operation.

COPYFILE2_MESSAGE_TYPE Indicates the type of message passed in the


COPYFILE2_MESSAGE structure to the
CopyFile2ProgressRoutine callback function.
T IT L E DESC RIP T IO N

FILE_ID_TYPE Discriminator for the union in the FILE_ID_DESCRIPTOR


structure.

PRIORITY_HINT Defines values that are used with the


FILE_IO_PRIORITY_HINT_INFO structure to specify the
priority hint for a file I/O operation.
WinMain function (winbase.h)
2/1/2021 • 2 minutes to read • Edit Online

The user-provided entry point for a graphical Windows-based application.


WinMain is the conventional name used for the application entry point. For more information, see Remarks.

Syntax
int __clrcall WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd
);

Parameters
hInstance

Type: HINSTANCE
A handle to the current instance of the application.
hPrevInstance

Type: HINSTANCE
A handle to the previous instance of the application. This parameter is always NULL . If you need to detect
whether another instance already exists, create a uniquely named mutex using the CreateMutex function.
CreateMutex will succeed even if the mutex already exists, but the function will return
ERROR_ALREADY_EXISTS . This indicates that another instance of your application exists, because it created
the mutex first. However, a malicious user can create this mutex before you do and prevent your application
from starting. To prevent this situation, create a randomly named mutex and store the name so that it can only
be obtained by an authorized user. Alternatively, you can use a file for this purpose. To limit your application to
one instance per user, create a locked file in the user's profile directory.
lpCmdLine

Type: LPSTR
The command line for the application, excluding the program name. To retrieve the entire command line, use the
GetCommandLine function.
nShowCmd

TBD

Return value
Type: int
If the function succeeds, terminating when it receives a WM_QUIT message, it should return the exit value
contained in that message's wParam parameter. If the function terminates before entering the message loop, it
should return zero.

Remarks
The name WinMain is used by convention by many programming frameworks. Depending on the
programming framework, the call to the WinMain function can be preceded and followed by additional
activities specific to that framework.
Your WinMain should initialize the application, display its main window, and enter a message retrieval-and-
dispatch loop that is the top-level control structure for the remainder of the application's execution. Terminate
the message loop when it receives a WM_QUIT message. At that point, your WinMain should exit the
application, returning the value passed in the WM_QUIT message's wParam parameter. If WM_QUIT was
received as a result of calling PostQuitMessage, the value of wParam is the value of the PostQuitMessage
function's nExitCode parameter. For more information, see Creating a Message Loop.
ANSI applications can use the lpCmdLine parameter of the WinMain function to access the command-line
string, excluding the program name. Note that lpCmdLine uses the LPSTR data type instead of the LPTSTR data
type. This means that WinMain cannot be used by Unicode programs. The GetCommandLineW function can be
used to obtain the command line as a Unicode string. Some programming frameworks might provide an
alternative entry point that provides a Unicode command line. For example, the Microsoft Visual Studio C++
complier uses the name wWinMain for the Unicode entry point.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winbase.h (include Windows.h)

See also
Conceptual
CreateMutex
DispatchMessage
GetCommandLine
GetMessage
Other Resources
PostQuitMessage
Reference
TranslateMessage
Windows
windef.h header
2/1/2021 • 2 minutes to read • Edit Online

This header is used by Windows GDI. For more information, see:


Windows GDI windef.h contains the following programming interfaces:

Structures
T IT L E DESC RIP T IO N

POINT The POINT structure defines the x- and y-coordinates of a


point.

POINTL The POINTL structure defines the x- and y-coordinates of a


point.

POINTS The POINTS structure defines the x- and y-coordinates of a


point.

RECT The RECT structure defines a rectangle by the coordinates of


its upper-left and lower-right corners.

RECTL The RECTL structure defines a rectangle by the coordinates


of its upper-left and lower-right corners.

SIZE The SIZE structure defines the width and height of a


rectangle.

Enumerations
T IT L E DESC RIP T IO N

DPI_AWARENESS Identifies the dots per inch (dpi) setting for a thread, process,
or window.

DPI_HOSTING_BEHAVIOR Identifies the DPI hosting behavior for a window. This


behavior allows windows created in the thread to host child
windows with a different DPI_AWARENESS_CONTEXT.
windowsx.h header
2/1/2021 • 14 minutes to read • Edit Online

This header is used by Windows Controls. For more information, see:


Windows Controls windowsx.h contains the following programming interfaces:

Functions
T IT L E DESC RIP T IO N

Button_Enable Enables or disables a button.

Button_GetCheck Gets the check state of a radio button or check box. You can
use this macro or send the BM_GETCHECK message
explicitly.

Button_GetState Retrieves the state of a button or check box. You can use this
macro or send the BM_GETSTATE message explicitly.

Button_GetText Gets the text of a button.

Button_GetTextLength Gets the number of characters in the text of a button.

Button_SetCheck Sets the check state of a radio button or check box. You can
use this macro or send the BM_SETCHECK message explicitly.

Button_SetState Sets the highlight state of a button. The highlight state


indicates whether the button is highlighted as if the user had
pushed it. You can use this macro or send the BM_SETSTATE
message explicitly.

Button_SetStyle Sets the style of a button. You can use this macro or send
the BM_SETSTYLE message explicitly.

Button_SetText Sets the text of a button.

ComboBox_AddItemData Adds item data to the list in a combo box at the specified
location. You can use this macro or send the CB_ADDSTRING
message explicitly.

ComboBox_AddString Adds a string to a list in a combo box.

ComboBox_DeleteString Deletes the item at the specified location in a list in a combo


box. You can use this macro or send the CB_DELETESTRING
message explicitly.

ComboBox_Dir Adds names to the list displayed by a combo box.

ComboBox_Enable Enables or disables a combo box control.


T IT L E DESC RIP T IO N

ComboBox_FindItemData Finds the first item in a combo box list that has the specified
item data. You can use this macro or send the
CB_FINDSTRING message explicitly.

ComboBox_FindString Finds the first string in a combo box list that begins with the
specified string. You can use this macro or send the
CB_FINDSTRING message explicitly.

ComboBox_FindStringExact Finds the first string in a combo box list that exactly matches
the specified string, except that the search is not case
sensitive. You can use this macro or send the
CB_FINDSTRINGEXACT message explicitly.

ComboBox_GetCount Gets the number of items in the list box of a combo box. You
can use this macro or send the CB_GETCOUNT message
explicitly.

ComboBox_GetCurSel Gets the index of the currently selected item in a combo box.
You can use this macro or send the CB_GETCURSEL message
explicitly.

ComboBox_GetDroppedControlRect Retrieves the screen coordinates of a combo box in its


dropped-down state. You can use this macro or send the
CB_GETDROPPEDCONTROLRECT message explicitly.

ComboBox_GetDroppedState Ascertains whether the drop list in a combo box control is


visible. You can use this macro or send the
CB_GETDROPPEDSTATE message explicitly.

ComboBox_GetExtendedUI Ascertains whether a combo box is using the default user


interface (UI) or the extended UI. You can use this macro or
send the CB_GETEXTENDEDUI message explicitly.

ComboBox_GetItemData Gets the application-defined value associated with the


specified list item in a combo box. You can use this macro or
send the CB_GETITEMDATA message explicitly.

ComboBox_GetItemHeight Retrieves the height of list items in a combo box. You can use
this macro or send the CB_GETITEMHEIGHT message
explicitly.

ComboBox_GetLBText Gets a string from a list in a combo box. You can use this
macro or send the CB_GETLBTEXT message explicitly.

ComboBox_GetLBTextLen Gets the length of a string in the list in a combo box. You
can use this macro or send the CB_GETLBTEXTLEN message
explicitly.

ComboBox_GetText Retrieves the text from a combo box control.

ComboBox_GetTextLength Gets the number of characters in the text of a combo box.

ComboBox_InsertItemData Inserts item data in a list in a combo box at the specified


location. You can use this macro or send the
CB_INSERTSTRING message explicitly.
T IT L E DESC RIP T IO N

ComboBox_InsertString Adds a string to a list in a combo box at the specified


location. You can use this macro or send the
CB_INSERTSTRING message explicitly.

ComboBox_LimitText Limits the length of the text the user may type into the edit
control of a combo box. You can use this macro or send the
CB_LIMITTEXT message explicitly.

ComboBox_ResetContent Removes all items from the list box and edit control of a
combo box. You can use this macro or send the
CB_RESETCONTENT message explicitly.

ComboBox_SelectItemData Searches a list in a combo box for an item that has the
specified item data. If a matching item is found, the item is
selected. You can use this macro or send the
CB_SELECTSTRING message explicitly.

ComboBox_SelectString Searches a list in a combo box for an item that begins with
the characters in a specified string. If a matching item is
found, the item is selected. You can use this macro or send
the CB_SELECTSTRING message explicitly.

ComboBox_SetCurSel Sets the currently selected item in a combo box. You can use
this macro or send the CB_SETCURSEL message explicitly.

ComboBox_SetExtendedUI Selects either the default user interface (UI) or the extended
UI for a combo box that has the CBS_DROPDOWN or
CBS_DROPDOWNLIST style. You can use this macro or send
the CB_SETEXTENDEDUI message explicitly.

ComboBox_SetItemData Sets the application-defined value associated with the


specified list item in a combo box. You can use this macro or
send the CB_SETITEMDATA message explicitly.

ComboBox_SetItemHeight Sets the height of list items or the selection field in a combo
box. You can use this macro or send the CB_SETITEMHEIGHT
message explicitly.

ComboBox_SetText Sets the text of a combo box.

ComboBox_ShowDropdown Shows or hides the list in a combo box. You can use this
macro or send the CB_SHOWDROPDOWN message
explicitly.

DeleteFont The DeleteFont macro deletes a font object, freeing all


system resources associated with the font object.

Edit_CanUndo Determines whether there are any actions in the undo


queue of an edit or rich edit control. You can use this macro
or send the EM_CANUNDO message explicitly.

Edit_EmptyUndoBuffer Resets the undo flag of an edit or rich edit control. The undo
flag is set whenever an operation within the edit control can
be undone. You can use this macro or send the
EM_EMPTYUNDOBUFFER message explicitly.
T IT L E DESC RIP T IO N

Edit_Enable Enables or disables an edit control.

Edit_FmtLines Sets a flag that determines whether text retrieved from a


multiline edit control includes soft line-break characters.

Edit_GetFirstVisibleLine Gets the index of the uppermost visible line in a multiline


edit or rich edit control. You can use this macro or send the
EM_GETFIRSTVISIBLELINE message explicitly.

Edit_GetHandle Gets a handle to the memory currently allocated for the text
of a multiline edit control. You can use this macro or send
the EM_GETHANDLE message explicitly.

Edit_GetLine Retrieves a line of text from an edit or rich edit control. You
can use this macro or send the EM_GETLINE message
explicitly.

Edit_GetLineCount Gets the number of lines in the text of an edit control. You
can use this macro or send the EM_GETLINECOUNT
message explicitly.

Edit_GetModify Gets the state of an edit or rich edit control's modification


flag. The flag indicates whether the contents of the control
have been modified. You can use this macro or send the
EM_GETMODIFY message explicitly.

Edit_GetPasswordChar Gets the password character for an edit or rich edit control.
You can use this macro or send the
EM_GETPASSWORDCHAR message explicitly.

Edit_GetRect Gets the formatting rectangle of an edit control. You can use
this macro or send the EM_GETRECT message explicitly.

Edit_GetSel Gets the starting and ending character positions of the


current selection in an edit or rich edit control. You can use
this macro or send the EM_GETSEL message explicitly.

Edit_GetText Gets the text of an edit control.

Edit_GetTextLength Gets the number of characters in the text of an edit control.

Edit_GetWordBreakProc Retrieves the address of an edit or rich edit control's


Wordwrap function. You can use this macro or send the
EM_GETWORDBREAKPROC message explicitly.

Edit_LimitText Limits the length of text that can be entered into an edit
control. You can use this macro or send the EM_LIMITTEXT
message explicitly.

Edit_LineFromChar Gets the index of the line that contains the specified
character index in a multiline edit or rich edit control. You can
use this macro or send the EM_LINEFROMCHAR message
explicitly.
T IT L E DESC RIP T IO N

Edit_LineIndex Gets the character index of the first character of a specified


line in a multiline edit or rich edit control. You can use this
macro or send the EM_LINEINDEX message explicitly.

Edit_LineLength Retrieves the length, in characters, of a line in an edit or rich


edit control. You can use this macro or send the
EM_LINELENGTH message explicitly.

Edit_ReplaceSel Replaces the selected text in an edit control or a rich edit


control with the specified text. You can use this macro or
send the EM_REPLACESEL message explicitly.

Edit_Scroll Scrolls the text vertically in a multiline edit or rich edit


control. You can use this macro or send the EM_SCROLL
message explicitly.

Edit_ScrollCaret Scrolls the caret into view in an edit or rich edit control. You
can use this macro or send the EM_SCROLLCARET message
explicitly.

Edit_SetHandle Sets the handle of the memory that will be used by a


multiline edit control. You can use this macro or send the
EM_SETHANDLE message explicitly.

Edit_SetModify Sets or clears the modification flag for an edit control. The
modification flag indicates whether the text within the edit
control has been modified. You can use this macro or send
the EM_SETMODIFY message explicitly.

Edit_SetPasswordChar Sets or removes the password character for an edit or rich


edit control. When a password character is set, that
character is displayed in place of the characters typed by the
user. You can use this macro or send the
EM_SETPASSWORDCHAR message explicitly.

Edit_SetReadOnly Sets or removes the read-only style (ES_READONLY) of an


edit or rich edit control. You can use this macro or send the
EM_SETREADONLY message explicitly.

Edit_SetRect Sets the formatting rectangle of an edit control. You can use
this macro or send the EM_SETRECT message explicitly.

Edit_SetRectNoPaint Sets the formatting rectangle of a multiline edit control. This


macro is equivalent to Edit_SetRect, except that it does not
redraw the edit control window. You can use this macro or
send the EM_SETRECTNP message explicitly.

Edit_SetSel Selects a range of characters in an edit or rich edit control.


You can use this macro or send the EM_SETSEL message
explicitly.

Edit_SetTabStops Sets the tab stops in a multiline edit or rich edit control.
When text is copied to the control, any tab character in the
text causes space to be generated up to the next tab stop.
You can use this macro or send the EM_SETTABSTOPS
message explicitly.
T IT L E DESC RIP T IO N

Edit_SetText Sets the text of an edit control.

Edit_SetWordBreakProc Replaces an edit control's default Wordwrap function with an


application-defined Wordwrap function. You can use this
macro or send the EM_SETWORDBREAKPROC message
explicitly.

Edit_Undo Undoes the last operation in the undo queue of an edit or


rich edit control. You can use this macro or send the
EM_UNDO message explicitly.

GET_X_LPARAM Retrieves the signed x-coordinate from the specified


LPARAM value.

GET_Y_LPARAM Retrieves the signed y-coordinate from the given LPARAM


value.

ListBox_AddItemData Adds item data to the list box at the specified location. You
can use this macro or send the LB_ADDSTRING message
explicitly.

ListBox_AddString Adds a string to a list box.

ListBox_DeleteString Deletes the item at the specified location in a list box. You
can use this macro or send the LB_DELETESTRING message
explicitly.

ListBox_Dir Adds names to the list displayed by a list box.

ListBox_Enable Enables or disables a list box control.

ListBox_FindItemData Finds the first item in a list box that has the specified item
data. You can use this macro or send the LB_FINDSTRING
message explicitly.

ListBox_FindString Finds the first string in a list box that begins with the
specified string. You can use this macro or send the
LB_FINDSTRING message explicitly.

ListBox_FindStringExact Finds the first list box string that exactly matches the
specified string, except that the search is not case sensitive.
You can use this macro or send the LB_FINDSTRINGEXACT
message explicitly.

ListBox_GetCaretIndex Retrieves the index of the list box item that has the focus
rectangle in a multiple-selection list box. The item may or
may not be selected. You can use this macro or send the
LB_GETCARETINDEX message explicitly.

ListBox_GetCount Gets the number of items in a list box. You can use this
macro or send the LB_GETCOUNT message explicitly.

ListBox_GetCurSel Gets the index of the currently selected item in a single-


selection list box. You can use this macro or send the
LB_GETCURSEL message explicitly.
T IT L E DESC RIP T IO N

ListBox_GetHorizontalExtent Gets the width that a list box can be scrolled horizontally
(the scrollable width) if the list box has a horizontal scroll bar.
You can use this macro or send the
LB_GETHORIZONTALEXTENT message explicitly.

ListBox_GetItemData Gets the application-defined value associated with the


specified list box item. You can use this macro or send the
LB_GETITEMDATA message explicitly.

ListBox_GetItemHeight Retrieves the height of items in a list box.

ListBox_GetItemRect Gets the dimensions of the rectangle that bounds a list box
item as it is currently displayed in the list box. You can use
this macro or send the LB_GETITEMRECT message explicitly.

ListBox_GetSel Gets the selection state of an item. You can use this macro
or send the LB_GETSEL message explicitly.

ListBox_GetSelCount Gets the count of selected items in a multiple-selection list


box. You can use this macro or send the LB_GETSELCOUNT
message explicitly.

ListBox_GetSelItems Gets the indexes of selected items in a multiple-selection list


box. You can use this macro or send the LB_GETSELITEMS
message explicitly.

ListBox_GetText Gets a string from a list box. You can use this macro or send
the LB_GETTEXT message explicitly.

ListBox_GetTextLen Gets the length of a string in a list box. You can use this
macro or send the LB_GETTEXTLEN message explicitly.

ListBox_GetTopIndex Gets the index of the first visible item in a list box. You can
use this macro or send the LB_GETTOPINDEX message
explicitly.

ListBox_InsertItemData Inserts item data to a list box at the specified location. You
can use this macro or send the LB_INSERTSTRING message
explicitly.

ListBox_InsertString Adds a string to a list box at the specified location. You can
use this macro or send the LB_INSERTSTRING message
explicitly.

ListBox_ResetContent Removes all items from a list box. You can use this macro or
send the LB_RESETCONTENT message explicitly.

ListBox_SelectItemData Searches a list box for an item that has the specified item
data. If a matching item is found, the item is selected. You
can use this macro or send the LB_SELECTSTRING message
explicitly.
T IT L E DESC RIP T IO N

ListBox_SelectString Searches a list box for an item that begins with the
characters in a specified string. If a matching item is found,
the item is selected. You can use this macro or send the
LB_SELECTSTRING message explicitly.

ListBox_SelItemRange Selects or deselects one or more consecutive items in a


multiple-selection list box. You can use this macro or send
the LB_SELITEMRANGE message explicitly.

ListBox_SetCaretIndex Sets the focus rectangle to the item at the specified index in
a multiple-selection list box. If the item is not visible, it is
scrolled into view. You can use this macro or send the
LB_SETCARETINDEX message explicitly.

ListBox_SetColumnWidth Sets the width of all columns in a multiple-column list box.


You can use this macro or send the LB_SETCOLUMNWIDTH
message explicitly.

ListBox_SetCurSel Sets the currently selected item in a single-selection list box.


You can use this macro or send the LB_SETCURSEL message
explicitly.

ListBox_SetHorizontalExtent Set the width by which a list box can be scrolled horizontally
(the scrollable width).

ListBox_SetItemData Sets the application-defined value associated with the


specified list box item. You can use this macro or send the
LB_SETITEMDATA message explicitly.

ListBox_SetItemHeight Sets the height of items in a list box.

ListBox_SetSel Selects or deselects an item in a multiple-selection list box.


You can use this macro or send the LB_SETSEL message
explicitly.

ListBox_SetTabStops Sets the tab-stop positions in a list box. You can use this
macro or send the LB_SETTABSTOPS message explicitly.

ListBox_SetTopIndex Ensures that the specified item in a list box is visible. You can
use this macro or send the LB_SETTOPINDEX message
explicitly.

ScrollBar_Enable Enables or disables a scroll bar control.

ScrollBar_GetPos Retrieves the position of the scroll box (thumb) in the


specified scroll bar.

ScrollBar_GetRange Gets the range of a scroll bar.

ScrollBar_SetPos Sets the position of the scroll box (thumb) in the specified
scroll bar and, if requested, redraws the scroll bar to reflect
the new position of the scroll box.

ScrollBar_SetRange Sets the range of a scroll bar.


T IT L E DESC RIP T IO N

ScrollBar_Show Shows or hides a scroll bar control.

SelectFont The SelectFont macro selects a font object into the specified
device context (DC). The new font object replaces the
previous font object.

Static_Enable Enables or disables a static control.

Static_GetIcon Retrieves a handle to the icon associated with a static control


that has the SS_ICON style. You can use this macro or send
the STM_GETICON message explicitly.

Static_GetText Gets the text of a static control.

Static_GetTextLength Gets the number of characters in the text of a static control.

Static_SetIcon Sets the icon for a static control. You can use this macro or
send the STM_SETICON message explicitly.

Static_SetText Sets the text of a static control.


GET_X_LPARAM macro (windowsx.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the signed x-coordinate from the specified LPARAM value.

Syntax
void GET_X_LPARAM(
lp
);

Parameters
lp

The data from which the x-coordinate is to be extracted.

Return value
Type: int
X-coordinate.

Remarks
Use GET_X_LPARAM instead of LOWORD to extract signed coordinate data. Negative screen coordinates may
be returned on multiple monitor systems.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header windowsx.h (include Windowsx.h)

See also
Conceptual
GET_Y_LPARAM
LOWORD
Reference
Windows Data Types
GET_Y_LPARAM macro (windowsx.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the signed y-coordinate from the given LPARAM value.

Syntax
void GET_Y_LPARAM(
lp
);

Parameters
lp

The data from which the y-coordinate is to be extracted.

Return value
Type: int
Y-coordinate.

Remarks
Use GET_Y_LPARAM instead of HIWORD to extract signed coordinate data. Negative screen coordinates may
be returned on multiple monitor systems.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header windowsx.h (include Windowsx.h)

See also
Conceptual
GET_X_LPARAM
HIWORD
Reference
Windows Data Types
winuser.h header
2/1/2021 • 78 minutes to read • Edit Online

This header is used by Windows Controls. For more information, see:


Windows Controls winuser.h contains the following programming interfaces:

Functions
T IT L E DESC RIP T IO N

ActivateKeyboardLayout Sets the input locale identifier (formerly called the keyboard
layout handle) for the calling thread or the current process.
The input locale identifier specifies a locale as well as the
physical layout of the keyboard.

AddClipboardFormatListener Places the given window in the system-maintained clipboard


format listener list.

AdjustWindowRect Calculates the required size of the window rectangle, based


on the desired client-rectangle size. The window rectangle
can then be passed to the CreateWindow function to create
a window whose client area is the desired size.

AdjustWindowRectEx Calculates the required size of the window rectangle, based


on the desired size of the client rectangle. The window
rectangle can then be passed to the CreateWindowEx
function to create a window whose client area is the desired
size.

AdjustWindowRectExForDpi Calculates the required size of the window rectangle, based


on the desired size of the client rectangle and the provided
DPI.

AllowSetForegroundWindow Enables the specified process to set the foreground window


using the SetForegroundWindow function. The calling
process must already be able to set the foreground window.
For more information, see Remarks later in this topic.

AnimateWindow Enables you to produce special effects when showing or


hiding windows. There are four types of animation:_roll, slide,
collapse or expand, and alpha-blended fade.

AnyPopup Indicates whether an owned, visible, top-level pop-up, or


overlapped window exists on the screen. The function
searches the entire screen, not just the calling application's
client area.

AppendMenuA Appends a new item to the end of the specified menu bar,
drop-down menu, submenu, or shortcut menu. You can use
this function to specify the content, appearance, and
behavior of the menu item.
T IT L E DESC RIP T IO N

AppendMenuW Appends a new item to the end of the specified menu bar,
drop-down menu, submenu, or shortcut menu. You can use
this function to specify the content, appearance, and
behavior of the menu item.

AreDpiAwarenessContextsEqual Determines whether two DPI_AWARENESS_CONTEXT values


are identical.

ArrangeIconicWindows Arranges all the minimized (iconic) child windows of the


specified parent window.

AttachThreadInput Attaches or detaches the input processing mechanism of


one thread to that of another thread.

BeginDeferWindowPos Allocates memory for a multiple-window- position structure


and returns the handle to the structure.

BeginPaint The BeginPaint function prepares the specified window for


painting and fills a PAINTSTRUCT structure with information
about the painting.

BlockInput Blocks keyboard and mouse input events from reaching


applications.

BringWindowToTop Brings the specified window to the top of the Z order. If the
window is a top-level window, it is activated. If the window is
a child window, the top-level parent window associated with
the child window is activated.

BroadcastSystemMessage Sends a message to the specified recipients.

BroadcastSystemMessageExA Sends a message to the specified recipients.

BroadcastSystemMessageExW Sends a message to the specified recipients.

BroadcastSystemMessageW Sends a message to the specified recipients.

CalculatePopupWindowPosition Calculates an appropriate pop-up window position using the


specified anchor point, pop-up window size, flags, and the
optional exclude rectangle.

CallMsgFilterA Passes the specified message and hook code to the hook
procedures associated with the WH_SYSMSGFILTER and
WH_MSGFILTER hooks.

CallMsgFilterW Passes the specified message and hook code to the hook
procedures associated with the WH_SYSMSGFILTER and
WH_MSGFILTER hooks.

CallNextHookEx Passes the hook information to the next hook procedure in


the current hook chain. A hook procedure can call this
function either before or after processing the hook
information.
T IT L E DESC RIP T IO N

CallWindowProcA Passes message information to the specified window


procedure.

CallWindowProcW Passes message information to the specified window


procedure.

CascadeWindows Cascades the specified child windows of the specified parent


window.

ChangeClipboardChain Removes a specified window from the chain of clipboard


viewers.

ChangeDisplaySettingsA The ChangeDisplaySettings function changes the settings of


the default display device to the specified graphics mode.

ChangeDisplaySettingsExA The ChangeDisplaySettingsEx function changes the settings


of the specified display device to the specified graphics
mode.

ChangeDisplaySettingsExW The ChangeDisplaySettingsEx function changes the settings


of the specified display device to the specified graphics
mode.

ChangeDisplaySettingsW The ChangeDisplaySettings function changes the settings of


the default display device to the specified graphics mode.

ChangeWindowMessageFilter Adds or removes a message from the User Interface


Privilege Isolation (UIPI) message filter.

ChangeWindowMessageFilterEx Modifies the User Interface Privilege Isolation (UIPI) message


filter for a specified window.

CharLowerA Converts a character string or a single character to


lowercase. If the operand is a character string, the function
converts the characters in place.

CharLowerBuffA Converts uppercase characters in a buffer to lowercase


characters. The function converts the characters in place.

CharLowerBuffW Converts uppercase characters in a buffer to lowercase


characters. The function converts the characters in place.

CharLowerW Converts a character string or a single character to


lowercase. If the operand is a character string, the function
converts the characters in place.

CharNextA Retrieves a pointer to the next character in a string. This


function can handle strings consisting of either single- or
multi-byte characters.

CharNextExA Retrieves the pointer to the next character in a string. This


function can handle strings consisting of either single- or
multi-byte characters.
T IT L E DESC RIP T IO N

CharNextW Retrieves a pointer to the next character in a string. This


function can handle strings consisting of either single- or
multi-byte characters.

CharPrevA Retrieves a pointer to the preceding character in a string.


This function can handle strings consisting of either single-
or multi-byte characters.

CharPrevExA Retrieves the pointer to the preceding character in a string.


This function can handle strings consisting of either single-
or multi-byte characters.

CharPrevW Retrieves a pointer to the preceding character in a string.


This function can handle strings consisting of either single-
or multi-byte characters.

CharToOemA Translates a string into the OEM-defined character


set.Warning Do not use.

CharToOemBuffA Translates a specified number of characters in a string into


the OEM-defined character set.

CharToOemBuffW Translates a specified number of characters in a string into


the OEM-defined character set.

CharToOemW Translates a string into the OEM-defined character


set.Warning Do not use.

CharUpperA Converts a character string or a single character to


uppercase. If the operand is a character string, the function
converts the characters in place.

CharUpperBuffA Converts lowercase characters in a buffer to uppercase


characters. The function converts the characters in place.

CharUpperBuffW Converts lowercase characters in a buffer to uppercase


characters. The function converts the characters in place.

CharUpperW Converts a character string or a single character to


uppercase. If the operand is a character string, the function
converts the characters in place.

CheckDlgButton Changes the check state of a button control.

CheckMenuItem Sets the state of the specified menu item's check-mark


attribute to either selected or clear.

CheckMenuRadioItem Checks a specified menu item and makes it a radio item. At


the same time, the function clears all other menu items in
the associated group and clears the radio-item type flag for
those items.

CheckRadioButton Adds a check mark to (checks) a specified radio button in a


group and removes a check mark from (clears) all other radio
buttons in the group.
T IT L E DESC RIP T IO N

ChildWindowFromPoint Determines which, if any, of the child windows belonging to


a parent window contains the specified point. The search is
restricted to immediate child windows. Grandchildren, and
deeper descendant windows are not searched.

ChildWindowFromPointEx Determines which, if any, of the child windows belonging to


the specified parent window contains the specified point.

ClientToScreen The ClientToScreen function converts the client-area


coordinates of a specified point to screen coordinates.

ClipCursor Confines the cursor to a rectangular area on the screen.

CloseClipboard Closes the clipboard.

CloseDesktop Closes an open handle to a desktop object.

CloseGestureInfoHandle Closes resources associated with a gesture information


handle.

CloseTouchInputHandle Closes a touch input handle, frees process memory


associated with it, and invalidates the handle.

CloseWindow Minimizes (but does not destroy) the specified window.

CloseWindowStation Closes an open window station handle.

CopyAcceleratorTableA Copies the specified accelerator table. This function is used


to obtain the accelerator-table data that corresponds to an
accelerator-table handle, or to determine the size of the
accelerator-table data.

CopyAcceleratorTableW Copies the specified accelerator table. This function is used


to obtain the accelerator-table data that corresponds to an
accelerator-table handle, or to determine the size of the
accelerator-table data.

CopyCursor Copies the specified cursor.

CopyIcon Copies the specified icon from another module to the


current module.

CopyImage Creates a new image (icon, cursor, or bitmap) and copies the
attributes of the specified image to the new one. If
necessary, the function stretches the bits to fit the desired
size of the new image.

CopyRect The CopyRect function copies the coordinates of one


rectangle to another.
T IT L E DESC RIP T IO N

CountClipboardFormats Retrieves the number of different data formats currently on


the clipboard.

CreateAcceleratorTableA Creates an accelerator table.

CreateAcceleratorTableW Creates an accelerator table.

CreateCaret Creates a new shape for the system caret and assigns
ownership of the caret to the specified window. The caret
shape can be a line, a block, or a bitmap.

CreateCursor Creates a cursor having the specified size, bit patterns, and
hot spot.

CreateDesktopA Creates a new desktop, associates it with the current window


station of the calling process, and assigns it to the calling
thread.

CreateDesktopExA Creates a new desktop with the specified heap, associates it


with the current window station of the calling process, and
assigns it to the calling thread.

CreateDesktopExW Creates a new desktop with the specified heap, associates it


with the current window station of the calling process, and
assigns it to the calling thread.

CreateDesktopW Creates a new desktop, associates it with the current window


station of the calling process, and assigns it to the calling
thread.

CreateDialogA Creates a modeless dialog box from a dialog box template


resource. The CreateDialog macro uses the
CreateDialogParam function.

CreateDialogIndirectA Creates a modeless dialog box from a dialog box template in


memory. The CreateDialogIndirect macro uses the
CreateDialogIndirectParam function.

CreateDialogIndirectParamA Creates a modeless dialog box from a dialog box template in


memory.

CreateDialogIndirectParamW Creates a modeless dialog box from a dialog box template in


memory.

CreateDialogIndirectW Creates a modeless dialog box from a dialog box template in


memory. The CreateDialogIndirect macro uses the
CreateDialogIndirectParam function.

CreateDialogParamA Creates a modeless dialog box from a dialog box template


resource.

CreateDialogParamW Creates a modeless dialog box from a dialog box template


resource.
T IT L E DESC RIP T IO N

CreateDialogW Creates a modeless dialog box from a dialog box template


resource. The CreateDialog macro uses the
CreateDialogParam function.

CreateIcon Creates an icon that has the specified size, colors, and bit
patterns.

CreateIconFromResource Creates an icon or cursor from resource bits describing the


icon.

CreateIconFromResourceEx Creates an icon or cursor from resource bits describing the


icon.

CreateIconIndirect Creates an icon or cursor from an ICONINFO structure.

CreateMDIWindowA Creates a multiple-document interface (MDI) child window.

CreateMDIWindowW Creates a multiple-document interface (MDI) child window.

CreateMenu Creates a menu. The menu is initially empty, but it can be


filled with menu items by using the InsertMenuItem,
AppendMenu, and InsertMenu functions.

CreatePopupMenu Creates a drop-down menu, submenu, or shortcut menu.

CreateSyntheticPointerDevice Configures the pointer injection device for the calling


application, and initializes the maximum number of
simultaneous pointers that the app can inject.

CreateWindowA Creates an overlapped, pop-up, or child window.

CreateWindowExA Creates an overlapped, pop-up, or child window with an


extended window style; otherwise, this function is identical
to the CreateWindow function.

CreateWindowExW Creates an overlapped, pop-up, or child window with an


extended window style; otherwise, this function is identical
to the CreateWindow function.

CreateWindowStationA Creates a window station object, associates it with the calling


process, and assigns it to the current session.

CreateWindowStationW Creates a window station object, associates it with the calling


process, and assigns it to the current session.

CreateWindowW Creates an overlapped, pop-up, or child window.

DefDlgProcW Calls the default dialog box window procedure to provide


default processing for any window messages that a dialog
box with a private window class does not process.

DeferWindowPos Updates the specified multiple-window � position structure


for the specified window.
T IT L E DESC RIP T IO N

DefFrameProcA Provides default processing for any window messages that


the window procedure of a multiple-document interface
(MDI) frame window does not process.

DefFrameProcW Provides default processing for any window messages that


the window procedure of a multiple-document interface
(MDI) frame window does not process.

DefMDIChildProcA Provides default processing for any window message that


the window procedure of a multiple-document interface
(MDI) child window does not process.

DefMDIChildProcW Provides default processing for any window message that


the window procedure of a multiple-document interface
(MDI) child window does not process.

DefRawInputProc Verifies that the size of the RAWINPUTHEADER structure is


correct.

DefWindowProcA Calls the default window procedure to provide default


processing for any window messages that an application
does not process.

DefWindowProcW Calls the default window procedure to provide default


processing for any window messages that an application
does not process.

DeleteMenu Deletes an item from the specified menu. If the menu item
opens a menu or submenu, this function destroys the
handle to the menu or submenu and frees the memory used
by the menu or submenu.

DeregisterShellHookWindow Unregisters a specified Shell window that is registered to


receive Shell hook messages.

DestroyAcceleratorTable Destroys an accelerator table.

DestroyCaret Destroys the caret's current shape, frees the caret from the
window, and removes the caret from the screen.

DestroyCursor Destroys a cursor and frees any memory the cursor


occupied. Do not use this function to destroy a shared
cursor.

DestroyIcon Destroys an icon and frees any memory the icon occupied.

DestroyMenu Destroys the specified menu and frees any memory that the
menu occupies.

DestroySyntheticPointerDevice Destroys the specified pointer injection device.

DestroyWindow Destroys the specified window.


T IT L E DESC RIP T IO N

DialogBoxA Creates a modal dialog box from a dialog box template


resource. DialogBox does not return control until the
specified callback function terminates the modal dialog box
by calling the EndDialog function.

DialogBoxIndirectA Creates a modal dialog box from a dialog box template in


memory. DialogBoxIndirect does not return control until the
specified callback function terminates the modal dialog box
by calling the EndDialog function.

DialogBoxIndirectParamA Creates a modal dialog box from a dialog box template in


memory.

DialogBoxIndirectParamW Creates a modal dialog box from a dialog box template in


memory.

DialogBoxIndirectW Creates a modal dialog box from a dialog box template in


memory. DialogBoxIndirect does not return control until the
specified callback function terminates the modal dialog box
by calling the EndDialog function.

DialogBoxParamA Creates a modal dialog box from a dialog box template


resource.

DialogBoxParamW Creates a modal dialog box from a dialog box template


resource.

DialogBoxW Creates a modal dialog box from a dialog box template


resource. DialogBox does not return control until the
specified callback function terminates the modal dialog box
by calling the EndDialog function.

DisableProcessWindowsGhosting Disables the window ghosting feature for the calling GUI
process. Window ghosting is a Windows Manager feature
that lets the user minimize, move, or close the main window
of an application that is not responding.

DispatchMessage Dispatches a message to a window procedure. It is typically


used to dispatch a message retrieved by the GetMessage
function.

DispatchMessageA Dispatches a message to a window procedure. It is typically


used to dispatch a message retrieved by the GetMessage
function.

DispatchMessageW Dispatches a message to a window procedure. It is typically


used to dispatch a message retrieved by the GetMessage
function.

DisplayConfigGetDeviceInfo The DisplayConfigGetDeviceInfo function retrieves display


configuration information about the device.

DisplayConfigSetDeviceInfo The DisplayConfigSetDeviceInfo function sets the properties


of a target.
T IT L E DESC RIP T IO N

DlgDirListA Replaces the contents of a list box with the names of the
subdirectories and files in a specified directory. You can filter
the list of names by specifying a set of file attributes. The list
can optionally include mapped drives.

DlgDirListComboBoxA Replaces the contents of a combo box with the names of the
subdirectories and files in a specified directory. You can filter
the list of names by specifying a set of file attributes. The list
of names can include mapped drive letters.

DlgDirListComboBoxW Replaces the contents of a combo box with the names of the
subdirectories and files in a specified directory. You can filter
the list of names by specifying a set of file attributes. The list
of names can include mapped drive letters.

DlgDirListW Replaces the contents of a list box with the names of the
subdirectories and files in a specified directory. You can filter
the list of names by specifying a set of file attributes. The list
can optionally include mapped drives.

DlgDirSelectComboBoxExA Retrieves the current selection from a combo box filled by


using the DlgDirListComboBox function. The selection is
interpreted as a drive letter, a file, or a directory name.

DlgDirSelectComboBoxExW Retrieves the current selection from a combo box filled by


using the DlgDirListComboBox function. The selection is
interpreted as a drive letter, a file, or a directory name.

DlgDirSelectExA Retrieves the current selection from a single-selection list


box. It assumes that the list box has been filled by the
DlgDirList function and that the selection is a drive letter,
filename, or directory name.

DlgDirSelectExW Retrieves the current selection from a single-selection list


box. It assumes that the list box has been filled by the
DlgDirList function and that the selection is a drive letter,
filename, or directory name.

DragDetect Captures the mouse and tracks its movement until the user
releases the left button, presses the ESC key, or moves the
mouse outside the drag rectangle around the specified
point.

DrawAnimatedRects Animates the caption of a window to indicate the opening of


an icon or the minimizing or maximizing of a window.

DrawCaption The DrawCaption function draws a window caption.

DrawEdge The DrawEdge function draws one or more edges of


rectangle.

DrawFocusRect The DrawFocusRect function draws a rectangle in the style


used to indicate that the rectangle has the focus.
T IT L E DESC RIP T IO N

DrawFrameControl The DrawFrameControl function draws a frame control of


the specified type and style.

DrawIcon Draws an icon or cursor into the specified device context.

DrawIconEx Draws an icon or cursor into the specified device context,


performing the specified raster operations, and stretching or
compressing the icon or cursor as specified.

DrawMenuBar Redraws the menu bar of the specified window. If the menu
bar changes after the system has created the window, this
function must be called to draw the changed menu bar.

DrawStateA The DrawState function displays an image and applies a


visual effect to indicate a state, such as a disabled or default
state.

DrawStateW The DrawState function displays an image and applies a


visual effect to indicate a state, such as a disabled or default
state.

DrawText The DrawText function draws formatted text in the specified


rectangle. It formats the text according to the specified
method (expanding tabs, justifying characters, breaking lines,
and so forth).

DrawTextA The DrawText function draws formatted text in the specified


rectangle. It formats the text according to the specified
method (expanding tabs, justifying characters, breaking lines,
and so forth).

DrawTextExA The DrawTextEx function draws formatted text in the


specified rectangle.

DrawTextExW The DrawTextEx function draws formatted text in the


specified rectangle.

DrawTextW The DrawText function draws formatted text in the specified


rectangle. It formats the text according to the specified
method (expanding tabs, justifying characters, breaking lines,
and so forth).

EmptyClipboard Empties the clipboard and frees handles to data in the


clipboard. The function then assigns ownership of the
clipboard to the window that currently has the clipboard
open.

EnableMenuItem Enables, disables, or grays the specified menu item.

EnableMouseInPointer Enables the mouse to act as a pointer input device and send
WM_POINTER messages.

EnableNonClientDpiScaling In high-DPI displays, enables automatic display scaling of the


non-client area portions of the specified top-level window.
Must be called during the initialization of that window.
T IT L E DESC RIP T IO N

EnableScrollBar The EnableScrollBar function enables or disables one or both


scroll bar arrows.

EnableWindow Enables or disables mouse and keyboard input to the


specified window or control. When input is disabled, the
window does not receive input such as mouse clicks and key
presses. When input is enabled, the window receives all
input.

EndDeferWindowPos Simultaneously updates the position and size of one or more


windows in a single screen-refreshing cycle.

EndDialog Destroys a modal dialog box, causing the system to end any
processing for the dialog box.

EndMenu Ends the calling thread's active menu.

EndPaint The EndPaint function marks the end of painting in the


specified window. This function is required for each call to the
BeginPaint function, but only after painting is complete.

EndTask Forcibly closes the specified window.

EnumChildWindows Enumerates the child windows that belong to the specified


parent window by passing the handle to each child window,
in turn, to an application-defined callback function.

EnumClipboardFormats Enumerates the data formats currently available on the


clipboard.

EnumDesktopsA Enumerates all desktops associated with the specified


window station of the calling process. The function passes
the name of each desktop, in turn, to an application-defined
callback function.

EnumDesktopsW Enumerates all desktops associated with the specified


window station of the calling process. The function passes
the name of each desktop, in turn, to an application-defined
callback function.

EnumDesktopWindows Enumerates all top-level windows associated with the


specified desktop. It passes the handle to each window, in
turn, to an application-defined callback function.

EnumDisplayDevicesA The EnumDisplayDevices function lets you obtain


information about the display devices in the current session.

EnumDisplayDevicesW The EnumDisplayDevices function lets you obtain


information about the display devices in the current session.
T IT L E DESC RIP T IO N

EnumDisplayMonitors The EnumDisplayMonitors function enumerates display


monitors (including invisible pseudo-monitors associated
with the mirroring drivers) that intersect a region formed by
the intersection of a specified clipping rectangle and the
visible region of a device context. EnumDisplayMonitors calls
an application-defined MonitorEnumProc callback function
once for each monitor that is enumerated. Note that
GetSystemMetrics (SM_CMONITORS) counts only the
display monitors.

EnumDisplaySettingsA The EnumDisplaySettings function retrieves information


about one of the graphics modes for a display device. To
retrieve information for all the graphics modes of a display
device, make a series of calls to this function.

EnumDisplaySettingsExA The EnumDisplaySettingsEx function retrieves information


about one of the graphics modes for a display device. To
retrieve information for all the graphics modes for a display
device, make a series of calls to this function.

EnumDisplaySettingsExW The EnumDisplaySettingsEx function retrieves information


about one of the graphics modes for a display device. To
retrieve information for all the graphics modes for a display
device, make a series of calls to this function.

EnumDisplaySettingsW The EnumDisplaySettings function retrieves information


about one of the graphics modes for a display device. To
retrieve information for all the graphics modes of a display
device, make a series of calls to this function.

EnumPropsA Enumerates all entries in the property list of a window by


passing them, one by one, to the specified callback function.
EnumProps continues until the last entry is enumerated or
the callback function returns FALSE.

EnumPropsExA Enumerates all entries in the property list of a window by


passing them, one by one, to the specified callback function.
EnumPropsEx continues until the last entry is enumerated or
the callback function returns FALSE.

EnumPropsExW Enumerates all entries in the property list of a window by


passing them, one by one, to the specified callback function.
EnumPropsEx continues until the last entry is enumerated or
the callback function returns FALSE.

EnumPropsW Enumerates all entries in the property list of a window by


passing them, one by one, to the specified callback function.
EnumProps continues until the last entry is enumerated or
the callback function returns FALSE.

EnumThreadWindows Enumerates all nonchild windows associated with a thread


by passing the handle to each window, in turn, to an
application-defined callback function.
T IT L E DESC RIP T IO N

EnumWindows Enumerates all top-level windows on the screen by passing


the handle to each window, in turn, to an application-defined
callback function. EnumWindows continues until the last
top-level window is enumerated or the callback function
returns FALSE.

EnumWindowStationsA Enumerates all window stations in the current session. The


function passes the name of each window station, in turn, to
an application-defined callback function.

EnumWindowStationsW Enumerates all window stations in the current session. The


function passes the name of each window station, in turn, to
an application-defined callback function.

EqualRect The EqualRect function determines whether the two specified


rectangles are equal by comparing the coordinates of their
upper-left and lower-right corners.

EvaluateProximityToPolygon Returns the score of a polygon as the probable touch target


(compared to all other polygons that intersect the touch
contact area) and an adjusted touch point within the
polygon.

EvaluateProximityToRect Returns the score of a rectangle as the probable touch


target, compared to all other rectangles that intersect the
touch contact area, and an adjusted touch point within the
rectangle.

ExcludeUpdateRgn The ExcludeUpdateRgn function prevents drawing within


invalid areas of a window by excluding an updated region in
the window from a clipping region.

ExitWindows Calls the ExitWindowsEx function to log off the interactive


user.

ExitWindowsEx Logs off the interactive user, shuts down the system, or
shuts down and restarts the system.

FillRect The FillRect function fills a rectangle by using the specified


brush. This function includes the left and top borders, but
excludes the right and bottom borders of the rectangle.

FindWindowA Retrieves a handle to the top-level window whose class


name and window name match the specified strings. This
function does not search child windows. This function does
not perform a case-sensitive search.

FindWindowExA Retrieves a handle to a window whose class name and


window name match the specified strings. The function
searches child windows, beginning with the one following
the specified child window. This function does not perform a
case-sensitive search.
T IT L E DESC RIP T IO N

FindWindowExW Retrieves a handle to a window whose class name and


window name match the specified strings. The function
searches child windows, beginning with the one following
the specified child window. This function does not perform a
case-sensitive search.

FindWindowW Retrieves a handle to the top-level window whose class


name and window name match the specified strings. This
function does not search child windows. This function does
not perform a case-sensitive search.

FlashWindow Flashes the specified window one time. It does not change
the active state of the window.

FlashWindowEx Flashes the specified window. It does not change the active
state of the window.

FrameRect The FrameRect function draws a border around the specified


rectangle by using the specified brush. The width and height
of the border are always one logical unit.

GET_APPCOMMAND_LPARAM Retrieves the application command from the specified


LPARAM value.

GET_DEVICE_LPARAM Retrieves the input device type from the specified LPARAM
value.

GET_FLAGS_LPARAM Retrieves the state of certain virtual keys from the specified
LPARAM value.

GET_KEYSTATE_LPARAM Retrieves the state of certain virtual keys from the specified
LPARAM value.

GET_KEYSTATE_WPARAM Retrieves the state of certain virtual keys from the specified
WPARAM value.

GET_NCHITTEST_WPARAM Retrieves the hit-test value from the specified WPARAM


value.

GET_POINTERID_WPARAM Retrieves the pointer ID using the specified value.

GET_RAWINPUT_CODE_WPARAM Retrieves the input code from wParam in WM_INPUT.

GET_WHEEL_DELTA_WPARAM Retrieves the wheel-delta value from the specified WPARAM


value.

GET_XBUTTON_WPARAM Retrieves the state of certain buttons from the specified


WPARAM value.

GetActiveWindow Retrieves the window handle to the active window attached


to the calling thread's message queue.

GetAltTabInfoA Retrieves status information for the specified window if it is


the application-switching (ALT+TAB) window.
T IT L E DESC RIP T IO N

GetAltTabInfoW Retrieves status information for the specified window if it is


the application-switching (ALT+TAB) window.

GetAncestor Retrieves the handle to the ancestor of the specified window.

GetAsyncKeyState Determines whether a key is up or down at the time the


function is called, and whether the key was pressed after a
previous call to GetAsyncKeyState.

GetAutoRotationState Retrieves an AR_STATE value containing the state of screen


auto-rotation for the system, for example whether auto-
rotation is supported, and whether it is enabled by the user.

GetAwarenessFromDpiAwarenessContext Retrieves the DPI_AWARENESS value from a


DPI_AWARENESS_CONTEXT.

GetCapture Retrieves a handle to the window (if any) that has captured
the mouse. Only one window at a time can capture the
mouse; this window receives mouse input whether or not
the cursor is within its borders.

GetCaretBlinkTime Retrieves the time required to invert the caret's pixels. The
user can set this value.

GetCaretPos Copies the caret's position to the specified POINT structure.

GetCIMSSM Retrieves the source of the input message


(GetCurrentInputMessageSourceInSendMessage).

GetClassInfoA Retrieves information about a window class.

GetClassInfoExA Retrieves information about a window class, including a


handle to the small icon associated with the window class.
The GetClassInfo function does not retrieve a handle to the
small icon.

GetClassInfoExW Retrieves information about a window class, including a


handle to the small icon associated with the window class.
The GetClassInfo function does not retrieve a handle to the
small icon.

GetClassInfoW Retrieves information about a window class.

GetClassLongA Retrieves the specified 32-bit (DWORD) value from the


WNDCLASSEX structure associated with the specified
window.

GetClassLongPtrA Retrieves the specified value from the WNDCLASSEX


structure associated with the specified window.

GetClassLongPtrW Retrieves the specified value from the WNDCLASSEX


structure associated with the specified window.
T IT L E DESC RIP T IO N

GetClassLongW Retrieves the specified 32-bit (DWORD) value from the


WNDCLASSEX structure associated with the specified
window.

GetClassName Retrieves the name of the class to which the specified


window belongs.

GetClassNameA Retrieves the name of the class to which the specified


window belongs.

GetClassNameW Retrieves the name of the class to which the specified


window belongs.

GetClassWord Retrieves the 16-bit (WORD) value at the specified offset into
the extra class memory for the window class to which the
specified window belongs.

GetClientRect Retrieves the coordinates of a window's client area.

GetClipboardData Retrieves data from the clipboard in a specified format. The


clipboard must have been opened previously.

GetClipboardFormatNameA Retrieves from the clipboard the name of the specified


registered format. The function copies the name to the
specified buffer.

GetClipboardFormatNameW Retrieves from the clipboard the name of the specified


registered format. The function copies the name to the
specified buffer.

GetClipboardOwner Retrieves the window handle of the current owner of the


clipboard.

GetClipboardSequenceNumber Retrieves the clipboard sequence number for the current


window station.

GetClipboardViewer Retrieves the handle to the first window in the clipboard


viewer chain.

GetClipCursor Retrieves the screen coordinates of the rectangular area to


which the cursor is confined.

GetComboBoxInfo Retrieves information about the specified combo box.

GetCurrentInputMessageSource Retrieves the source of the input message.

GetCursor Retrieves a handle to the current cursor.

GetCursorInfo Retrieves information about the global cursor.

GetCursorPos Retrieves the position of the mouse cursor, in screen


coordinates.
T IT L E DESC RIP T IO N

GetDC The GetDC function retrieves a handle to a device context


(DC) for the client area of a specified window or for the
entire screen.

GetDCEx The GetDCEx function retrieves a handle to a device context


(DC) for the client area of a specified window or for the
entire screen.

GetDesktopWindow Retrieves a handle to the desktop window. The desktop


window covers the entire screen. The desktop window is the
area on top of which other windows are painted.

GetDialogBaseUnits Retrieves the system's dialog base units, which are the
average width and height of characters in the system font.

GetDialogControlDpiChangeBehavior Retrieves and per-monitor DPI scaling behavior overrides of


a child window in a dialog.

GetDialogDpiChangeBehavior Returns the flags that might have been set on a given dialog
by an earlier call to SetDialogDpiChangeBehavior.

GetDisplayAutoRotationPreferences Retrieves the screen auto-rotation preferences for the


current process.

GetDisplayAutoRotationPreferencesByProcessId Retrieves the screen auto-rotation preferences for the


process indicated by the dwProcessId parameter.

GetDisplayConfigBufferSizes The GetDisplayConfigBufferSizes function retrieves the size


of the buffers that are required to call the
QueryDisplayConfig function.

GetDlgCtrlID Retrieves the identifier of the specified control.

GetDlgItem Retrieves a handle to a control in the specified dialog box.

GetDlgItemInt Translates the text of a specified control in a dialog box into


an integer value.

GetDlgItemTextA Retrieves the title or text associated with a control in a dialog


box.

GetDlgItemTextW Retrieves the title or text associated with a control in a dialog


box.

GetDoubleClickTime Retrieves the current double-click time for the mouse.

GetDpiForSystem Returns the system DPI.

GetDpiForWindow Returns the dots per inch (dpi) value for the associated
window.
T IT L E DESC RIP T IO N

GetDpiFromDpiAwarenessContext Retrieves the DPI from a given DPI_AWARENESS_CONTEXT


handle. This enables you to determine the DPI of a thread
without needed to examine a window created within that
thread.

GetFocus Retrieves the handle to the window that has the keyboard
focus, if the window is attached to the calling thread's
message queue.

GetForegroundWindow Retrieves a handle to the foreground window (the window


with which the user is currently working). The system assigns
a slightly higher priority to the thread that creates the
foreground window than it does to other threads.

GetGestureConfig Retrieves the configuration for which Windows Touch gesture


messages are sent from a window.

GetGestureExtraArgs Retrieves additional information about a gesture from its


GESTUREINFO handle.

GetGestureInfo Retrieves a GESTUREINFO structure given a handle to the


gesture information.

GetGuiResources Retrieves the count of handles to graphical user interface


(GUI) objects in use by the specified process.

GetGUIThreadInfo Retrieves information about the active window or a specified


GUI thread.

GetIconInfo Retrieves information about the specified icon or cursor.

GetIconInfoExA Retrieves information about the specified icon or cursor.


GetIconInfoEx extends GetIconInfo by using the newer
ICONINFOEX structure.

GetIconInfoExW Retrieves information about the specified icon or cursor.


GetIconInfoEx extends GetIconInfo by using the newer
ICONINFOEX structure.

GetInputState Determines whether there are mouse-button or keyboard


messages in the calling thread's message queue.

GetKBCodePage Retrieves the current code page.

GetKeyboardLayout Retrieves the active input locale identifier (formerly called the
keyboard layout).

GetKeyboardLayoutList Retrieves the input locale identifiers (formerly called


keyboard layout handles) corresponding to the current set
of input locales in the system. The function copies the
identifiers to the specified buffer.

GetKeyboardLayoutNameA Retrieves the name of the active input locale identifier


(formerly called the keyboard layout) for the system.
T IT L E DESC RIP T IO N

GetKeyboardLayoutNameW Retrieves the name of the active input locale identifier


(formerly called the keyboard layout) for the system.

GetKeyboardState Copies the status of the 256 virtual keys to the specified
buffer.

GetKeyboardType Retrieves information about the current keyboard.

GetKeyNameTextA Retrieves a string that represents the name of a key.

GetKeyNameTextW Retrieves a string that represents the name of a key.

GetKeyState Retrieves the status of the specified virtual key. The status
specifies whether the key is up, down, or toggled (on,
off�alternating each time the key is pressed).

GetLastActivePopup Determines which pop-up window owned by the specified


window was most recently active.

GetLastInputInfo Retrieves the time of the last input event.

GetLayeredWindowAttributes Retrieves the opacity and transparency color key of a layered


window.

GetListBoxInfo Retrieves the number of items per column in a specified list


box.

GetMenu Retrieves a handle to the menu assigned to the specified


window.

GetMenuBarInfo Retrieves information about the specified menu bar.

GetMenuCheckMarkDimensions Retrieves the dimensions of the default check-mark bitmap.

GetMenuContextHelpId Retrieves the Help context identifier associated with the


specified menu.

GetMenuDefaultItem Determines the default menu item on the specified menu.

GetMenuInfo Retrieves information about a specified menu.

GetMenuItemCount Determines the number of items in the specified menu.

GetMenuItemID Retrieves the menu item identifier of a menu item located at


the specified position in a menu.

GetMenuItemInfoA Retrieves information about a menu item.

GetMenuItemInfoW Retrieves information about a menu item.

GetMenuItemRect Retrieves the bounding rectangle for the specified menu


item.
T IT L E DESC RIP T IO N

GetMenuState Retrieves the menu flags associated with the specified menu
item.

GetMenuStringA Copies the text string of the specified menu item into the
specified buffer.

GetMenuStringW Copies the text string of the specified menu item into the
specified buffer.

GetMessage Retrieves a message from the calling thread's message


queue. The function dispatches incoming sent messages
until a posted message is available for retrieval.

GetMessageA Retrieves a message from the calling thread's message


queue. The function dispatches incoming sent messages
until a posted message is available for retrieval.

GetMessageExtraInfo Retrieves the extra message information for the current


thread. Extra message information is an application- or
driver-defined value associated with the current thread's
message queue.

GetMessagePos Retrieves the cursor position for the last message retrieved
by the GetMessage function.

GetMessageTime Retrieves the message time for the last message retrieved by
the GetMessage function.

GetMessageW Retrieves a message from the calling thread's message


queue. The function dispatches incoming sent messages
until a posted message is available for retrieval.

GetMonitorInfoA The GetMonitorInfo function retrieves information about a


display monitor.

GetMonitorInfoW The GetMonitorInfo function retrieves information about a


display monitor.

GetMouseMovePointsEx Retrieves a history of up to 64 previous coordinates of the


mouse or pen.

GetNextDlgGroupItem Retrieves a handle to the first control in a group of controls


that precedes (or follows) the specified control in a dialog
box.

GetNextDlgTabItem Retrieves a handle to the first control that has the


WS_TABSTOP style that precedes (or follows) the specified
control.

GetNextWindow Retrieves a handle to the next or previous window in the Z-


Order. The next window is below the specified window; the
previous window is above.

GetOpenClipboardWindow Retrieves the handle to the window that currently has the
clipboard open.
T IT L E DESC RIP T IO N

GetParent Retrieves a handle to the specified window's parent or owner.

GetPhysicalCursorPos Retrieves the position of the cursor in physical coordinates.

GetPointerCursorId Retrieves the cursor identifier associated with the specified


pointer.

GetPointerDevice Gets information about the pointer device.

GetPointerDeviceCursors Gets the cursor IDs that are mapped to the cursors
associated with a pointer device.

GetPointerDeviceProperties Gets device properties that aren't included in the


POINTER_DEVICE_INFO structure.

GetPointerDeviceRects Gets the x and y range for the pointer device (in himetric)
and the x and y range (current resolution) for the display
that the pointer device is mapped to.

GetPointerDevices Gets information about the pointer devices attached to the


system.

GetPointerFrameInfo Gets the entire frame of information for the specified


pointers associated with the current message.

GetPointerFrameInfoHistory Gets the entire frame of information (including coalesced


input frames) for the specified pointers associated with the
current message.

GetPointerFramePenInfo Gets the entire frame of pen-based information for the


specified pointers (of type PT_PEN) associated with the
current message.

GetPointerFramePenInfoHistory Gets the entire frame of pen-based information (including


coalesced input frames) for the specified pointers (of type
PT_PEN) associated with the current message.

GetPointerFrameTouchInfo Gets the entire frame of touch-based information for the


specified pointers (of type PT_TOUCH) associated with the
current message.

GetPointerFrameTouchInfoHistory Gets the entire frame of touch-based information (including


coalesced input frames) for the specified pointers (of type
PT_TOUCH) associated with the current message.

GetPointerInfo Gets the information for the specified pointer associated


with the current message.

GetPointerInfoHistory Gets the information associated with the individual inputs, if


any, that were coalesced into the current message for the
specified pointer.
T IT L E DESC RIP T IO N

GetPointerInputTransform Gets one or more transforms for the pointer information


coordinates associated with the current message.

GetPointerPenInfo Gets the pen-based information for the specified pointer (of
type PT_PEN) associated with the current message.

GetPointerPenInfoHistory Gets the pen-based information associated with the


individual inputs, if any, that were coalesced into the current
message for the specified pointer (of type PT_PEN).

GetPointerTouchInfo Gets the touch-based information for the specified pointer


(of type PT_TOUCH) associated with the current message.

GetPointerTouchInfoHistory Gets the touch-based information associated with the


individual inputs, if any, that were coalesced into the current
message for the specified pointer (of type PT_TOUCH).

GetPointerType Retrieves the pointer type for a specified pointer.

GetPriorityClipboardFormat Retrieves the first available clipboard format in the specified


list.

GetProcessDefaultLayout Retrieves the default layout that is used when windows are
created with no parent or owner.

GetProcessWindowStation Retrieves a handle to the current window station for the


calling process.

GetPropA Retrieves a data handle from the property list of the


specified window. The character string identifies the handle
to be retrieved. The string and handle must have been
added to the property list by a previous call to the SetProp
function.

GetPropW Retrieves a data handle from the property list of the


specified window. The character string identifies the handle
to be retrieved. The string and handle must have been
added to the property list by a previous call to the SetProp
function.

GetQueueStatus Retrieves the type of messages found in the calling thread's


message queue.

GetRawInputBuffer Performs a buffered read of the raw input data.

GetRawInputData Retrieves the raw input from the specified device.

GetRawInputDeviceInfoA Retrieves information about the raw input device.

GetRawInputDeviceInfoW Retrieves information about the raw input device.

GetRawInputDeviceList Enumerates the raw input devices attached to the system.

GetRawPointerDeviceData Gets the raw input data from the pointer device.
T IT L E DESC RIP T IO N

GetRegisteredRawInputDevices Retrieves the information about the raw input devices for the
current application.

GetScrollBarInfo The GetScrollBarInfo function retrieves information about


the specified scroll bar.

GetScrollInfo The GetScrollInfo function retrieves the parameters of a


scroll bar, including the minimum and maximum scrolling
positions, the page size, and the position of the scroll box
(thumb).

GetScrollPos The GetScrollPos function retrieves the current position of


the scroll box (thumb) in the specified scroll bar.

GetScrollRange The GetScrollRange function retrieves the current minimum


and maximum scroll box (thumb) positions for the specified
scroll bar.

GetShellWindow Retrieves a handle to the Shell's desktop window.

GetSubMenu Retrieves a handle to the drop-down menu or submenu


activated by the specified menu item.

GetSysColor Retrieves the current color of the specified display element.

GetSysColorBrush The GetSysColorBrush function retrieves a handle identifying


a logical brush that corresponds to the specified color index.

GetSystemDpiForProcess Retrieves the system DPI associated with a given process.


This is useful for avoiding compatibility issues that arise from
sharing DPI-sensitive information between multiple system-
aware processes with different system DPI values.

GetSystemMenu Enables the application to access the window menu (also


known as the system menu or the control menu) for copying
and modifying.

GetSystemMetrics Retrieves the specified system metric or system configuration


setting.

GetSystemMetricsForDpi Retrieves the specified system metric or system configuration


setting taking into account a provided DPI.

GetTabbedTextExtentA The GetTabbedTextExtent function computes the width and


height of a character string.

GetTabbedTextExtentW The GetTabbedTextExtent function computes the width and


height of a character string.

GetThreadDesktop Retrieves a handle to the desktop assigned to the specified


thread.

GetThreadDpiAwarenessContext Gets the DPI_AWARENESS_CONTEXT for the current thread.


T IT L E DESC RIP T IO N

GetThreadDpiHostingBehavior Retrieves the DPI_HOSTING_BEHAVIOR from the current


thread.

GetTitleBarInfo Retrieves information about the specified title bar.

GetTopWindow Examines the Z order of the child windows associated with


the specified parent window and retrieves a handle to the
child window at the top of the Z order.

GetTouchInputInfo Retrieves detailed information about touch inputs associated


with a particular touch input handle.

GetUnpredictedMessagePos Gets pointer data before it has gone through touch


prediction processing.

GetUpdatedClipboardFormats Retrieves the currently supported clipboard formats.

GetUpdateRect The GetUpdateRect function retrieves the coordinates of the


smallest rectangle that completely encloses the update
region of the specified window.

GetUpdateRgn The GetUpdateRgn function retrieves the update region of a


window by copying it into the specified region. The
coordinates of the update region are relative to the upper-
left corner of the window (that is, they are client
coordinates).

GetUserObjectInformationA Retrieves information about the specified window station or


desktop object.

GetUserObjectInformationW Retrieves information about the specified window station or


desktop object.

GetUserObjectSecurity Retrieves security information for the specified user object.

GetWindow Retrieves a handle to a window that has the specified


relationship (Z-Order or owner) to the specified window.

GetWindowContextHelpId Retrieves the Help context identifier, if any, associated with


the specified window.

GetWindowDC The GetWindowDC function retrieves the device context


(DC) for the entire window, including title bar, menus, and
scroll bars.

GetWindowDisplayAffinity Retrieves the current display affinity setting, from any


process, for a given window.

GetWindowDpiAwarenessContext Returns the DPI_AWARENESS_CONTEXT associated with a


window.

GetWindowDpiHostingBehavior Returns the DPI_HOSTING_BEHAVIOR of the specified


window.
T IT L E DESC RIP T IO N

GetWindowFeedbackSetting Retrieves the feedback configuration for a window.

GetWindowInfo Retrieves information about the specified window.

GetWindowLongA Retrieves information about the specified window.

GetWindowLongPtrA Retrieves information about the specified window. The


function also retrieves the value at a specified offset into the
extra window memory.

GetWindowLongPtrW Retrieves information about the specified window. The


function also retrieves the value at a specified offset into the
extra window memory.

GetWindowLongW Retrieves information about the specified window.

GetWindowModuleFileNameA Retrieves the full path and file name of the module
associated with the specified window handle.

GetWindowModuleFileNameW Retrieves the full path and file name of the module
associated with the specified window handle.

GetWindowPlacement Retrieves the show state and the restored, minimized, and
maximized positions of the specified window.

GetWindowRect Retrieves the dimensions of the bounding rectangle of the


specified window. The dimensions are given in screen
coordinates that are relative to the upper-left corner of the
screen.

GetWindowRgn The GetWindowRgn function obtains a copy of the window


region of a window.

GetWindowRgnBox The GetWindowRgnBox function retrieves the dimensions of


the tightest bounding rectangle for the window region of a
window.

GetWindowTextA Copies the text of the specified window's title bar (if it has
one) into a buffer. If the specified window is a control, the
text of the control is copied. However, GetWindowText
cannot retrieve the text of a control in another application.

GetWindowTextLengthA Retrieves the length, in characters, of the specified window's


title bar text (if the window has a title bar).

GetWindowTextLengthW Retrieves the length, in characters, of the specified window's


title bar text (if the window has a title bar).

GetWindowTextW Copies the text of the specified window's title bar (if it has
one) into a buffer. If the specified window is a control, the
text of the control is copied. However, GetWindowText
cannot retrieve the text of a control in another application.
T IT L E DESC RIP T IO N

GetWindowThreadProcessId Retrieves the identifier of the thread that created the


specified window and, optionally, the identifier of the process
that created the window.

GID_ROTATE_ANGLE_FROM_ARGUMENT The GID_ROTATE_ANGLE_FROM_ARGUMENT macro is used


to interpret the GID_ROTATE ullArgument value when
receiving the value in the WM_GESTURE structure.

GID_ROTATE_ANGLE_TO_ARGUMENT Converts a radian value to an argument for rotation gesture


messages.

GrayStringA The GrayString function draws gray text at the specified


location.

GrayStringW The GrayString function draws gray text at the specified


location.

HAS_POINTER_CONFIDENCE_WPARAM Checks whether the specified pointer message is considered


intentional rather than accidental.

HideCaret Removes the caret from the screen. Hiding a caret does not
destroy its current shape or invalidate the insertion point.

HiliteMenuItem Adds or removes highlighting from an item in a menu bar.

InflateRect The InflateRect function increases or decreases the width and


height of the specified rectangle.

InitializeTouchInjection Configures the touch injection context for the calling


application and initializes the maximum number of
simultaneous contacts that the app can inject.

InjectSyntheticPointerInput Simulates pointer input (pen or touch).

InjectTouchInput Simulates touch input.

InSendMessage Determines whether the current window procedure is


processing a message that was sent from another thread (in
the same process or a different process) by a call to the
SendMessage function.

InSendMessageEx Determines whether the current window procedure is


processing a message that was sent from another thread (in
the same process or a different process).

InsertMenuA Inserts a new menu item into a menu, moving other items
down the menu.

InsertMenuItemA Inserts a new menu item at the specified position in a menu.

InsertMenuItemW Inserts a new menu item at the specified position in a menu.

InsertMenuW Inserts a new menu item into a menu, moving other items
down the menu.
T IT L E DESC RIP T IO N

InternalGetWindowText Copies the text of the specified window's title bar (if it has
one) into a buffer.

IntersectRect The IntersectRect function calculates the intersection of two


source rectangles and places the coordinates of the
intersection rectangle into the destination rectangle.

InvalidateRect The InvalidateRect function adds a rectangle to the specified


window's update region. The update region represents the
portion of the window's client area that must be redrawn.

InvalidateRgn The InvalidateRgn function invalidates the client area within


the specified region by adding it to the current update
region of a window.

InvertRect The InvertRect function inverts a rectangle in a window by


performing a logical NOT operation on the color values for
each pixel in the rectangle's interior.

IS_INTRESOURCE Determines whether a value is an integer identifier for a


resource.

IS_POINTER_CANCELED_WPARAM Checks whether the specified pointer input ended abruptly,


or was invalid, indicating the interaction was not completed.

IS_POINTER_FIFTHBUTTON_WPARAM Checks whether the specified pointer took fifth action.

IS_POINTER_FIRSTBUTTON_WPARAM Checks whether the specified pointer took first action.

IS_POINTER_FLAG_SET_WPARAM Checks whether a pointer macro sets the specified flag.

IS_POINTER_FOURTHBUTTON_WPARAM Checks whether the specified pointer took fourth action.

IS_POINTER_INCONTACT_WPARAM Checks whether the specified pointer is in contact.

IS_POINTER_INRANGE_WPARAM Checks whether the specified pointer is in range.

IS_POINTER_NEW_WPARAM Checks whether the specified pointer is a new pointer.

IS_POINTER_SECONDBUTTON_WPARAM Checks whether the specified pointer took second action.

IS_POINTER_THIRDBUTTON_WPARAM Checks whether the specified pointer took third action.

IsCharAlphaA Determines whether a character is an alphabetical character.


This determination is based on the semantics of the
language selected by the user during setup or through
Control Panel.

IsCharAlphaNumericA Determines whether a character is either an alphabetical or a


numeric character. This determination is based on the
semantics of the language selected by the user during setup
or through Control Panel.
T IT L E DESC RIP T IO N

IsCharAlphaNumericW Determines whether a character is either an alphabetical or a


numeric character. This determination is based on the
semantics of the language selected by the user during setup
or through Control Panel.

IsCharAlphaW Determines whether a character is an alphabetical character.


This determination is based on the semantics of the
language selected by the user during setup or through
Control Panel.

IsCharLowerA Determines whether a character is lowercase. This


determination is based on the semantics of the language
selected by the user during setup or through Control Panel.

IsCharLowerW

IsCharUpperA Determines whether a character is uppercase. This


determination is based on the semantics of the language
selected by the user during setup or through Control Panel.

IsCharUpperW Determines whether a character is uppercase. This


determination is based on the semantics of the language
selected by the user during setup or through Control Panel.

IsChild Determines whether a window is a child window or


descendant window of a specified parent window.

IsClipboardFormatAvailable Determines whether the clipboard contains data in the


specified format.

IsDialogMessageA Determines whether a message is intended for the specified


dialog box and, if it is, processes the message.

IsDialogMessageW Determines whether a message is intended for the specified


dialog box and, if it is, processes the message.

IsDlgButtonChecked The IsDlgButtonChecked function determines whether a


button control is checked or whether a three-state button
control is checked, unchecked, or indeterminate.

IsGUIThread Determines whether the calling thread is already a GUI


thread. It can also optionally convert the thread to a GUI
thread.

IsHungAppWindow Determines whether the system considers that a specified


application is not responding.

IsIconic Determines whether the specified window is minimized


(iconic).

IsImmersiveProcess Determines whether the process belongs to a Windows


Store app.

IsMenu Determines whether a handle is a menu handle.


T IT L E DESC RIP T IO N

IsMouseInPointerEnabled Indicates whether EnableMouseInPointer is set for the


mouse to act as a pointer input device and send
WM_POINTER messages.

IsProcessDPIAware IsProcessDPIAware may be altered or unavailable. Instead,


use GetProcessDPIAwareness.

IsRectEmpty The IsRectEmpty function determines whether the specified


rectangle is empty.

IsTouchWindow Checks whether a specified window is touch-capable and,


optionally, retrieves the modifier flags set for the window's
touch capability.

IsValidDpiAwarenessContext Determines if a specified DPI_AWARENESS_CONTEXT is valid


and supported by the current system.

IsWindow Determines whether the specified window handle identifies


an existing window.

IsWindowEnabled Determines whether the specified window is enabled for


mouse and keyboard input.

IsWindowUnicode Determines whether the specified window is a native


Unicode window.

IsWindowVisible Determines the visibility state of the specified window.

IsWinEventHookInstalled Determines whether there is an installed WinEvent hook that


might be notified of a specified event.

IsWow64Message Determines whether the last message read from the current
thread's queue originated from a WOW64 process.

IsZoomed Determines whether a window is maximized.

keybd_event Synthesizes a keystroke.

KillTimer Destroys the specified timer.

LoadAcceleratorsA Loads the specified accelerator table.

LoadAcceleratorsW Loads the specified accelerator table.

LoadBitmapA The LoadBitmap function loads the specified bitmap resource


from a module's executable file.

LoadBitmapW The LoadBitmap function loads the specified bitmap resource


from a module's executable file.

LoadCursorA Loads the specified cursor resource from the executable


(.EXE) file associated with an application instance.
T IT L E DESC RIP T IO N

LoadCursorFromFileA Creates a cursor based on data contained in a file.

LoadCursorFromFileW Creates a cursor based on data contained in a file.

LoadCursorW Loads the specified cursor resource from the executable


(.EXE) file associated with an application instance.

LoadIconA Loads the specified icon resource from the executable (.exe)
file associated with an application instance.

LoadIconW Loads the specified icon resource from the executable (.exe)
file associated with an application instance.

LoadImageA Loads an icon, cursor, animated cursor, or bitmap.

LoadImageW Loads an icon, cursor, animated cursor, or bitmap.

LoadKeyboardLayoutA Loads a new input locale identifier (formerly called the


keyboard layout) into the system.

LoadKeyboardLayoutW Loads a new input locale identifier (formerly called the


keyboard layout) into the system.

LoadMenuA Loads the specified menu resource from the executable (.exe)
file associated with an application instance.

LoadMenuIndirectA Loads the specified menu template in memory.

LoadMenuIndirectW Loads the specified menu template in memory.

LoadMenuW Loads the specified menu resource from the executable (.exe)
file associated with an application instance.

LoadStringA Loads a string resource from the executable file associated


with a specified module, copies the string into a buffer, and
appends a terminating null character.

LoadStringW Loads a string resource from the executable file associated


with a specified module, copies the string into a buffer, and
appends a terminating null character.

LockSetForegroundWindow The foreground process can call the


LockSetForegroundWindow function to disable calls to the
SetForegroundWindow function.

LockWindowUpdate The LockWindowUpdate function disables or enables


drawing in the specified window. Only one window can be
locked at a time.

LockWorkStation Locks the workstation's display.

LogicalToPhysicalPoint Converts the logical coordinates of a point in a window to


physical coordinates.
T IT L E DESC RIP T IO N

LogicalToPhysicalPointForPerMonitorDPI Converts a point in a window from logical coordinates into


physical coordinates, regardless of the dots per inch (dpi)
awareness of the caller.

LookupIconIdFromDirectory Searches through icon or cursor data for the icon or cursor
that best fits the current display device.

LookupIconIdFromDirectoryEx Searches through icon or cursor data for the icon or cursor
that best fits the current display device.

MAKEINTRESOURCEA Converts an integer value to a resource type compatible


with the resource-management functions. This macro is used
in place of a string containing the name of the resource.

MAKEINTRESOURCEW Converts an integer value to a resource type compatible


with the resource-management functions. This macro is used
in place of a string containing the name of the resource.

MAKELPARAM Creates a value for use as an lParam parameter in a


message. The macro concatenates the specified values.

MAKELRESULT Creates a value for use as a return value from a window


procedure. The macro concatenates the specified values.

MAKEWPARAM Creates a value for use as a wParam parameter in a message.


The macro concatenates the specified values.

MapDialogRect Converts the specified dialog box units to screen units


(pixels).

MapVirtualKeyA Translates (maps) a virtual-key code into a scan code or


character value, or translates a scan code into a virtual-key
code.

MapVirtualKeyExA Translates (maps) a virtual-key code into a scan code or


character value, or translates a scan code into a virtual-key
code. The function translates the codes using the input
language and an input locale identifier.

MapVirtualKeyExW Translates (maps) a virtual-key code into a scan code or


character value, or translates a scan code into a virtual-key
code. The function translates the codes using the input
language and an input locale identifier.

MapVirtualKeyW Translates (maps) a virtual-key code into a scan code or


character value, or translates a scan code into a virtual-key
code.

MapWindowPoints The MapWindowPoints function converts (maps) a set of


points from a coordinate space relative to one window to a
coordinate space relative to another window.

MenuItemFromPoint Determines which menu item, if any, is at the specified


location.
T IT L E DESC RIP T IO N

MessageBeep Plays a waveform sound. The waveform sound for each


sound type is identified by an entry in the registry.

MessageBox Displays a modal dialog box that contains a system icon, a


set of buttons, and a brief application-specific message, such
as status or error information. The message box returns an
integer value that indicates which button the user clicked.

MessageBoxA Displays a modal dialog box that contains a system icon, a


set of buttons, and a brief application-specific message, such
as status or error information. The message box returns an
integer value that indicates which button the user clicked.

MessageBoxExA Creates, displays, and operates a message box.

MessageBoxExW Creates, displays, and operates a message box.

MessageBoxIndirectA Creates, displays, and operates a message box. The message


box contains application-defined message text and title, any
icon, and any combination of predefined push buttons.

MessageBoxIndirectW Creates, displays, and operates a message box. The message


box contains application-defined message text and title, any
icon, and any combination of predefined push buttons.

MessageBoxW Displays a modal dialog box that contains a system icon, a


set of buttons, and a brief application-specific message, such
as status or error information. The message box returns an
integer value that indicates which button the user clicked.

ModifyMenuA Changes an existing menu item.

ModifyMenuW Changes an existing menu item.

MonitorFromPoint The MonitorFromPoint function retrieves a handle to the


display monitor that contains a specified point.

MonitorFromRect The MonitorFromRect function retrieves a handle to the


display monitor that has the largest area of intersection with
a specified rectangle.

MonitorFromWindow The MonitorFromWindow function retrieves a handle to the


display monitor that has the largest area of intersection with
the bounding rectangle of a specified window.

mouse_event The mouse_event function synthesizes mouse motion and


button clicks.

MoveWindow Changes the position and dimensions of the specified


window.

MsgWaitForMultipleObjects Waits until one or all of the specified objects are in the
signaled state or the time-out interval elapses. The objects
can include input event objects.
T IT L E DESC RIP T IO N

MsgWaitForMultipleObjectsEx Waits until one or all of the specified objects are in the
signaled state, an I/O completion routine or asynchronous
procedure call (APC) is queued to the thread, or the time-
out interval elapses. The array of objects can include input
event objects.

NEXTRAWINPUTBLOCK Retrieves the location of the next structure in an array of


RAWINPUT structures.

NotifyWinEvent Signals the system that a predefined event occurred. If any


client applications have registered a hook function for the
event, the system calls the client's hook function.

OemKeyScan Maps OEMASCII codes 0 through 0x0FF into the OEM scan
codes and shift states. The function provides information
that allows a program to send OEM text to another program
by simulating keyboard input.

OemToCharA Translates a string from the OEM-defined character set into


either an ANSI or a wide-character string.Warning Do not
use.

OemToCharBuffA Translates a specified number of characters in a string from


the OEM-defined character set into either an ANSI or a
wide-character string.

OemToCharBuffW Translates a specified number of characters in a string from


the OEM-defined character set into either an ANSI or a
wide-character string.

OemToCharW Translates a string from the OEM-defined character set into


either an ANSI or a wide-character string.Warning Do not
use.

OffsetRect The OffsetRect function moves the specified rectangle by the


specified offsets.

OpenClipboard Opens the clipboard for examination and prevents other


applications from modifying the clipboard content.

OpenDesktopA Opens the specified desktop object.

OpenDesktopW Opens the specified desktop object.

OpenIcon Restores a minimized (iconic) window to its previous size and


position; it then activates the window.

OpenInputDesktop Opens the desktop that receives user input.

OpenWindowStationA Opens the specified window station.

OpenWindowStationW Opens the specified window station.


T IT L E DESC RIP T IO N

PackTouchHitTestingProximityEvaluation Returns the proximity evaluation score and the adjusted


touch-point coordinates as a packed value for the
WM_TOUCHHITTESTING callback.

PaintDesktop The PaintDesktop function fills the clipping region in the


specified device context with the desktop pattern or
wallpaper. The function is provided primarily for shell
desktops.

PeekMessageA Dispatches incoming sent messages, checks the thread


message queue for a posted message, and retrieves the
message (if any exist).

PeekMessageW Dispatches incoming sent messages, checks the thread


message queue for a posted message, and retrieves the
message (if any exist).

PhysicalToLogicalPoint Converts the physical coordinates of a point in a window to


logical coordinates.

PhysicalToLogicalPointForPerMonitorDPI Converts a point in a window from physical coordinates into


logical coordinates, regardless of the dots per inch (dpi)
awareness of the caller.

POINTSTOPOINT The POINTSTOPOINT macro copies the contents of a


POINTS structure into a POINT structure.

POINTTOPOINTS The POINTTOPOINTS macro converts a POINT structure to a


POINTS structure.

PostMessageA Places (posts) a message in the message queue associated


with the thread that created the specified window and
returns without waiting for the thread to process the
message.

PostMessageW Places (posts) a message in the message queue associated


with the thread that created the specified window and
returns without waiting for the thread to process the
message.

PostQuitMessage Indicates to the system that a thread has made a request to


terminate (quit). It is typically used in response to a
WM_DESTROY message.

PostThreadMessageA Posts a message to the message queue of the specified


thread. It returns without waiting for the thread to process
the message.

PostThreadMessageW Posts a message to the message queue of the specified


thread. It returns without waiting for the thread to process
the message.

PrintWindow The PrintWindow function copies a visual window into the


specified device context (DC), typically a printer DC.
T IT L E DESC RIP T IO N

PrivateExtractIconsA Creates an array of handles to icons that are extracted from


a specified file.

PrivateExtractIconsW Creates an array of handles to icons that are extracted from


a specified file.

PtInRect The PtInRect function determines whether the specified point


lies within the specified rectangle.

QueryDisplayConfig The QueryDisplayConfig function retrieves information


about all possible display paths for all display devices, or
views, in the current setting.

RealChildWindowFromPoint Retrieves a handle to the child window at the specified point.


The search is restricted to immediate child windows;
grandchildren and deeper descendant windows are not
searched.

RealGetWindowClassW Retrieves a string that specifies the window type.

RedrawWindow The RedrawWindow function updates the specified rectangle


or region in a window's client area.

RegisterClassA Registers a window class for subsequent use in calls to the


CreateWindow or CreateWindowEx function.

RegisterClassExA Registers a window class for subsequent use in calls to the


CreateWindow or CreateWindowEx function.

RegisterClassExW Registers a window class for subsequent use in calls to the


CreateWindow or CreateWindowEx function.

RegisterClassW Registers a window class for subsequent use in calls to the


CreateWindow or CreateWindowEx function.

RegisterClipboardFormatA Registers a new clipboard format. This format can then be


used as a valid clipboard format.

RegisterClipboardFormatW Registers a new clipboard format. This format can then be


used as a valid clipboard format.

RegisterDeviceNotificationA Registers the device or type of device for which a window will
receive notifications.

RegisterDeviceNotificationW Registers the device or type of device for which a window will
receive notifications.

RegisterHotKey Defines a system-wide hot key.

RegisterPointerDeviceNotifications Registers a window to process the


WM_POINTERDEVICECHANGE,
WM_POINTERDEVICEINRANGE, and
WM_POINTERDEVICEOUTOFRANGE pointer device
notifications.
T IT L E DESC RIP T IO N

RegisterPointerInputTarget Allows the caller to register a target window to which all


pointer input of the specified type is redirected.

RegisterPointerInputTargetEx RegisterPointerInputTargetEx may be altered or unavailable.


Instead, use RegisterPointerInputTarget.

RegisterPowerSettingNotification Registers the application to receive power setting


notifications for the specific power setting event.

RegisterRawInputDevices Registers the devices that supply the raw input data.

RegisterShellHookWindow Registers a specified Shell window to receive certain


messages for events or notifications that are useful to Shell
applications.

RegisterSuspendResumeNotification Registers to receive notification when the system is


suspended or resumed. Similar to
PowerRegisterSuspendResumeNotification, but operates in
user mode and can take a window handle.

RegisterTouchHitTestingWindow Registers a window to process the WM_TOUCHHITTESTING


notification.

RegisterTouchWindow Registers a window as being touch-capable.

RegisterWindowMessageA Defines a new window message that is guaranteed to be


unique throughout the system. The message value can be
used when sending or posting messages.

RegisterWindowMessageW Defines a new window message that is guaranteed to be


unique throughout the system. The message value can be
used when sending or posting messages.

ReleaseCapture Releases the mouse capture from a window in the current


thread and restores normal mouse input processing.

ReleaseDC The ReleaseDC function releases a device context (DC),


freeing it for use by other applications. The effect of the
ReleaseDC function depends on the type of DC. It frees only
common and window DCs. It has no effect on class or
private DCs.

RemoveClipboardFormatListener Removes the given window from the system-maintained


clipboard format listener list.

RemoveMenu Deletes a menu item or detaches a submenu from the


specified menu.

RemovePropA Removes an entry from the property list of the specified


window. The specified character string identifies the entry to
be removed.

RemovePropW Removes an entry from the property list of the specified


window. The specified character string identifies the entry to
be removed.
T IT L E DESC RIP T IO N

ReplyMessage Replies to a message sent from another thread by the


SendMessage function.

ScreenToClient The ScreenToClient function converts the screen coordinates


of a specified point on the screen to client-area coordinates.

ScrollDC The ScrollDC function scrolls a rectangle of bits horizontally


and vertically.

ScrollWindow The ScrollWindow function scrolls the contents of the


specified window's client area.

ScrollWindowEx The ScrollWindowEx function scrolls the contents of the


specified window's client area.

SendDlgItemMessageA Sends a message to the specified control in a dialog box.

SendDlgItemMessageW Sends a message to the specified control in a dialog box.

SendInput Synthesizes keystrokes, mouse motions, and button clicks.

SendMessage Sends the specified message to a window or windows. The


SendMessage function calls the window procedure for the
specified window and does not return until the window
procedure has processed the message.

SendMessageA Sends the specified message to a window or windows. The


SendMessage function calls the window procedure for the
specified window and does not return until the window
procedure has processed the message.

SendMessageCallbackA Sends the specified message to a window or windows.

SendMessageCallbackW Sends the specified message to a window or windows.

SendMessageTimeoutA Sends the specified message to one or more windows.

SendMessageTimeoutW Sends the specified message to one or more windows.

SendMessageW Sends the specified message to a window or windows. The


SendMessage function calls the window procedure for the
specified window and does not return until the window
procedure has processed the message.

SendNotifyMessageA Sends the specified message to a window or windows.

SendNotifyMessageW Sends the specified message to a window or windows.


T IT L E DESC RIP T IO N

SetActiveWindow Activates a window. The window must be attached to the


calling thread's message queue.

SetCapture Sets the mouse capture to the specified window belonging


to the current thread.

SetCaretBlinkTime Sets the caret blink time to the specified number of


milliseconds. The blink time is the elapsed time, in
milliseconds, required to invert the caret's pixels.

SetCaretPos Moves the caret to the specified coordinates. If the window


that owns the caret was created with the CS_OWNDC class
style, then the specified coordinates are subject to the
mapping mode of the device context associated with that
window.

SetClassLongA Replaces the specified 32-bit (long) value at the specified


offset into the extra class memory or the WNDCLASSEX
structure for the class to which the specified window
belongs.

SetClassLongPtrA Replaces the specified value at the specified offset in the


extra class memory or the WNDCLASSEX structure for the
class to which the specified window belongs.

SetClassLongPtrW Replaces the specified value at the specified offset in the


extra class memory or the WNDCLASSEX structure for the
class to which the specified window belongs.

SetClassLongW Replaces the specified 32-bit (long) value at the specified


offset into the extra class memory or the WNDCLASSEX
structure for the class to which the specified window
belongs.

SetClassWord Replaces the 16-bit (WORD) value at the specified offset into
the extra class memory for the window class to which the
specified window belongs.

SetClipboardData Places data on the clipboard in a specified clipboard format.

SetClipboardViewer Adds the specified window to the chain of clipboard viewers.


Clipboard viewer windows receive a WM_DRAWCLIPBOARD
message whenever the content of the clipboard changes.
This function is used for backward compatibility with earlier
versions of Windows.

SetCoalescableTimer Creates a timer with the specified time-out value and


coalescing tolerance delay.

SetCursor Sets the cursor shape.

SetCursorPos Moves the cursor to the specified screen coordinates.

SetDialogControlDpiChangeBehavior Overrides the default per-monitor DPI scaling behavior of a


child window in a dialog.
T IT L E DESC RIP T IO N

SetDialogDpiChangeBehavior Dialogs in Per-Monitor v2 contexts are automatically DPI


scaled. This method lets you customize their DPI change
behavior.

SetDisplayAutoRotationPreferences Sets the screen auto-rotation preferences for the current


process.

SetDisplayConfig The SetDisplayConfig function modifies the display topology,


source, and target modes by exclusively enabling the
specified paths in the current session.

SetDlgItemInt Sets the text of a control in a dialog box to the string


representation of a specified integer value.

SetDlgItemTextA Sets the title or text of a control in a dialog box.

SetDlgItemTextW Sets the title or text of a control in a dialog box.

SetDoubleClickTime Sets the double-click time for the mouse.

SetFocus Sets the keyboard focus to the specified window. The


window must be attached to the calling thread's message
queue.

SetForegroundWindow Brings the thread that created the specified window into the
foreground and activates the window.

SetGestureConfig Configures the messages that are sent from a window for
Windows Touch gestures.

SetKeyboardState Copies an array of keyboard key states into the calling


thread's keyboard input-state table. This is the same table
accessed by the GetKeyboardState and GetKeyState
functions. Changes made to this table do not affect
keyboard input to any other thread.

SetLastErrorEx Sets the last-error code.

SetLayeredWindowAttributes Sets the opacity and transparency color key of a layered


window.

SetMenu Assigns a new menu to the specified window.

SetMenuContextHelpId Associates a Help context identifier with a menu.

SetMenuDefaultItem Sets the default menu item for the specified menu.

SetMenuInfo Sets information for a specified menu.

SetMenuItemBitmaps Associates the specified bitmap with a menu item. Whether


the menu item is selected or clear, the system displays the
appropriate bitmap next to the menu item.
T IT L E DESC RIP T IO N

SetMenuItemInfoA Changes information about a menu item.

SetMenuItemInfoW Changes information about a menu item.

SetMessageExtraInfo Sets the extra message information for the current thread.

SetParent Changes the parent window of the specified child window.

SetPhysicalCursorPos Sets the position of the cursor in physical coordinates.

SetProcessDefaultLayout Changes the default layout when windows are created with
no parent or owner only for the currently running process.

SetProcessDPIAware SetProcessDPIAware may be altered or unavailable. Instead,


use SetProcessDPIAwareness.

SetProcessDpiAwarenessContext Sets the current process to a specified dots per inch (dpi)
awareness context. The DPI awareness contexts are from the
DPI_AWARENESS_CONTEXT value.

SetProcessRestrictionExemption Exempts the calling process from restrictions preventing


desktop processes from interacting with the Windows Store
app environment. This function is used by development and
debugging tools.

SetProcessWindowStation Assigns the specified window station to the calling process.

SetPropA Adds a new entry or changes an existing entry in the


property list of the specified window.

SetPropW Adds a new entry or changes an existing entry in the


property list of the specified window.

SetRect The SetRect function sets the coordinates of the specified


rectangle. This is equivalent to assigning the left, top, right,
and bottom arguments to the appropriate members of the
RECT structure.

SetRectEmpty The SetRectEmpty function creates an empty rectangle in


which all coordinates are set to zero.

SetScrollInfo The SetScrollInfo function sets the parameters of a scroll bar,


including the minimum and maximum scrolling positions, the
page size, and the position of the scroll box (thumb). The
function also redraws the scroll bar, if requested.

SetScrollPos The SetScrollPos function sets the position of the scroll box
(thumb) in the specified scroll bar and, if requested, redraws
the scroll bar to reflect the new position of the scroll box.

SetScrollRange The SetScrollRange function sets the minimum and


maximum scroll box positions for the specified scroll bar.

SetSysColors Sets the colors for the specified display elements.


T IT L E DESC RIP T IO N

SetSystemCursor Enables an application to customize the system cursors. It


replaces the contents of the system cursor specified by the
id parameter with the contents of the cursor specified by the
hcur parameter and then destroys hcur.

SetThreadDesktop Assigns the specified desktop to the calling thread. All


subsequent operations on the desktop use the access rights
granted to the desktop.

SetThreadDpiAwarenessContext Set the DPI awareness for the current thread to the provided
value.

SetThreadDpiHostingBehavior Sets the thread's DPI_HOSTING_BEHAVIOR. This behavior


allows windows created in the thread to host child windows
with a different DPI_AWARENESS_CONTEXT.

SetTimer Creates a timer with the specified time-out value.

SetUserObjectInformationA Sets information about the specified window station or


desktop object.

SetUserObjectInformationW Sets information about the specified window station or


desktop object.

SetUserObjectSecurity Sets the security of a user object. This can be, for example, a
window or a DDE conversation.

SetWindowContextHelpId Associates a Help context identifier with the specified


window.

SetWindowDisplayAffinity Stores the display affinity setting in kernel mode on the


hWnd associated with the window.

SetWindowFeedbackSetting Sets the feedback configuration for a window.

SetWindowLongA Changes an attribute of the specified window. The function


also sets the 32-bit (long) value at the specified offset into
the extra window memory.

SetWindowLongPtrA Changes an attribute of the specified window.

SetWindowLongPtrW Changes an attribute of the specified window.

SetWindowLongW Changes an attribute of the specified window. The function


also sets the 32-bit (long) value at the specified offset into
the extra window memory.

SetWindowPlacement Sets the show state and the restored, minimized, and
maximized positions of the specified window.
T IT L E DESC RIP T IO N

SetWindowPos Changes the size, position, and Z order of a child, pop-up, or


top-level window. These windows are ordered according to
their appearance on the screen. The topmost window
receives the highest rank and is the first window in the Z
order.

SetWindowRgn The SetWindowRgn function sets the window region of a


window.

SetWindowsHookExA Installs an application-defined hook procedure into a hook


chain.

SetWindowsHookExW Installs an application-defined hook procedure into a hook


chain.

SetWindowTextA Changes the text of the specified window's title bar (if it has
one). If the specified window is a control, the text of the
control is changed. However, SetWindowText cannot change
the text of a control in another application.

SetWindowTextW Changes the text of the specified window's title bar (if it has
one). If the specified window is a control, the text of the
control is changed. However, SetWindowText cannot change
the text of a control in another application.

SetWinEventHook Sets an event hook function for a range of events.

ShowCaret Makes the caret visible on the screen at the caret's current
position. When the caret becomes visible, it begins flashing
automatically.

ShowCursor Displays or hides the cursor.

ShowOwnedPopups Shows or hides all pop-up windows owned by the specified


window.

ShowScrollBar The ShowScrollBar function shows or hides the specified


scroll bar.

ShowWindow Sets the specified window's show state.

ShowWindowAsync Sets the show state of a window without waiting for the
operation to complete.

ShutdownBlockReasonCreate Indicates that the system cannot be shut down and sets a
reason string to be displayed to the user if system shutdown
is initiated.

ShutdownBlockReasonDestroy Indicates that the system can be shut down and frees the
reason string.

ShutdownBlockReasonQuery Retrieves the reason string set by the


ShutdownBlockReasonCreate function.
T IT L E DESC RIP T IO N

SkipPointerFrameMessages Determines which pointer input frame generated the most


recently retrieved message for the specified pointer and
discards any queued (unretrieved) pointer input messages
generated from the same pointer input frame.

SoundSentry Triggers a visual signal to indicate that a sound is playing.

SubtractRect The SubtractRect function determines the coordinates of a


rectangle formed by subtracting one rectangle from another.

SwapMouseButton Reverses or restores the meaning of the left and right mouse
buttons.

SwitchDesktop Makes the specified desktop visible and activates it. This
enables the desktop to receive input from the user.

SwitchToThisWindow Switches focus to the specified window and brings it to the


foreground.

SystemParametersInfoA Retrieves or sets the value of one of the system-wide


parameters.

SystemParametersInfoForDpi Retrieves the value of one of the system-wide parameters,


taking into account the provided DPI value.

SystemParametersInfoW Retrieves or sets the value of one of the system-wide


parameters.

TabbedTextOutA The TabbedTextOut function writes a character string at a


specified location, expanding tabs to the values specified in
an array of tab-stop positions. Text is written in the currently
selected font, background color, and text color.

TabbedTextOutW The TabbedTextOut function writes a character string at a


specified location, expanding tabs to the values specified in
an array of tab-stop positions. Text is written in the currently
selected font, background color, and text color.

TileWindows Tiles the specified child windows of the specified parent


window.

ToAscii Translates the specified virtual-key code and keyboard state


to the corresponding character or characters.

ToAsciiEx Translates the specified virtual-key code and keyboard state


to the corresponding character or characters. The function
translates the code using the input language and physical
keyboard layout identified by the input locale identifier.

TOUCH_COORD_TO_PIXEL Converts touch coordinates to pixels.

ToUnicode Translates the specified virtual-key code and keyboard state


to the corresponding Unicode character or characters.
T IT L E DESC RIP T IO N

ToUnicodeEx Translates the specified virtual-key code and keyboard state


to the corresponding Unicode character or characters.

TrackMouseEvent Posts messages when the mouse pointer leaves a window or


hovers over a window for a specified amount of time.

TrackPopupMenu Displays a shortcut menu at the specified location and tracks


the selection of items on the menu. The shortcut menu can
appear anywhere on the screen.

TrackPopupMenuEx Displays a shortcut menu at the specified location and tracks


the selection of items on the shortcut menu. The shortcut
menu can appear anywhere on the screen.

TranslateAcceleratorA Processes accelerator keys for menu commands.

TranslateAcceleratorW Processes accelerator keys for menu commands.

TranslateMDISysAccel Processes accelerator keystrokes for window menu


commands of the multiple-document interface (MDI) child
windows associated with the specified MDI client window.

TranslateMessage Translates virtual-key messages into character messages. The


character messages are posted to the calling thread's
message queue, to be read the next time the thread calls the
GetMessage or PeekMessage function.

UnhookWindowsHookEx Removes a hook procedure installed in a hook chain by the


SetWindowsHookEx function.

UnhookWinEvent Removes an event hook function created by a previous call


to SetWinEventHook.

UnionRect The UnionRect function creates the union of two rectangles.


The union is the smallest rectangle that contains both source
rectangles.

UnloadKeyboardLayout Unloads an input locale identifier (formerly called a keyboard


layout).

UnregisterClassA Unregisters a window class, freeing the memory required for


the class.

UnregisterClassW Unregisters a window class, freeing the memory required for


the class.

UnregisterDeviceNotification Closes the specified device notification handle.

UnregisterHotKey Frees a hot key previously registered by the calling thread.

UnregisterPointerInputTarget Allows the caller to unregister a target window to which all


pointer input of the specified type is redirected.
T IT L E DESC RIP T IO N

UnregisterPointerInputTargetEx UnregisterPointerInputTargetEx may be altered or


unavailable. Instead, use UnregisterPointerInputTarget.

UnregisterPowerSettingNotification Unregisters the power setting notification.

UnregisterSuspendResumeNotification Cancels a registration to receive notification when the


system is suspended or resumed. Similar to
PowerUnregisterSuspendResumeNotification but operates in
user mode.

UnregisterTouchWindow Registers a window as no longer being touch-capable.

UpdateLayeredWindow Updates the position, size, shape, content, and translucency


of a layered window.

UpdateWindow The UpdateWindow function updates the client area of the


specified window by sending a WM_PAINT message to the
window if the window's update region is not empty.

UserHandleGrantAccess Grants or denies access to a handle to a User object to a job


that has a user-interface restriction.

ValidateRect The ValidateRect function validates the client area within a


rectangle by removing the rectangle from the update region
of the specified window.

ValidateRgn The ValidateRgn function validates the client area within a


region by removing the region from the current update
region of the specified window.

VkKeyScanA Translates a character to the corresponding virtual-key code


and shift state for the current keyboard.

VkKeyScanExA Translates a character to the corresponding virtual-key code


and shift state. The function translates the character using
the input language and physical keyboard layout identified
by the input locale identifier.

VkKeyScanExW Translates a character to the corresponding virtual-key code


and shift state. The function translates the character using
the input language and physical keyboard layout identified
by the input locale identifier.

VkKeyScanW Translates a character to the corresponding virtual-key code


and shift state for the current keyboard.

WaitForInputIdle Waits until the specified process has finished processing its
initial input and is waiting for user input with no input
pending, or until the time-out interval has elapsed.

WaitMessage Yields control to other threads when a thread has no other


messages in its message queue. The WaitMessage function
suspends the thread and does not return until a new
message is placed in the thread's message queue.
T IT L E DESC RIP T IO N

WindowFromDC The WindowFromDC function returns a handle to the


window associated with the specified display device context
(DC). Output functions that use the specified device context
draw into this window.

WindowFromPhysicalPoint Retrieves a handle to the window that contains the specified


physical point.

WindowFromPoint Retrieves a handle to the window that contains the specified


point.

WinHelpA Launches Windows Help (Winhelp.exe) and passes additional


data that indicates the nature of the help requested by the
application.

WinHelpW Launches Windows Help (Winhelp.exe) and passes additional


data that indicates the nature of the help requested by the
application.

wsprintfA Writes formatted data to the specified buffer.

wsprintfW Writes formatted data to the specified buffer.

wvsprintfA Writes formatted data to the specified buffer using a pointer


to a list of arguments.

wvsprintfW Writes formatted data to the specified buffer using a pointer


to a list of arguments.

Callback functions
T IT L E DESC RIP T IO N

DLGPROC Application-defined callback function used with the


CreateDialog and DialogBox families of functions.

DRAWSTATEPROC The DrawStateProc function is an application-defined


callback function that renders a complex image for the
DrawState function.

EDITWORDBREAKPROCA An application-defined callback function used with the


EM_SETWORDBREAKPROC message.

EDITWORDBREAKPROCW An application-defined callback function used with the


EM_SETWORDBREAKPROC message.

GRAYSTRINGPROC The OutputProc function is an application-defined callback


function used with the GrayString function.
T IT L E DESC RIP T IO N

HOOKPROC An application-defined or library-defined callback function


used with the SetWindowsHookEx function. The system calls
this function after the SendMessage function is called. The
hook procedure can examine the message; it cannot modify
it.

MONITORENUMPROC A MonitorEnumProc function is an application-defined


callback function that is called by the EnumDisplayMonitors
function.

PROPENUMPROCA An application-defined callback function used with the


EnumProps function.

PROPENUMPROCEXA Application-defined callback function used with the


EnumPropsEx function.

PROPENUMPROCEXW Application-defined callback function used with the


EnumPropsEx function.

PROPENUMPROCW An application-defined callback function used with the


EnumProps function.

SENDASYNCPROC An application-defined callback function used with the


SendMessageCallback function.

TIMERPROC An application-defined callback function that processes


WM_TIMER messages. The TIMERPROC type defines a
pointer to this callback function. TimerProc is a placeholder
for the application-defined function name.

WINEVENTPROC An application-defined callback (or hook) function that the


system calls in response to events generated by an
accessible object.

Structures
T IT L E DESC RIP T IO N

ACCEL Defines an accelerator key used in an accelerator table.

ACCESSTIMEOUT Contains information about the time-out period associated


with the accessibility features.

ALTTABINFO Contains status information for the application-switching


(ALT+TAB) window.

ANIMATIONINFO Describes the animation effects associated with user actions.

AUDIODESCRIPTION Contains information associated with audio descriptions. This


structure is used with the SystemParametersInfo function
when the SPI_GETAUDIODESCRIPTION or
SPI_SETAUDIODESCRIPTION action value is specified.
T IT L E DESC RIP T IO N

BSMINFO Contains information about a window that denied a request


from BroadcastSystemMessageEx.

CBT_CREATEWNDA Contains information passed to a WH_CBT hook procedure,


CBTProc, before a window is created.

CBT_CREATEWNDW Contains information passed to a WH_CBT hook procedure,


CBTProc, before a window is created.

CBTACTIVATESTRUCT Contains information passed to a WH_CBT hook procedure,


CBTProc, before a window is activated.

CHANGEFILTERSTRUCT Contains extended result information obtained by calling the


ChangeWindowMessageFilterEx function.

CLIENTCREATESTRUCT Contains information about the menu and first multiple-


document interface (MDI) child window of an MDI client
window.

COMBOBOXINFO Contains combo box status information.

COMPAREITEMSTRUCT Supplies the identifiers and application-supplied data for two


items in a sorted, owner-drawn list box or combo box.

COPYDATASTRUCT Contains data to be passed to another application by the


WM_COPYDATA message.

CREATESTRUCTA Defines the initialization parameters passed to the window


procedure of an application. These members are identical to
the parameters of the CreateWindowEx function.

CREATESTRUCTW Defines the initialization parameters passed to the window


procedure of an application. These members are identical to
the parameters of the CreateWindowEx function.

CURSORINFO Contains global cursor information.

CURSORSHAPE Contains information about a cursor.

CWPRETSTRUCT Defines the message parameters passed to a


WH_CALLWNDPROCRET hook procedure, CallWndRetProc.

CWPSTRUCT Defines the message parameters passed to a


WH_CALLWNDPROC hook procedure, CallWndProc.

DEBUGHOOKINFO Contains debugging information passed to a WH_DEBUG


hook procedure, DebugProc.

DELETEITEMSTRUCT Describes a deleted list box or combo box item.

DLGITEMTEMPLATE Defines the dimensions and style of a control in a dialog box.


One or more of these structures are combined with a
DLGTEMPLATE structure to form a standard template for a
dialog box.
T IT L E DESC RIP T IO N

DLGTEMPLATE Defines the dimensions and style of a dialog box.

DRAWITEMSTRUCT Provides information that the owner window uses to


determine how to paint an owner-drawn control or menu
item.

DRAWTEXTPARAMS The DRAWTEXTPARAMS structure contains extended


formatting options for the DrawTextEx function.

EVENTMSG Contains information about a hardware message sent to the


system message queue. This structure is used to store
message information for the JournalPlaybackProc callback
function.

FILTERKEYS Contains information about the FilterKeys accessibility


feature, which enables a user with disabilities to set the
keyboard repeat rate (RepeatKeys), acceptance delay
(SlowKeys), and bounce rate (BounceKeys).

FLASHWINFO Contains the flash status for a window and the number of
times the system should flash the window.

GESTURECONFIG Gets and sets the configuration for enabling gesture


messages and the type of this configuration.

GESTUREINFO Stores information about a gesture.

GESTURENOTIFYSTRUCT When transmitted with WM_GESTURENOTIFY messages,


passes information about a gesture.

GUITHREADINFO Contains information about a GUI thread.

HARDWAREINPUT Contains information about a simulated message generated


by an input device other than a keyboard or mouse.

HELPINFO Contains information about an item for which context-


sensitive help has been requested.

HELPWININFOA Contains the size and position of either a primary or


secondary Help window. An application can set this
information by calling the WinHelp function with the
HELP_SETWINPOS value.

HELPWININFOW Contains the size and position of either a primary or


secondary Help window. An application can set this
information by calling the WinHelp function with the
HELP_SETWINPOS value.

HIGHCONTRASTA Contains information about the high contrast accessibility


feature.

HIGHCONTRASTW Contains information about the high contrast accessibility


feature.
T IT L E DESC RIP T IO N

ICONINFO Contains information about an icon or a cursor.

ICONINFOEXA Contains information about an icon or a cursor. Extends


ICONINFO. Used by GetIconInfoEx.

ICONINFOEXW Contains information about an icon or a cursor. Extends


ICONINFO. Used by GetIconInfoEx.

ICONMETRICSA Contains the scalable metrics associated with icons. This


structure is used with the SystemParametersInfo function
when the SPI_GETICONMETRICS or SPI_SETICONMETRICS
action is specified.

ICONMETRICSW Contains the scalable metrics associated with icons. This


structure is used with the SystemParametersInfo function
when the SPI_GETICONMETRICS or SPI_SETICONMETRICS
action is specified.

INPUT Used by SendInput to store information for synthesizing


input events such as keystrokes, mouse movement, and
mouse clicks.

INPUT_INJECTION_VALUE Contains the input injection details.

INPUT_MESSAGE_SOURCE Contains information about the source of the input


message.

INPUT_TRANSFORM Defines the matrix that represents a transform on a message


consumer.

KBDLLHOOKSTRUCT Contains information about a low-level keyboard input


event.

KEYBDINPUT Contains information about a simulated keyboard event.

LASTINPUTINFO Contains the time of the last input.

MDICREATESTRUCTA Contains information about the class, title, owner, location,


and size of a multiple-document interface (MDI) child
window.

MDICREATESTRUCTW Contains information about the class, title, owner, location,


and size of a multiple-document interface (MDI) child
window.

MDINEXTMENU Contains information about the menu to be activated.

MEASUREITEMSTRUCT Informs the system of the dimensions of an owner-drawn


control or menu item. This allows the system to process user
interaction with the control correctly.

MENUBARINFO Contains menu bar information.


T IT L E DESC RIP T IO N

MENUGETOBJECTINFO Contains information about the menu that the mouse cursor
is on.

MENUINFO Contains information about a menu.

MENUITEMINFOA Contains information about a menu item.

MENUITEMINFOW Contains information about a menu item.

MENUITEMTEMPLATE Defines a menu item in a menu template.

MENUITEMTEMPLATEHEADER Defines the header for a menu template. A complete menu


template consists of a header and one or more menu item
lists.

MINIMIZEDMETRICS Contains the scalable metrics associated with minimized


windows.

MINMAXINFO Contains information about a window's maximized size and


position and its minimum and maximum tracking size.

MONITORINFO The MONITORINFO structure contains information about a


display monitor.The GetMonitorInfo function stores
information in a MONITORINFO structure or a
MONITORINFOEX structure.The MONITORINFO structure is
a subset of the MONITORINFOEX structure.

MONITORINFOEXA The MONITORINFOEX structure contains information about


a display monitor.The GetMonitorInfo function stores
information into a MONITORINFOEX structure or a
MONITORINFO structure.The MONITORINFOEX structure is
a superset of the MONITORINFO structure.

MONITORINFOEXW The MONITORINFOEX structure contains information about


a display monitor.The GetMonitorInfo function stores
information into a MONITORINFOEX structure or a
MONITORINFO structure.The MONITORINFOEX structure is
a superset of the MONITORINFO structure.

MOUSEHOOKSTRUCT Contains information about a mouse event passed to a


WH_MOUSE hook procedure, MouseProc.

MOUSEHOOKSTRUCTEX Contains information about a mouse event passed to a


WH_MOUSE hook procedure, MouseProc. This is an
extension of the MOUSEHOOKSTRUCT structure that
includes information about wheel movement or the use of
the X button.

MOUSEINPUT Contains information about a simulated mouse event.

MOUSEKEYS Contains information about the MouseKeys accessibility


feature.

MOUSEMOVEPOINT Contains information about the mouse's location in screen


coordinates.
T IT L E DESC RIP T IO N

MSG Contains message information from a thread's message


queue.

MSGBOXPARAMSA Contains information used to display a message box. The


MessageBoxIndirect function uses this structure.

MSGBOXPARAMSW Contains information used to display a message box. The


MessageBoxIndirect function uses this structure.

MSLLHOOKSTRUCT Contains information about a low-level mouse input event.

MULTIKEYHELPA Specifies a keyword to search for and the keyword table to


be searched by Windows Help.

MULTIKEYHELPW Specifies a keyword to search for and the keyword table to


be searched by Windows Help.

NCCALCSIZE_PARAMS Contains information that an application can use while


processing the WM_NCCALCSIZE message to calculate the
size, position, and valid contents of the client area of a
window.

NMHDR Contains information about a notification message.

NONCLIENTMETRICSA Contains the scalable metrics associated with the nonclient


area of a nonminimized window.

NONCLIENTMETRICSW Contains the scalable metrics associated with the nonclient


area of a nonminimized window.

PAINTSTRUCT The PAINTSTRUCT structure contains information for an


application. This information can be used to paint the client
area of a window owned by that application.

POINTER_DEVICE_CURSOR_INFO Contains cursor ID mappings for pointer devices.

POINTER_DEVICE_INFO Contains information about a pointer device. An array of


these structures is returned from the GetPointerDevices
function. A single structure is returned from a call to the
GetPointerDevice function.

POINTER_DEVICE_PROPERTY Contains pointer-based device properties (Human Interface


Device (HID) global items that correspond to HID usages).

POINTER_INFO Contains basic pointer information common to all pointer


types. Applications can retrieve this information using the
GetPointerInfo, GetPointerFrameInfo, GetPointerInfoHistory
and GetPointerFrameInfoHistory functions.

POINTER_PEN_INFO Defines basic pen information common to all pointer types.


T IT L E DESC RIP T IO N

POINTER_TOUCH_INFO Defines basic touch information common to all pointer


types.

POINTER_TYPE_INFO Contains information about the pointer input type.

POWERBROADCAST_SETTING Sent with a power setting event and contains data about the
specific change.

RAWHID Describes the format of the raw input from a Human


Interface Device (HID).

RAWINPUT Contains the raw input from a device.

RAWINPUTDEVICE Defines information for the raw input devices.

RAWINPUTDEVICELIST Contains information about a raw input device.

RAWINPUTHEADER Contains the header information that is part of the raw


input data.

RAWKEYBOARD Contains information about the state of the keyboard.

RAWMOUSE Contains information about the state of the mouse.

RID_DEVICE_INFO Defines the raw input data coming from any device.

RID_DEVICE_INFO_HID Defines the raw input data coming from the specified
Human Interface Device (HID).

RID_DEVICE_INFO_KEYBOARD Defines the raw input data coming from the specified
keyboard.

RID_DEVICE_INFO_MOUSE Defines the raw input data coming from the specified mouse.

SCROLLBARINFO The SCROLLBARINFO structure contains scroll bar


information.

SCROLLINFO The SCROLLINFO structure contains scroll bar parameters to


be set by the SetScrollInfo function (or
SBM_SETSCROLLINFO message), or retrieved by the
GetScrollInfo function (or SBM_GETSCROLLINFO message).

SERIALKEYSA Contains information about the SerialKeys accessibility


feature, which interprets data from a communication aid
attached to a serial port as commands causing the system
to simulate keyboard and mouse input.

SERIALKEYSW Contains information about the SerialKeys accessibility


feature, which interprets data from a communication aid
attached to a serial port as commands causing the system
to simulate keyboard and mouse input.
T IT L E DESC RIP T IO N

SOUNDSENTRYA Contains information about the SoundSentry accessibility


feature. When the SoundSentry feature is on, the computer
displays a visual indication only when a sound is generated.

SOUNDSENTRYW Contains information about the SoundSentry accessibility


feature. When the SoundSentry feature is on, the computer
displays a visual indication only when a sound is generated.

STICKYKEYS Contains information about the StickyKeys accessibility


feature.

STYLESTRUCT Contains the styles for a window.

TITLEBARINFO Contains title bar information.

TITLEBARINFOEX Expands on the information described in the TITLEBARINFO


structure by including the coordinates of each element of
the title bar.

TOGGLEKEYS Contains information about the ToggleKeys accessibility


feature.

TOUCH_HIT_TESTING_INPUT Contains information about the touch contact area reported


by the touch digitizer.

TOUCH_HIT_TESTING_PROXIMITY_EVALUATION Contains the hit test score that indicates whether the object
is the likely target of the touch contact area, relative to other
objects that intersect the touch contact area.

TOUCHINPUT Encapsulates data for touch input.

TOUCHPREDICTIONPARAMETERS Contains hardware input details that can be used to predict


touch targets and help compensate for hardware latency
when processing touch and gesture input that contains
distance and velocity data.

TPMPARAMS Contains extended parameters for the TrackPopupMenuEx


function.

TRACKMOUSEEVENT Used by the TrackMouseEvent function to track when the


mouse pointer leaves a window or hovers over a window for
a specified amount of time.

UPDATELAYEREDWINDOWINFO Used by UpdateLayeredWindowIndirect to provide position,


size, shape, content, and translucency information for a
layered window.

USAGE_PROPERTIES Contains device properties (Human Interface Device (HID)


global items that correspond to HID usages) for any type of
HID input device.

USEROBJECTFLAGS Contains information about a window station or desktop


handle.
T IT L E DESC RIP T IO N

WINDOWINFO Contains window information.

WINDOWPLACEMENT Contains information about the placement of a window on


the screen.

WINDOWPOS Contains information about the size and position of a


window.

WNDCLASSA Contains the window class attributes that are registered by


the RegisterClass function.

WNDCLASSEXA Contains window class information.

WNDCLASSEXW Contains window class information.

WNDCLASSW Contains the window class attributes that are registered by


the RegisterClass function.

WTSSESSION_NOTIFICATION Provides information about the session change notification.


A service receives this structure in its HandlerEx function in
response to a session change event.

Enumerations
T IT L E DESC RIP T IO N

AR_STATE Indicates the state of screen auto-rotation for the system.


For example, whether auto-rotation is supported, and
whether it is enabled by the user.

DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS Describes per-monitor DPI scaling behavior overrides for


child windows within dialogs. The values in this enumeration
are bitfields and can be combined.

DIALOG_DPI_CHANGE_BEHAVIORS In Per Monitor v2 contexts, dialogs will automatically


respond to DPI changes by resizing themselves and re-
computing the positions of their child windows (here
referred to as re-layouting).

FEEDBACK_TYPE Specifies the visual feedback associated with an event.

INPUT_MESSAGE_DEVICE_TYPE The type of device that sent the input message.

INPUT_MESSAGE_ORIGIN_ID The ID of the input message source.

ORIENTATION_PREFERENCE Indicates the screen orientation preference for a desktop app


process.

POINTER_BUTTON_CHANGE_TYPE Identifies a change in the state of a button associated with a


pointer.

POINTER_DEVICE_CURSOR_TYPE Identifies the pointer device cursor types.


T IT L E DESC RIP T IO N

POINTER_DEVICE_TYPE Identifies the pointer device types.

POINTER_FEEDBACK_MODE Identifies the visual feedback behaviors available to


CreateSyntheticPointerDevice.

tagPOINTER_INPUT_TYPE Identifies the pointer input types.


AdjustWindowRect function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Calculates the required size of the window rectangle, based on the desired client-rectangle size. The window
rectangle can then be passed to the CreateWindow function to create a window whose client area is the desired
size.
To specify an extended window style, use the AdjustWindowRectEx function.

Syntax
BOOL AdjustWindowRect(
LPRECT lpRect,
DWORD dwStyle,
BOOL bMenu
);

Parameters
lpRect

Type: LPRECT
A pointer to a RECT structure that contains the coordinates of the top-left and bottom-right corners of the
desired client area. When the function returns, the structure contains the coordinates of the top-left and bottom-
right corners of the window to accommodate the desired client area.
dwStyle

Type: DWORD
The window style of the window whose required size is to be calculated. Note that you cannot specify the
WS_OVERL APPED style.
bMenu

Type: BOOL
Indicates whether the window has a menu.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
A client rectangle is the smallest rectangle that completely encloses a client area. A window rectangle is the
smallest rectangle that completely encloses the window, which includes the client area and the nonclient area.
The AdjustWindowRect function does not add extra space when a menu bar wraps to two or more rows.
The AdjustWindowRect function does not take the WS_VSCROLL or WS_HSCROLL styles into account. To
account for the scroll bars, call the GetSystemMetrics function with SM_CXVSCROLL or SM_CYHSCROLL .

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows


10, version 10.0.14393)

See also
AdjustWindowRectEx
Conceptual
CreateWindow
GetSystemMetrics
Other Resources
RECT
Reference
Windows
AdjustWindowRectEx function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Calculates the required size of the window rectangle, based on the desired size of the client rectangle. The
window rectangle can then be passed to the CreateWindowEx function to create a window whose client area is
the desired size.

Syntax
BOOL AdjustWindowRectEx(
LPRECT lpRect,
DWORD dwStyle,
BOOL bMenu,
DWORD dwExStyle
);

Parameters
lpRect

Type: LPRECT
A pointer to a RECT structure that contains the coordinates of the top-left and bottom-right corners of the
desired client area. When the function returns, the structure contains the coordinates of the top-left and bottom-
right corners of the window to accommodate the desired client area.
dwStyle

Type: DWORD
The window style of the window whose required size is to be calculated. Note that you cannot specify the
WS_OVERL APPED style.
bMenu

Type: BOOL
Indicates whether the window has a menu.
dwExStyle

Type: DWORD
The extended window style of the window whose required size is to be calculated.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
A client rectangle is the smallest rectangle that completely encloses a client area. A window rectangle is the
smallest rectangle that completely encloses the window, which includes the client area and the nonclient area.
The AdjustWindowRectEx function does not add extra space when a menu bar wraps to two or more rows.
The AdjustWindowRectEx function does not take the WS_VSCROLL or WS_HSCROLL styles into account. To
account for the scroll bars, call the GetSystemMetrics function with SM_CXVSCROLL or SM_CYHSCROLL .
This API is not DPI aware, and should not be used if the calling thread is per-monitor DPI aware. For the DPI-
aware version of this API, see AdjustWindowsRectExForDPI. For more information on DPI awareness, see the
Windows High DPI documentation.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
AdjustWindowsRectExForDPI
Conceptual
CreateWindowEx
Other Resources
RECT
Reference
Windows
AllowSetForegroundWindow function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Enables the specified process to set the foreground window using the SetForegroundWindow function. The
calling process must already be able to set the foreground window. For more information, see Remarks later in
this topic.

Syntax
BOOL AllowSetForegroundWindow(
DWORD dwProcessId
);

Parameters
dwProcessId

Type: DWORD
The identifier of the process that will be enabled to set the foreground window. If this parameter is ASFW_ANY ,
all processes will be enabled to set the foreground window.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. The function will fail if the calling process cannot set the foreground
window. To get extended error information, call GetLastError.

Remarks
The system restricts which processes can set the foreground window. A process can set the foreground window
only if one of the following conditions is true:
The process is the foreground process.
The process was started by the foreground process.
The process received the last input event.
There is no foreground process.
The foreground process is being debugged.
The foreground is not locked (see LockSetForegroundWindow).
The foreground lock time-out has expired (see SPI_GETFOREGROUNDLOCKTIMEOUT in
SystemParametersInfo).
No menus are active.
A process that can set the foreground window can enable another process to set the foreground window by calling
AllowSetForegroundWindow . The process specified by dwProcessId loses the ability to set the foreground
window the next time the user generates input, unless the input is directed at that process, or the next time a
process calls AllowSetForegroundWindow , unless that process is specified.
Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
LockSetForegroundWindow
Reference
SetForegroundWindow
Windows
ALTTABINFO structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains status information for the application-switching (ALT+TAB) window.

Syntax
typedef struct tagALTTABINFO {
DWORD cbSize;
int cItems;
int cColumns;
int cRows;
int iColFocus;
int iRowFocus;
int cxItem;
int cyItem;
POINT ptStart;
} ALTTABINFO, *PALTTABINFO, *LPALTTABINFO;

Members
cbSize

Type: DWORD
The size, in bytes, of the structure. The caller must set this to sizeof(ALTTABINFO) .
cItems

Type: int
The number of items in the window.
cColumns

Type: int
The number of columns in the window.
cRows

Type: int
The number of rows in the window.
iColFocus

Type: int
The column of the item that has the focus.
iRowFocus

Type: int
The row of the item that has the focus.
cxItem

Type: int
The width of each icon in the application-switching window.
cyItem

Type: int
The height of each icon in the application-switching window.
ptStart

Type: POINT
The top-left corner of the first icon.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
Conceptual
GetAltTabInfo
Reference
Windows
AnimateWindow function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Enables you to produce special effects when showing or hiding windows. There are four types of animation: roll,
slide, collapse or expand, and alpha-blended fade.

Syntax
BOOL AnimateWindow(
HWND hWnd,
DWORD dwTime,
DWORD dwFlags
);

Parameters
hWnd

Type: HWND
A handle to the window to animate. The calling thread must own this window.
dwTime

Type: DWORD
The time it takes to play the animation, in milliseconds. Typically, an animation takes 200 milliseconds to play.
dwFlags

Type: DWORD
The type of animation. This parameter can be one or more of the following values. Note that, by default, these
flags take effect when showing a window. To take effect when hiding a window, use AW_HIDE and a logical OR
operator with the appropriate flags.

VA L UE M EA N IN G

Activates the window. Do not use this value with AW_HIDE .


AW_ACTIVATE
0x00020000

Uses a fade effect. This flag can be used only if hwnd is a


AW_BLEND top-level window.
0x00080000

Makes the window appear to collapse inward if AW_HIDE is


AW_CENTER used or expand outward if the AW_HIDE is not used. The
0x00000010 various direction flags have no effect.
Hides the window. By default, the window is shown.
AW_HIDE
0x00010000

Animates the window from left to right. This flag can be used
AW_HOR_POSITIVE with roll or slide animation. It is ignored when used with
0x00000001 AW_CENTER or AW_BLEND .

Animates the window from right to left. This flag can be used
AW_HOR_NEGATIVE with roll or slide animation. It is ignored when used with
0x00000002 AW_CENTER or AW_BLEND .

Uses slide animation. By default, roll animation is used. This


AW_SLIDE flag is ignored when used with AW_CENTER.
0x00040000

Animates the window from top to bottom. This flag can be


AW_VER_POSITIVE used with roll or slide animation. It is ignored when used
0x00000004 with AW_CENTER or AW_BLEND .

Animates the window from bottom to top. This flag can be


AW_VER_NEGATIVE used with roll or slide animation. It is ignored when used
0x00000008 with AW_CENTER or AW_BLEND .

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. The function will fail in the following situations:
If the window is already visible and you are trying to show the window.
If the window is already hidden and you are trying to hide the window.
If there is no direction specified for the slide or roll animation.
When trying to animate a child window with AW_BLEND .
If the thread does not own the window. Note that, in this case, AnimateWindow fails but GetLastError
returns ERROR_SUCCESS .
To get extended error information, call the GetLastError function.

Remarks
To show or hide a window without special effects, use ShowWindow.
When using slide or roll animation, you must specify the direction. It can be either AW_HOR_POSITIVE ,
AW_HOR_NEGATIVE , AW_VER_POSITIVE, or AW_VER_NEGATIVE.
You can combine AW_HOR_POSITIVE or AW_HOR_NEGATIVE with AW_VER_POSITIVE or
AW_VER_NEGATIVE to animate a window diagonally.
The window procedures for the window and its child windows should handle any WM_PRINT or
WM_PRINTCLIENT messages. Dialog boxes, controls, and common controls already handle WM_PRINTCLIENT .
The default window procedure already handles WM_PRINT .
If a child window is displayed partially clipped, when it is animated it will have holes where it is clipped.
AnimateWindow supports RTL windows.
Avoid animating a window that has a drop shadow because it produces visually distracting, jerky animations.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
Other Resources
Reference
ShowWindow
WM_PRINT
WM_PRINTCLIENT
Windows
ANIMATIONINFO structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Describes the animation effects associated with user actions. This structure is used with the
SystemParametersInfo function when the SPI_GETANIMATION or SPI_SETANIMATION action value is specified.

Syntax
typedef struct tagANIMATIONINFO {
UINT cbSize;
int iMinAnimate;
} ANIMATIONINFO, *LPANIMATIONINFO;

Members
cbSize

The size of the structure, in bytes. The caller must set this to sizeof(ANIMATIONINFO) .
iMinAnimate

If this member is nonzero, minimize and restore animation is enabled; otherwise it is disabled.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
SystemParametersInfo
AnyPopup function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Indicates whether an owned, visible, top-level pop-up, or overlapped window exists on the screen. The function
searches the entire screen, not just the calling application's client area.
This function is provided only for compatibility with 16-bit versions of Windows. It is generally not useful.

Syntax
BOOL AnyPopup();

Parameters
This function has no parameters.

Return value
Type: BOOL
If a pop-up window exists, the return value is nonzero, even if the pop-up window is completely covered by
other windows.
If a pop-up window does not exist, the return value is zero.

Remarks
This function does not detect unowned pop-up windows or windows that do not have the WS_VISIBLE style bit
set.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
Conceptual
GetLastActivePopup
Reference
ShowOwnedPopups
Windows
ArrangeIconicWindows function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Arranges all the minimized (iconic) child windows of the specified parent window.

Syntax
UINT ArrangeIconicWindows(
HWND hWnd
);

Parameters
hWnd

Type: HWND
A handle to the parent window.

Return value
Type: UINT
If the function succeeds, the return value is the height of one row of icons.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
An application that maintains its own minimized child windows can use the ArrangeIconicWindows function
to arrange icons in a parent window. This function can also arrange icons on the desktop. To retrieve the window
handle to the desktop window, use the GetDesktopWindow function.
An application sends the WM_MDIICONARRANGE message to the multiple-document interface (MDI) client
window to prompt the client window to arrange its minimized MDI child windows.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib
DLL User32.dll

See also
CloseWindow
Conceptual
GetDesktopWindow
Reference
Windows
AUDIODESCRIPTION structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains information associated with audio descriptions. This structure is used with the SystemParametersInfo
function when the SPI_GETAUDIODESCRIPTION or SPI_SETAUDIODESCRIPTION action value is specified.

Syntax
typedef struct tagAUDIODESCRIPTION {
UINT cbSize;
BOOL Enabled;
LCID Locale;
} AUDIODESCRIPTION, *LPAUDIODESCRIPTION;

Members
cbSize

The size of the structure, in bytes. The caller must set this member to sizeof(AUDIODESCRIPTION) .
Enabled

If this member is TRUE , audio descriptions are enabled; Otherwise, this member is FALSE .
Locale

The locale identifier (LCID) of the language for the audio description. For more information, see Locales and
Languages.

Remarks
To compile an application that uses this structure, define _WIN32_WINNT as 0x0600 or later. For more
information, see Using the Windows Headers.

Requirements

Minimum suppor ted client Windows Vista [desktop apps only]

Minimum suppor ted ser ver Windows Server 2008 [desktop apps only]

Header winuser.h (include Windows.h)

See also
SystemParametersInfo
BeginDeferWindowPos function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Allocates memory for a multiple-window- position structure and returns the handle to the structure.

Syntax
HDWP BeginDeferWindowPos(
int nNumWindows
);

Parameters
nNumWindows

Type: int
The initial number of windows for which to store position information. The DeferWindowPos function increases
the size of the structure, if necessary.

Return value
Type: HDWP
If the function succeeds, the return value identifies the multiple-window-position structure. If insufficient system
resources are available to allocate the structure, the return value is NULL . To get extended error information, call
GetLastError.

Remarks
The multiple-window-position structure is an internal structure; an application cannot access it directly.
DeferWindowPos fills the multiple-window-position structure with information about the target position for one
or more windows about to be moved. The EndDeferWindowPos function accepts the handle to this structure and
repositions the windows by using the information stored in the structure.
If any of the windows in the multiple-window- position structure have the SWP_HIDEWINDOW or
SWP_SHOWWINDOW flag set, none of the windows are repositioned.
If the system must increase the size of the multiple-window- position structure beyond the initial size specified
by the nNumWindows parameter but cannot allocate enough memory to do so, the system fails the entire
window positioning sequence (BeginDeferWindowPos , DeferWindowPos, and EndDeferWindowPos). By
specifying the maximum size needed, an application can detect and process failure early in the process.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]
Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows


10, version 10.0.14393)

See also
Conceptual
DeferWindowPos
EndDeferWindowPos
Reference
SetWindowPos
Windows
BringWindowToTop function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Brings the specified window to the top of the Z order. If the window is a top-level window, it is activated. If the
window is a child window, the top-level parent window associated with the child window is activated.

Syntax
BOOL BringWindowToTop(
HWND hWnd
);

Parameters
hWnd

Type: HWND
A handle to the window to bring to the top of the Z order.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
Use the BringWindowToTop function to uncover any window that is partially or completely obscured by other
windows.
Calling this function is similar to calling the SetWindowPos function to change a window's position in the Z
order. BringWindowToTop does not make a window a top-level window.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib
DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
Reference
SetWindowPos
Windows
BroadcastSystemMessage function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Sends a message to the specified recipients. The recipients can be applications, installable drivers, network
drivers, system-level device drivers, or any combination of these system components.
To receive additional information if the request is defined, use the BroadcastSystemMessageEx function.

Syntax
long BroadcastSystemMessage(
DWORD flags,
LPDWORD lpInfo,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);

Parameters
flags

Type: DWORD
The broadcast option. This parameter can be one or more of the following values.

VA L UE M EA N IN G

Enables the recipient to set the foreground window while


BSF_ALLOWSFW processing the message.
0x00000080

Flushes the disk after each recipient processes the message.


BSF_FLUSHDISK
0x00000004

Continues to broadcast the message, even if the time-out


BSF_FORCEIFHUNG period elapses or one of the recipients is not responding.
0x00000020

Does not send the message to windows that belong to the


BSF_IGNORECURRENTTASK current task. This prevents an application from receiving its
0x00000002 own message.

Forces a nonresponsive application to time out. If one of the


BSF_NOHANG recipients times out, do not continue broadcasting the
0x00000008 message.

Waits for a response to the message, as long as the recipient


BSF_NOTIMEOUTIFNOTHUNG is not being unresponsive. Does not time out.
0x00000040
Posts the message. Do not use in combination with
BSF_POSTMESSAGE BSF_QUERY .
0x00000010

Sends the message to one recipient at a time, sending to a


BSF_QUERY subsequent recipient only if the current recipient returns
0x00000001 TRUE .

Sends the message using SendNotifyMessage function. Do


BSF_SENDNOTIFYMESSAGE not use in combination with BSF_QUERY .
0x00000100

lpInfo

Type: LPDWORD
A pointer to a variable that contains and receives information about the recipients of the message.
When the function returns, this variable receives a combination of these values identifying which recipients
actually received the message.
If this parameter is NULL , the function broadcasts to all components.
This parameter can be one or more of the following values.

VA L UE M EA N IN G

Broadcast to all system components.


BSM_ALLCOMPONENTS
0x00000000

Broadcast to all desktops. Requires the SE_TCB_NAME


BSM_ALLDESKTOPS privilege.
0x00000010

Broadcast to applications.
BSM_APPLICATIONS
0x00000008

Msg

Type: UINT
The message to be sent.
For lists of the system-provided messages, see System-Defined Messages.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.
Return value
Type: long
If the function succeeds, the return value is a positive value.
If the function is unable to broadcast the message, the return value is –1.
If the dwFlags parameter is BSF_QUERY and at least one recipient returned BROADCAST_QUERY_DENY to
the corresponding message, the return value is zero. To get extended error information, call GetLastError.

Remarks
If BSF_QUERY is not specified, the function sends the specified message to all requested recipients, ignoring
values returned by those recipients.
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other
messages (those >= WM_USER ) to another process, you must do custom marshalling.
Examples
For an example, see Terminating a Process.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
BroadcastSystemMessageEx
Conceptual
Messages and Message Queues
Reference
SendNotifyMessage
BroadcastSystemMessageExA function (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Sends a message to the specified recipients. The recipients can be applications, installable drivers, network
drivers, system-level device drivers, or any combination of these system components.
This function is similar to BroadcastSystemMessage except that this function can return more information from
the recipients.

Syntax
long BroadcastSystemMessageExA(
DWORD flags,
LPDWORD lpInfo,
UINT Msg,
WPARAM wParam,
LPARAM lParam,
PBSMINFO pbsmInfo
);

Parameters
flags

Type: DWORD
The broadcast option. This parameter can be one or more of the following values.

VA L UE M EA N IN G

Enables the recipient to set the foreground window while


BSF_ALLOWSFW processing the message.
0x00000080

Flushes the disk after each recipient processes the message.


BSF_FLUSHDISK
0x00000004

Continues to broadcast the message, even if the time-out


BSF_FORCEIFHUNG period elapses or one of the recipients is not responding.
0x00000020

Does not send the message to windows that belong to the


BSF_IGNORECURRENTTASK current task. This prevents an application from receiving its
0x00000002 own message.

If BSF_LUID is set, the message is sent to the window that


BSF_LUID has the same LUID as specified in the luid member of the
0x00000400 BSMINFO structure.
Windows 2000: This flag is not supported.
Forces a nonresponsive application to time out. If one of the
BSF_NOHANG recipients times out, do not continue broadcasting the
0x00000008 message.

Waits for a response to the message, as long as the recipient


BSF_NOTIMEOUTIFNOTHUNG is not being unresponsive. Does not time out.
0x00000040

Posts the message. Do not use in combination with


BSF_POSTMESSAGE BSF_QUERY .
0x00000010

If access is denied and both this and BSF_QUERY are set,


BSF_RETURNHDESK BSMINFO returns both the desktop handle and the window
0x00000200 handle. If access is denied and only BSF_QUERY is set, only
the window handle is returned by BSMINFO .
Windows 2000: This flag is not supported.

Sends the message to one recipient at a time, sending to a


BSF_QUERY subsequent recipient only if the current recipient returns
0x00000001 TRUE .

Sends the message using SendNotifyMessage function. Do


BSF_SENDNOTIFYMESSAGE not use in combination with BSF_QUERY .
0x00000100

lpInfo

Type: LPDWORD
A pointer to a variable that contains and receives information about the recipients of the message.
When the function returns, this variable receives a combination of these values identifying which recipients
actually received the message.
If this parameter is NULL , the function broadcasts to all components.
This parameter can be one or more of the following values.

VA L UE M EA N IN G

Broadcast to all system components.


BSM_ALLCOMPONENTS
0x00000000

Broadcast to all desktops. Requires the SE_TCB_NAME


BSM_ALLDESKTOPS privilege.
0x00000010

Broadcast to applications.
BSM_APPLICATIONS
0x00000008

Msg

Type: UINT
The message to be sent.
For lists of the system-provided messages, see System-Defined Messages.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.
pbsmInfo

Type: PBSMINFO
A pointer to a BSMINFO structure that contains additional information if the request is denied and dwFlags is set
to BSF_QUERY .

Return value
Type: long
If the function succeeds, the return value is a positive value.
If the function is unable to broadcast the message, the return value is –1.
If the dwFlags parameter is BSF_QUERY and at least one recipient returned BROADCAST_QUERY_DENY to
the corresponding message, the return value is zero. To get extended error information, call GetLastError.

Remarks
If BSF_QUERY is not specified, the function sends the specified message to all requested recipients, ignoring
values returned by those recipients.
If the caller's thread is on a desktop other than that of the window that denied the request, the caller must call
SetThreadDesktop(hdesk) to query anything on that window. Also, the caller must call CloseDesktop on the
returned hdesk handle.
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other
messages (those >= WM_USER ) to another process, you must do custom marshalling.

NOTE
The winuser.h header defines BroadcastSystemMessageEx as an alias which automatically selects the ANSI or Unicode
version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-
neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For
more information, see Conventions for Function Prototypes.

Requirements
Minimum suppor ted client Windows XP [desktop apps only]

Minimum suppor ted ser ver Windows Server 2003 [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
BSMINFO
BroadcastSystemMessage
Conceptual
Messages and Message Queues
Reference
SendNotifyMessage
BroadcastSystemMessageExW function (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Sends a message to the specified recipients. The recipients can be applications, installable drivers, network
drivers, system-level device drivers, or any combination of these system components.
This function is similar to BroadcastSystemMessage except that this function can return more information from
the recipients.

Syntax
long BroadcastSystemMessageExW(
DWORD flags,
LPDWORD lpInfo,
UINT Msg,
WPARAM wParam,
LPARAM lParam,
PBSMINFO pbsmInfo
);

Parameters
flags

Type: DWORD
The broadcast option. This parameter can be one or more of the following values.

VA L UE M EA N IN G

Enables the recipient to set the foreground window while


BSF_ALLOWSFW processing the message.
0x00000080

Flushes the disk after each recipient processes the message.


BSF_FLUSHDISK
0x00000004

Continues to broadcast the message, even if the time-out


BSF_FORCEIFHUNG period elapses or one of the recipients is not responding.
0x00000020

Does not send the message to windows that belong to the


BSF_IGNORECURRENTTASK current task. This prevents an application from receiving its
0x00000002 own message.

If BSF_LUID is set, the message is sent to the window that


BSF_LUID has the same LUID as specified in the luid member of the
0x00000400 BSMINFO structure.
Windows 2000: This flag is not supported.
Forces a nonresponsive application to time out. If one of the
BSF_NOHANG recipients times out, do not continue broadcasting the
0x00000008 message.

Waits for a response to the message, as long as the recipient


BSF_NOTIMEOUTIFNOTHUNG is not being unresponsive. Does not time out.
0x00000040

Posts the message. Do not use in combination with


BSF_POSTMESSAGE BSF_QUERY .
0x00000010

If access is denied and both this and BSF_QUERY are set,


BSF_RETURNHDESK BSMINFO returns both the desktop handle and the window
0x00000200 handle. If access is denied and only BSF_QUERY is set, only
the window handle is returned by BSMINFO .
Windows 2000: This flag is not supported.

Sends the message to one recipient at a time, sending to a


BSF_QUERY subsequent recipient only if the current recipient returns
0x00000001 TRUE .

Sends the message using SendNotifyMessage function. Do


BSF_SENDNOTIFYMESSAGE not use in combination with BSF_QUERY .
0x00000100

lpInfo

Type: LPDWORD
A pointer to a variable that contains and receives information about the recipients of the message.
When the function returns, this variable receives a combination of these values identifying which recipients
actually received the message.
If this parameter is NULL , the function broadcasts to all components.
This parameter can be one or more of the following values.

VA L UE M EA N IN G

Broadcast to all system components.


BSM_ALLCOMPONENTS
0x00000000

Broadcast to all desktops. Requires the SE_TCB_NAME


BSM_ALLDESKTOPS privilege.
0x00000010

Broadcast to applications.
BSM_APPLICATIONS
0x00000008

Msg

Type: UINT
The message to be sent.
For lists of the system-provided messages, see System-Defined Messages.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.
pbsmInfo

Type: PBSMINFO
A pointer to a BSMINFO structure that contains additional information if the request is denied and dwFlags is set
to BSF_QUERY .

Return value
Type: long
If the function succeeds, the return value is a positive value.
If the function is unable to broadcast the message, the return value is –1.
If the dwFlags parameter is BSF_QUERY and at least one recipient returned BROADCAST_QUERY_DENY to
the corresponding message, the return value is zero. To get extended error information, call GetLastError.

Remarks
If BSF_QUERY is not specified, the function sends the specified message to all requested recipients, ignoring
values returned by those recipients.
If the caller's thread is on a desktop other than that of the window that denied the request, the caller must call
SetThreadDesktop(hdesk) to query anything on that window. Also, the caller must call CloseDesktop on the
returned hdesk handle.
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other
messages (those >= WM_USER ) to another process, you must do custom marshalling.

NOTE
The winuser.h header defines BroadcastSystemMessageEx as an alias which automatically selects the ANSI or Unicode
version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-
neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For
more information, see Conventions for Function Prototypes.

Requirements
Minimum suppor ted client Windows XP [desktop apps only]

Minimum suppor ted ser ver Windows Server 2003 [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
BSMINFO
BroadcastSystemMessage
Conceptual
Messages and Message Queues
Reference
SendNotifyMessage
BroadcastSystemMessageW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Sends a message to the specified recipients. The recipients can be applications, installable drivers, network
drivers, system-level device drivers, or any combination of these system components.
To receive additional information if the request is defined, use the BroadcastSystemMessageEx function.

Syntax
long BroadcastSystemMessageW(
DWORD flags,
LPDWORD lpInfo,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);

Parameters
flags

Type: DWORD
The broadcast option. This parameter can be one or more of the following values.

VA L UE M EA N IN G

Enables the recipient to set the foreground window while


BSF_ALLOWSFW processing the message.
0x00000080

Flushes the disk after each recipient processes the message.


BSF_FLUSHDISK
0x00000004

Continues to broadcast the message, even if the time-out


BSF_FORCEIFHUNG period elapses or one of the recipients is not responding.
0x00000020

Does not send the message to windows that belong to the


BSF_IGNORECURRENTTASK current task. This prevents an application from receiving its
0x00000002 own message.

Forces a nonresponsive application to time out. If one of the


BSF_NOHANG recipients times out, do not continue broadcasting the
0x00000008 message.

Waits for a response to the message, as long as the recipient


BSF_NOTIMEOUTIFNOTHUNG is not being unresponsive. Does not time out.
0x00000040
Posts the message. Do not use in combination with
BSF_POSTMESSAGE BSF_QUERY .
0x00000010

Sends the message to one recipient at a time, sending to a


BSF_QUERY subsequent recipient only if the current recipient returns
0x00000001 TRUE .

Sends the message using SendNotifyMessage function. Do


BSF_SENDNOTIFYMESSAGE not use in combination with BSF_QUERY .
0x00000100

lpInfo

Type: LPDWORD
A pointer to a variable that contains and receives information about the recipients of the message.
When the function returns, this variable receives a combination of these values identifying which recipients
actually received the message.
If this parameter is NULL , the function broadcasts to all components.
This parameter can be one or more of the following values.

VA L UE M EA N IN G

Broadcast to all system components.


BSM_ALLCOMPONENTS
0x00000000

Broadcast to all desktops. Requires the SE_TCB_NAME


BSM_ALLDESKTOPS privilege.
0x00000010

Broadcast to applications.
BSM_APPLICATIONS
0x00000008

Msg

Type: UINT
The message to be sent.
For lists of the system-provided messages, see System-Defined Messages.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.
Return value
Type: long
If the function succeeds, the return value is a positive value.
If the function is unable to broadcast the message, the return value is –1.
If the dwFlags parameter is BSF_QUERY and at least one recipient returned BROADCAST_QUERY_DENY to
the corresponding message, the return value is zero. To get extended error information, call GetLastError.

Remarks
If BSF_QUERY is not specified, the function sends the specified message to all requested recipients, ignoring
values returned by those recipients.
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other
messages (those >= WM_USER ) to another process, you must do custom marshalling.
Examples
For an example, see Terminating a Process.

NOTE
The winuser.h header defines BroadcastSystemMessage as an alias which automatically selects the ANSI or Unicode
version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-
neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For
more information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
BroadcastSystemMessageEx
Conceptual
Messages and Message Queues
Reference
SendNotifyMessage
BSMINFO structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains information about a window that denied a request from BroadcastSystemMessageEx.

Syntax
typedef struct {
UINT cbSize;
HDESK hdesk;
HWND hwnd;
LUID luid;
} BSMINFO, *PBSMINFO;

Members
cbSize

Type: UINT
The size, in bytes, of this structure.
hdesk

Type: HDESK
A desktop handle to the window specified by hwnd . This value is returned only if BroadcastSystemMessageEx
specifies BSF_RETURNHDESK and BSF_QUERY .
hwnd

Type: HWND
A handle to the window that denied the request. This value is returned if BroadcastSystemMessageEx specifies
BSF_QUERY .
luid

Type: LUID
A locally unique identifier (LUID) for the window.

Requirements

Minimum suppor ted client Windows XP [desktop apps only]

Minimum suppor ted ser ver Windows Server 2003 [desktop apps only]

Header winuser.h (include Windows.h)


See also
BroadcastSystemMessageEx
Conceptual
Messages and Message Queues
Reference
CalculatePopupWindowPosition function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Calculates an appropriate pop-up window position using the specified anchor point, pop-up window size, flags,
and the optional exclude rectangle. When the specified pop-up window size is smaller than the desktop window
size, use the CalculatePopupWindowPosition function to ensure that the pop-up window is fully visible on
the desktop window, regardless of the specified anchor point.

Syntax
BOOL CalculatePopupWindowPosition(
const POINT *anchorPoint,
const SIZE *windowSize,
UINT flags,
RECT *excludeRect,
RECT *popupWindowPosition
);

Parameters
anchorPoint

Type: const POINT*


The specified anchor point.
windowSize

Type: const SIZE*


The specified window size.
flags

Type: UINT
Use one of the following flags to specify how the function positions the pop-up window horizontally and
vertically. The flags are the same as the vertical and horizontal positioning flags of the TrackPopupMenuEx
function.
Use one of the following flags to specify how the function positions the pop-up window horizontally.

VA L UE M EA N IN G

Centers pop-up window horizontally relative to the


TPM_CENTERALIGN coordinate specified by the anchorPoint->x parameter.
0x0004L

Positions the pop-up window so that its left edge is aligned


TPM_LEFTALIGN with the coordinate specified by the anchorPoint->x
0x0000L parameter.
Positions the pop-up window so that its right edge is aligned
TPM_RIGHTALIGN with the coordinate specified by the anchorPoint->x
0x0008L parameter.

Uses one of the following flags to specify how the function positions the pop-up window vertically.

VA L UE M EA N IN G

Positions the pop-up window so that its bottom edge is


TPM_BOTTOMALIGN aligned with the coordinate specified by the anchorPoint->y
0x0020L parameter.

Positions the pop-up window so that its top edge is aligned


TPM_TOPALIGN with the coordinate specified by the anchorPoint->y
0x0000L parameter.

Centers the pop-up window vertically relative to the


TPM_VCENTERALIGN coordinate specified by the anchorPoint->y parameter.
0x0010L

Use one of the following flags to specify whether to accommodate horizontal or vertical alignment.

VA L UE M EA N IN G

If the pop-up window cannot be shown at the specified


TPM_HORIZONTAL location without overlapping the excluded rectangle, the
0x0000L system tries to accommodate the requested horizontal
alignment before the requested vertical alignment.

If the pop-up window cannot be shown at the specified


TPM_VERTICAL location without overlapping the excluded rectangle, the
0x0040L system tries to accommodate the requested vertical
alignment before the requested horizontal alignment.

The following flag is available starting with Windows 7.

VA L UE M EA N IN G

Restricts the pop-up window to within the work area. If this


TPM_WORKAREA flag is not set, the pop-up window is restricted to the work
0x10000L area only if the input point is within the work area. For more
information, see the rcWork and rcMonitor members of
the MONITORINFO structure.

excludeRect

Type: RECT *
A pointer to a structure that specifies the exclude rectangle. It can be NULL .
popupWindowPosition

Type: RECT *
A pointer to a structure that specifies the pop-up window position.

Return value
Type: BOOL
If the function succeeds, it returns TRUE ; otherwise, it returns FALSE . To get extended error information, call
GetLastError.

Remarks
TPM_WORKAREA is supported for the TrackPopupMenu and TrackPopupMenuEx functions.

Requirements

Minimum suppor ted client Windows 7 [desktop apps only]

Minimum suppor ted ser ver Windows Server 2008 R2 [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
Reference
TrackPopupMenu
TrackPopupMenuEx
CallMsgFilterA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Passes the specified message and hook code to the hook procedures associated with the WH_SYSMSGFILTER
and WH_MSGFILTER hooks. A WH_SYSMSGFILTER or WH_MSGFILTER hook procedure is an application-
defined callback function that examines and, optionally, modifies messages for a dialog box, message box, menu,
or scroll bar.

Syntax
BOOL CallMsgFilterA(
LPMSG lpMsg,
int nCode
);

Parameters
lpMsg

Type: LPMSG
A pointer to an MSG structure that contains the message to be passed to the hook procedures.
nCode

Type: int
An application-defined code used by the hook procedure to determine how to process the message. The code
must not have the same value as system-defined hook codes (MSGF_ and HC_) associated with the
WH_SYSMSGFILTER and WH_MSGFILTER hooks.

Return value
Type: BOOL
If the application should process the message further, the return value is zero.
If the application should not process the message further, the return value is nonzero.

Remarks
The system calls CallMsgFilter to enable applications to examine and control the flow of messages during
internal processing of dialog boxes, message boxes, menus, and scroll bars, or when the user activates a
different window by pressing the ALT+TAB key combination.
Install this hook procedure by using the SetWindowsHookEx function.
Examples
For an example, see WH_MSGFILTER and WH_SYSMSGFILTER Hooks.
NOTE
The winuser.h header defines CallMsgFilter as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
Hooks
MSG
MessageProc
Reference
SetWindowsHookEx
SysMsgProc
CallMsgFilterW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Passes the specified message and hook code to the hook procedures associated with the WH_SYSMSGFILTER
and WH_MSGFILTER hooks. A WH_SYSMSGFILTER or WH_MSGFILTER hook procedure is an application-
defined callback function that examines and, optionally, modifies messages for a dialog box, message box, menu,
or scroll bar.

Syntax
BOOL CallMsgFilterW(
LPMSG lpMsg,
int nCode
);

Parameters
lpMsg

Type: LPMSG
A pointer to an MSG structure that contains the message to be passed to the hook procedures.
nCode

Type: int
An application-defined code used by the hook procedure to determine how to process the message. The code
must not have the same value as system-defined hook codes (MSGF_ and HC_) associated with the
WH_SYSMSGFILTER and WH_MSGFILTER hooks.

Return value
Type: BOOL
If the application should process the message further, the return value is zero.
If the application should not process the message further, the return value is nonzero.

Remarks
The system calls CallMsgFilter to enable applications to examine and control the flow of messages during
internal processing of dialog boxes, message boxes, menus, and scroll bars, or when the user activates a
different window by pressing the ALT+TAB key combination.
Install this hook procedure by using the SetWindowsHookEx function.
Examples
For an example, see WH_MSGFILTER and WH_SYSMSGFILTER Hooks.
NOTE
The winuser.h header defines CallMsgFilter as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
Hooks
MSG
MessageProc
Reference
SetWindowsHookEx
SysMsgProc
CallNextHookEx function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Passes the hook information to the next hook procedure in the current hook chain. A hook procedure can call
this function either before or after processing the hook information.

Syntax
LRESULT CallNextHookEx(
HHOOK hhk,
int nCode,
WPARAM wParam,
LPARAM lParam
);

Parameters
hhk

Type: HHOOK
This parameter is ignored.
nCode

Type: int
The hook code passed to the current hook procedure. The next hook procedure uses this code to determine how
to process the hook information.
wParam

Type: WPARAM
The wParam value passed to the current hook procedure. The meaning of this parameter depends on the type of
hook associated with the current hook chain.
lParam

Type: LPARAM
The lParam value passed to the current hook procedure. The meaning of this parameter depends on the type of
hook associated with the current hook chain.

Return value
Type: LRESULT
This value is returned by the next hook procedure in the chain. The current hook procedure must also return this
value. The meaning of the return value depends on the hook type. For more information, see the descriptions of
the individual hook procedures.

Remarks
Hook procedures are installed in chains for particular hook types. CallNextHookEx calls the next hook in the
chain.
Calling CallNextHookEx is optional, but it is highly recommended; otherwise, other applications that have
installed hooks will not receive hook notifications and may behave incorrectly as a result. You should call
CallNextHookEx unless you absolutely need to prevent the notification from being seen by other applications.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
Hooks
Reference
SetWindowsHookEx
UnhookWindowsHookEx
CallWindowProcA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Passes message information to the specified window procedure.

Syntax
LRESULT CallWindowProcA(
WNDPROC lpPrevWndFunc,
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);

Parameters
lpPrevWndFunc

Type: WNDPROC
The previous window procedure. If this value is obtained by calling the GetWindowLong function with the
nIndex parameter set to GWL_WNDPROC or DWL_DLGPROC , it is actually either the address of a window or
dialog box procedure, or a special internal value meaningful only to CallWindowProc .
hWnd

Type: HWND
A handle to the window procedure to receive the message.
Msg

Type: UINT
The message.
wParam

Type: WPARAM
Additional message-specific information. The contents of this parameter depend on the value of the Msg
parameter.
lParam

Type: LPARAM
Additional message-specific information. The contents of this parameter depend on the value of the Msg
parameter.

Return value
Type: LRESULT
The return value specifies the result of the message processing and depends on the message sent.

Remarks
Use the CallWindowProc function for window subclassing. Usually, all windows with the same class share one
window procedure. A subclass is a window or set of windows with the same class whose messages are
intercepted and processed by another window procedure (or procedures) before being passed to the window
procedure of the class.
The SetWindowLong function creates the subclass by changing the window procedure associated with a
particular window, causing the system to call the new window procedure instead of the previous one. An
application must pass any messages not processed by the new window procedure to the previous window
procedure by calling CallWindowProc . This allows the application to create a chain of window procedures.
If STRICT is defined, the lpPrevWndFunc parameter has the data type WNDPROC . The WNDPROC type is
declared as follows:

LRESULT (CALLBACK* WNDPROC) (HWND, UINT, WPARAM, LPARAM);

If STRICT is not defined, the lpPrevWndFunc parameter has the data type FARPROC . The FARPROC type is
declared as follows:

int (FAR WINAPI * FARPROC) ()

In C, the FARPROC declaration indicates a callback function that has an unspecified parameter list. In C++,
however, the empty parameter list in the declaration indicates that a function has no parameters. This subtle
distinction can break careless code. Following is one way to handle this situation:

#ifdef STRICT
WNDPROC MyWindowProcedure
#else
FARPROC MyWindowProcedure
#endif
...
lResult = CallWindowProc(MyWindowProcedure, ...) ;

For further information about functions declared with empty argument lists, refer to
The C++ Programming Language, Second Edition, by Bjarne Stroustrup.
The CallWindowProc function handles Unicode-to-ANSI conversion. You cannot take advantage of this
conversion if you call the window procedure directly.
Examples
For an example, see Subclassing a Window

NOTE
The winuser.h header defines CallWindowProc as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements
Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows


10, version 10.0.14393)

See also
Conceptual
GetWindowLong
Reference
SetClassLong
SetWindowLong
Window Procedures
CallWindowProcW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Passes message information to the specified window procedure.

Syntax
LRESULT CallWindowProcW(
WNDPROC lpPrevWndFunc,
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);

Parameters
lpPrevWndFunc

Type: WNDPROC
The previous window procedure. If this value is obtained by calling the GetWindowLong function with the
nIndex parameter set to GWL_WNDPROC or DWL_DLGPROC , it is actually either the address of a window or
dialog box procedure, or a special internal value meaningful only to CallWindowProc .
hWnd

Type: HWND
A handle to the window procedure to receive the message.
Msg

Type: UINT
The message.
wParam

Type: WPARAM
Additional message-specific information. The contents of this parameter depend on the value of the Msg
parameter.
lParam

Type: LPARAM
Additional message-specific information. The contents of this parameter depend on the value of the Msg
parameter.

Return value
Type: LRESULT
The return value specifies the result of the message processing and depends on the message sent.

Remarks
Use the CallWindowProc function for window subclassing. Usually, all windows with the same class share one
window procedure. A subclass is a window or set of windows with the same class whose messages are
intercepted and processed by another window procedure (or procedures) before being passed to the window
procedure of the class.
The SetWindowLong function creates the subclass by changing the window procedure associated with a
particular window, causing the system to call the new window procedure instead of the previous one. An
application must pass any messages not processed by the new window procedure to the previous window
procedure by calling CallWindowProc . This allows the application to create a chain of window procedures.
If STRICT is defined, the lpPrevWndFunc parameter has the data type WNDPROC . The WNDPROC type is
declared as follows:

LRESULT (CALLBACK* WNDPROC) (HWND, UINT, WPARAM, LPARAM);

If STRICT is not defined, the lpPrevWndFunc parameter has the data type FARPROC . The FARPROC type is
declared as follows:

int (FAR WINAPI * FARPROC) ()

In C, the FARPROC declaration indicates a callback function that has an unspecified parameter list. In C++,
however, the empty parameter list in the declaration indicates that a function has no parameters. This subtle
distinction can break careless code. Following is one way to handle this situation:

#ifdef STRICT
WNDPROC MyWindowProcedure
#else
FARPROC MyWindowProcedure
#endif
...
lResult = CallWindowProc(MyWindowProcedure, ...) ;

For further information about functions declared with empty argument lists, refer to
The C++ Programming Language, Second Edition, by Bjarne Stroustrup.
The CallWindowProc function handles Unicode-to-ANSI conversion. You cannot take advantage of this
conversion if you call the window procedure directly.
Examples
For an example, see Subclassing a Window

NOTE
The winuser.h header defines CallWindowProc as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements
Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows


10, version 10.0.14393)

See also
Conceptual
GetWindowLong
Reference
SetClassLong
SetWindowLong
Window Procedures
CascadeWindows function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Cascades the specified child windows of the specified parent window.

Syntax
WORD CascadeWindows(
HWND hwndParent,
UINT wHow,
const RECT *lpRect,
UINT cKids,
const HWND *lpKids
);

Parameters
hwndParent

Type: HWND
A handle to the parent window. If this parameter is NULL , the desktop window is assumed.
wHow

Type: UINT
A cascade flag. This parameter can be one or more of the following values.

VA L UE M EA N IN G

Prevents disabled MDI child windows from being cascaded.


MDITILE_SKIPDISABLED
0x0002

Arranges the windows in Z order. If this value is not specified,


MDITILE_ZORDER the windows are arranged using the order specified in the
0x0004 lpKids array.

lpRect

Type: const RECT *


A pointer to a structure that specifies the rectangular area, in client coordinates, within which the windows are
arranged. This parameter can be NULL , in which case the client area of the parent window is used.
cKids

Type: UINT
The number of elements in the array specified by the lpKids parameter. This parameter is ignored if lpKids is
NULL .
lpKids
Type: const HWND*
An array of handles to the child windows to arrange. If a specified child window is a top-level window with the
style WS_EX_TOPMOST or WS_EX_TOOLWINDOW , the child window is not arranged. If this parameter is
NULL , all child windows of the specified parent window (or of the desktop window) are arranged.

Return value
Type: WORD
If the function succeeds, the return value is the number of windows arranged.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
By default, CascadeWindows arranges the windows in the order provided by the lpKids array, but preserves
the Z-Order. If you specify the MDITILE_ZORDER flag, CascadeWindows arranges the windows in Z order.
Calling CascadeWindows causes all maximized windows to be restored to their previous size.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
Windows Overview
CBT_CREATEWNDA structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains information passed to a WH_CBT hook procedure, CBTProc, before a window is created.

Syntax
typedef struct tagCBT_CREATEWNDA {
struct tagCREATESTRUCTA *lpcs;
HWND hwndInsertAfter;
} CBT_CREATEWNDA, *LPCBT_CREATEWNDA;

Members
lpcs

Type: LPCREATESTRUCT
A pointer to a CREATESTRUCT structure that contains initialization parameters for the window about to be
created.
hwndInsertAfter

Type: HWND
A handle to the window whose position in the Z order precedes that of the window being created. This member
can also be NULL .

Remarks
NOTE
The winuser.h header defines CBT_CREATEWND as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
CBTProc
CREATESTRUCT
Conceptual
Hooks
Reference
SetWindowsHookEx
CBT_CREATEWNDW structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains information passed to a WH_CBT hook procedure, CBTProc, before a window is created.

Syntax
typedef struct tagCBT_CREATEWNDW {
struct tagCREATESTRUCTW *lpcs;
HWND hwndInsertAfter;
} CBT_CREATEWNDW, *LPCBT_CREATEWNDW;

Members
lpcs

Type: LPCREATESTRUCT
A pointer to a CREATESTRUCT structure that contains initialization parameters for the window about to be
created.
hwndInsertAfter

Type: HWND
A handle to the window whose position in the Z order precedes that of the window being created. This member
can also be NULL .

Remarks
NOTE
The winuser.h header defines CBT_CREATEWND as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
CBTProc
CREATESTRUCT
Conceptual
Hooks
Reference
SetWindowsHookEx
CBTACTIVATESTRUCT structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains information passed to a WH_CBT hook procedure, CBTProc, before a window is activated.

Syntax
typedef struct tagCBTACTIVATESTRUCT {
BOOL fMouse;
HWND hWndActive;
} CBTACTIVATESTRUCT, *LPCBTACTIVATESTRUCT;

Members
fMouse

Type: BOOL
This member is TRUE if a mouse click is causing the activation or FALSE if it is not.
hWndActive

Type: HWND
A handle to the active window.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
CBTProc
Conceptual
Hooks
Reference
SetWindowsHookEx
CHANGEFILTERSTRUCT structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains extended result information obtained by calling the ChangeWindowMessageFilterEx function.

Syntax
typedef struct tagCHANGEFILTERSTRUCT {
DWORD cbSize;
DWORD ExtStatus;
} CHANGEFILTERSTRUCT, *PCHANGEFILTERSTRUCT;

Members
cbSize

Type: DWORD
The size of the structure, in bytes. Must be set to sizeof(CHANGEFILTERSTRUCT) , otherwise the function fails with
ERROR_INVALID_PARAMETER .
ExtStatus

Type: DWORD
If the function succeeds, this field contains one of the following values.

VA L UE M EA N IN G

See the Remarks section. Applies to MSGFLT_ALLOW and


MSGFLTINFO_NONE MSGFLT_DISALLOW .
0

The message is allowed at a scope higher than the window.


MSGFLTINFO_ALLOWED_HIGHER Applies to MSGFLT_DISALLOW .
3

The message has already been allowed by this window's


MSGFLTINFO_ALREADYALLOWED_FORWND message filter, and the function thus succeeded with no
1 change to the window's message filter. Applies to
MSGFLT_ALLOW .

The message has already been blocked by this window's


MSGFLTINFO_ALREADYDISALLOWED_FORWND message filter, and the function thus succeeded with no
2 change to the window's message filter. Applies to
MSGFLT_DISALLOW .

Remarks
Certain messages whose value is smaller than WM_USER are required to pass through the filter, regardless of
the filter setting. There will be no effect when you attempt to use this function to allow or block such messages.
An application may use the ChangeWindowMessageFilter function to allow or block a message in a process-
wide manner. If the message is allowed by either the process message filter or the window message filter, it will
be delivered to the window.
The following table lists the possible values returned in ExtStatus .

M ESSA GE A L REA DY M ESSA GE A L REA DY O P ERAT IO N REQ UEST ED IN DIC ATO R RET URN ED IN
A L LO W ED AT H IGH ER SC O P E A L LO W ED B Y W IN DO W 'S EXT STAT US O N SUC C ESS
M ESSA GE F ILT ER

No No MSGFLT_ALLOW MSGFLTINFO_NONE

No No MSGFLT_DISALLOW MSGFLTINFO_ALREADY
DISALLOWED_FORWND

No No MSGFLT_RESET MSGFLTINFO_NONE

No Yes MSGFLT_ALLOW MSGFLTINFO_ALREADY


ALLOWED_FORWND

No Yes MSGFLT_DISALLOW MSGFLTINFO_NONE

No Yes MSGFLT_RESET MSGFLTINFO_NONE

Yes No MSGFLT_ALLOW MSGFLTINFO_NONE

Yes No MSGFLT_DISALLOW MSGFLTINFO_ALLOWED


_HIGHER

Yes No MSGFLT_RESET MSGFLTINFO_NONE

Yes Yes MSGFLT_ALLOW MSGFLTINFO_ALREADY


ALLOWED_FORWND

Yes Yes MSGFLT_DISALLOW MSGFLTINFO_ALLOWED


_HIGHER

Yes Yes MSGFLT_RESET MSGFLTINFO_NONE

Requirements

Minimum suppor ted client Windows 7 [desktop apps only]

Minimum suppor ted ser ver Windows Server 2008 R2 [desktop apps only]

Header winuser.h (include Windows.h)

See also
ChangeWindowMessageFilterEx
ChangeWindowMessageFilter function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

[Using the ChangeWindowMessageFilter function is not recommended, as it has process-wide scope.


Instead, use the ChangeWindowMessageFilterEx function to control access to specific windows as needed.
ChangeWindowMessageFilter may not be supported in future versions of Windows.]
Adds or removes a message from the User Interface Privilege Isolation (UIPI) message filter.

Syntax
BOOL ChangeWindowMessageFilter(
UINT message,
DWORD dwFlag
);

Parameters
message

Type: UINT
The message to add to or remove from the filter.
dwFlag

Type: DWORD
The action to be performed. One of the following values.

VA L UE M EA N IN G

Adds the message to the filter. This has the effect of allowing
MSGFLT_ADD the message to be received.
1

Removes the message from the filter. This has the effect of
MSGFLT_REMOVE blocking the message.
2

Return value
Type: BOOL
TRUE if successful; otherwise, FALSE . To get extended error information, call GetLastError.

Note A message can be successfully removed from the filter, but that is not a guarantee that the message will be blocked.
See the Remarks section for more details.
Remarks
UIPI is a security feature that prevents messages from being received from a lower integrity level sender. All
such messages with a value above WM_USER are blocked by default. The filter, somewhat contrary to intuition,
is a list of messages that are allowed through. Therefore, adding a message to the filter allows that message to
be received from a lower integrity sender, while removing a message blocks that message from being received.
Certain messages with a value less than WM_USER are required to pass through the filter regardless of the
filter setting. You can call this function to remove one of those messages from the filter and it will return TRUE .
However, the message will still be received by the calling process.
Processes at or below SECURITY_MANDATORY_LOW_RID are not allowed to change the filter. If those
processes call this function, it will fail.
For more information on integrity levels, see Understanding and Working in Protected Mode Internet Explorer.

Requirements

Minimum suppor ted client Windows Vista [desktop apps only]

Minimum suppor ted ser ver Windows Server 2008 [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll
ChangeWindowMessageFilterEx function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Modifies the User Interface Privilege Isolation (UIPI) message filter for a specified window.

Syntax
BOOL ChangeWindowMessageFilterEx(
HWND hwnd,
UINT message,
DWORD action,
PCHANGEFILTERSTRUCT pChangeFilterStruct
);

Parameters
hwnd

Type: HWND
A handle to the window whose UIPI message filter is to be modified.
message

Type: UINT
The message that the message filter allows through or blocks.
action

Type: DWORD
The action to be performed, and can take one of the following values:

VA L UE M EA N IN G

Allows the message through the filter. This enables the


MSGFLT_ALLOW message to be received by hWnd, regardless of the source of
1 the message, even it comes from a lower privileged process.

Blocks the message to be delivered to hWnd if it comes from


MSGFLT_DISALLOW a lower privileged process, unless the message is allowed
2 process-wide by using the ChangeWindowMessageFilter
function or globally.

Resets the window message filter for hWnd to the default.


MSGFLT_RESET Any message allowed globally or process-wide will get
0 through, but any message not included in those two
categories, and which comes from a lower privileged process,
will be blocked.

pChangeFilterStruct

Type: PCHANGEFILTERSTRUCT
Optional pointer to a CHANGEFILTERSTRUCT structure.

Return value
Type: BOOL
If the function succeeds, it returns TRUE ; otherwise, it returns FALSE . To get extended error information, call
GetLastError.

Remarks
UIPI is a security feature that prevents messages from being received from a lower-integrity-level sender. You
can use this function to allow specific messages to be delivered to a window even if the message originates
from a process at a lower integrity level. Unlike the ChangeWindowMessageFilter function, which controls the
process message filter, the ChangeWindowMessageFilterEx function controls the window message filter.
An application may use the ChangeWindowMessageFilter function to allow or block a message in a process-
wide manner. If the message is allowed by either the process message filter or the window message filter, it will
be delivered to the window.
Note that processes at or below SECURITY_MANDATORY_LOW_RID are not allowed to change the message
filter. If those processes call this function, it will fail and generate the extended error code,
ERROR_ACCESS_DENIED .
Certain messages whose value is smaller than WM_USER are required to be passed through the filter,
regardless of the filter setting. There will be no effect when you attempt to use this function to allow or block
such messages.

Requirements

Minimum suppor ted client Windows 7 [desktop apps only]

Minimum suppor ted ser ver Windows Server 2008 R2 [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-gui-l1-3-0 (introduced in Windows 10,


version 10.0.10240)

See also
ChangeWindowMessageFilter
Conceptual
Reference
Windows
ChildWindowFromPoint function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Determines which, if any, of the child windows belonging to a parent window contains the specified point. The
search is restricted to immediate child windows. Grandchildren, and deeper descendant windows are not
searched.
To skip certain child windows, use the ChildWindowFromPointEx function.

Syntax
HWND ChildWindowFromPoint(
HWND hWndParent,
POINT Point
);

Parameters
hWndParent

Type: HWND
A handle to the parent window.
Point

Type: POINT
A structure that defines the client coordinates, relative to hWndParent, of the point to be checked.

Return value
Type: HWND
The return value is a handle to the child window that contains the point, even if the child window is hidden or
disabled. If the point lies outside the parent window, the return value is NULL . If the point is within the parent
window but not within any child window, the return value is a handle to the parent window.

Remarks
The system maintains an internal list, containing the handles of the child windows associated with a parent
window. The order of the handles in the list depends on the Z order of the child windows. If more than one child
window contains the specified point, the system returns a handle to the first window in the list that contains the
point.
ChildWindowFromPoint treats an HTTRANSPARENT area of a standard control the same as other parts of
the control. In contrast, RealChildWindowFromPoint treats an HTTRANSPARENT area differently; it returns the
child window behind a transparent area of a control. For example, if the point is in a transparent area of a
groupbox, ChildWindowFromPoint returns the groupbox while RealChildWindowFromPoint returns the
child window behind the groupbox. However, both APIs return a static field, even though it, too, returns
HTTRANSPARENT .
Examples
For an example, see "Creating a Combo Box Toolbar" in Using Combo Boxes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows


10, version 10.0.14393)

See also
ChildWindowFromPointEx
Conceptual
Other Resources
POINT
RealChildWindowFromPoint
Reference
WindowFromPoint
Windows
ChildWindowFromPointEx function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Determines which, if any, of the child windows belonging to the specified parent window contains the specified
point. The function can ignore invisible, disabled, and transparent child windows. The search is restricted to
immediate child windows. Grandchildren and deeper descendants are not searched.

Syntax
HWND ChildWindowFromPointEx(
HWND hwnd,
POINT pt,
UINT flags
);

Parameters
hwnd

Type: HWND
A handle to the parent window.
pt

Type: POINT
A structure that defines the client coordinates (relative to hwndParent) of the point to be checked.
flags

Type: UINT
The child windows to be skipped. This parameter can be one or more of the following values.

VA L UE M EA N IN G

Does not skip any child windows


CWP_ALL
0x0000

Skips disabled child windows


CWP_SKIPDISABLED
0x0002

Skips invisible child windows


CWP_SKIPINVISIBLE
0x0001

Skips transparent child windows


CWP_SKIPTRANSPARENT
0x0004
Return value
Type: HWND
The return value is a handle to the first child window that contains the point and meets the criteria specified by
uFlags. If the point is within the parent window but not within any child window that meets the criteria, the
return value is a handle to the parent window. If the point lies outside the parent window or if the function fails,
the return value is NULL .

Remarks
The system maintains an internal list that contains the handles of the child windows associated with a parent
window. The order of the handles in the list depends on the Z order of the child windows. If more than one child
window contains the specified point, the system returns a handle to the first window in the list that contains the
point and meets the criteria specified by uFlags.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows


10, version 10.0.14393)

See also
Conceptual
Other Resources
POINT
Reference
WindowFromPoint
Windows
CLIENTCREATESTRUCT structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains information about the menu and first multiple-document interface (MDI) child window of an MDI client
window. An application passes a pointer to this structure as the lpParam parameter of the CreateWindow
function when creating an MDI client window.

Syntax
typedef struct tagCLIENTCREATESTRUCT {
HANDLE hWindowMenu;
UINT idFirstChild;
} CLIENTCREATESTRUCT, *LPCLIENTCREATESTRUCT;

Members
hWindowMenu

Type: HANDLE
A handle to the MDI application's window menu. An MDI application can retrieve this handle from the menu of
the MDI frame window by using the GetSubMenu function.
idFirstChild

Type: UINT
The child window identifier of the first MDI child window created. The system increments the identifier for each
additional MDI child window the application creates, and reassigns identifiers when the application destroys a
window to keep the range of identifiers contiguous. These identifiers are used in WM_COMMAND messages
sent to the application's MDI frame window when a child window is chosen from the window menu; they should
not conflict with any other command identifiers.

Remarks
When the MDI client window is created by calling CreateWindow, the system sends a WM_CREATE message to
the window. The lParam parameter of WM_CREATE contains a pointer to a CREATESTRUCT structure. The
lpCreateParams member of this structure contains a pointer to a CLIENTCREATESTRUCT structure.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
About the Multiple Document Interface
Conceptual
CreateWindow
GetSubMenu
MDICREATESTRUCT
Reference
WM_COMMAND
Windows
CloseWindow function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Minimizes (but does not destroy) the specified window.

Syntax
BOOL CloseWindow(
HWND hWnd
);

Parameters
hWnd

Type: HWND
A handle to the window to be minimized.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
To destroy a window, an application must use the DestroyWindow function.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows


10, version 10.0.14393)
See also
ArrangeIconicWindows
Conceptual
DestroyWindow
IsIconic
OpenIcon
Reference
Windows
CreateMDIWindowA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Creates a multiple-document interface (MDI) child window.

Syntax
HWND CreateMDIWindowA(
LPCSTR lpClassName,
LPCSTR lpWindowName,
DWORD dwStyle,
int X,
int Y,
int nWidth,
int nHeight,
HWND hWndParent,
HINSTANCE hInstance,
LPARAM lParam
);

Parameters
lpClassName

Type: LPCTSTR
The window class of the MDI child window. The class name must have been registered by a call to the
RegisterClassEx function.
lpWindowName

Type: LPCTSTR
The window name. The system displays the name in the title bar of the child window.
dwStyle

Type: DWORD
The style of the MDI child window. If the MDI client window is created with the MDIS_ALLCHILDSTYLES
window style, this parameter can be any combination of the window styles listed in the Window Styles page.
Otherwise, this parameter is limited to one or more of the following values.

VA L UE M EA N IN G

Creates an MDI child window that is initially minimized.


WS_MINIMIZE
0x20000000L

Creates an MDI child window that is initially maximized.


WS_MAXIMIZE
0x01000000L
Creates an MDI child window that has a horizontal scroll bar.
WS_HSCROLL
0x00100000L

Creates an MDI child window that has a vertical scroll bar.


WS_VSCROLL
0x00200000L

Type: int
The initial horizontal position, in client coordinates, of the MDI child window. If this parameter is
CW_USEDEFAULT ((int)0x80000000), the MDI child window is assigned the default horizontal position.
Y

Type: int
The initial vertical position, in client coordinates, of the MDI child window. If this parameter is
CW_USEDEFAULT , the MDI child window is assigned the default vertical position.
nWidth

Type: int
The initial width, in device units, of the MDI child window. If this parameter is CW_USEDEFAULT , the MDI child
window is assigned the default width.
nHeight

Type: int
The initial height, in device units, of the MDI child window. If this parameter is set to CW_USEDEFAULT , the MDI
child window is assigned the default height.
hWndParent

Type: HWND
A handle to the MDI client window that will be the parent of the new MDI child window.
hInstance

Type: HINSTANCE
A handle to the instance of the application creating the MDI child window.
lParam

Type: LPARAM
An application-defined value.

Return value
Type: HWND
If the function succeeds, the return value is the handle to the created window.
If the function fails, the return value is NULL . To get extended error information, call GetLastError.
Remarks
NOTE
The winuser.h header defines CreateMDIWindow as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
Conceptual
CreateWindow
Multiple Document Interface
Reference
RegisterClassEx
WM_MDICREATE
CreateMDIWindowW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Creates a multiple-document interface (MDI) child window.

Syntax
HWND CreateMDIWindowW(
LPCWSTR lpClassName,
LPCWSTR lpWindowName,
DWORD dwStyle,
int X,
int Y,
int nWidth,
int nHeight,
HWND hWndParent,
HINSTANCE hInstance,
LPARAM lParam
);

Parameters
lpClassName

Type: LPCTSTR
The window class of the MDI child window. The class name must have been registered by a call to the
RegisterClassEx function.
lpWindowName

Type: LPCTSTR
The window name. The system displays the name in the title bar of the child window.
dwStyle

Type: DWORD
The style of the MDI child window. If the MDI client window is created with the MDIS_ALLCHILDSTYLES
window style, this parameter can be any combination of the window styles listed in the Window Styles page.
Otherwise, this parameter is limited to one or more of the following values.

VA L UE M EA N IN G

Creates an MDI child window that is initially minimized.


WS_MINIMIZE
0x20000000L

Creates an MDI child window that is initially maximized.


WS_MAXIMIZE
0x01000000L
Creates an MDI child window that has a horizontal scroll bar.
WS_HSCROLL
0x00100000L

Creates an MDI child window that has a vertical scroll bar.


WS_VSCROLL
0x00200000L

Type: int
The initial horizontal position, in client coordinates, of the MDI child window. If this parameter is
CW_USEDEFAULT ((int)0x80000000), the MDI child window is assigned the default horizontal position.
Y

Type: int
The initial vertical position, in client coordinates, of the MDI child window. If this parameter is
CW_USEDEFAULT , the MDI child window is assigned the default vertical position.
nWidth

Type: int
The initial width, in device units, of the MDI child window. If this parameter is CW_USEDEFAULT , the MDI child
window is assigned the default width.
nHeight

Type: int
The initial height, in device units, of the MDI child window. If this parameter is set to CW_USEDEFAULT , the MDI
child window is assigned the default height.
hWndParent

Type: HWND
A handle to the MDI client window that will be the parent of the new MDI child window.
hInstance

Type: HINSTANCE
A handle to the instance of the application creating the MDI child window.
lParam

Type: LPARAM
An application-defined value.

Return value
Type: HWND
If the function succeeds, the return value is the handle to the created window.
If the function fails, the return value is NULL . To get extended error information, call GetLastError.
Remarks
NOTE
The winuser.h header defines CreateMDIWindow as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
Conceptual
CreateWindow
Multiple Document Interface
Reference
RegisterClassEx
WM_MDICREATE
CREATESTRUCTA structure (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Defines the initialization parameters passed to the window procedure of an application. These members are
identical to the parameters of the CreateWindowEx function.

Syntax
typedef struct tagCREATESTRUCTA {
LPVOID lpCreateParams;
HINSTANCE hInstance;
HMENU hMenu;
HWND hwndParent;
int cy;
int cx;
int y;
int x;
LONG style;
LPCSTR lpszName;
LPCSTR lpszClass;
DWORD dwExStyle;
} CREATESTRUCTA, *LPCREATESTRUCTA;

Members
lpCreateParams

Type: LPVOID
Contains additional data which may be used to create the window. If the window is being created as a result of a
call to the CreateWindow or CreateWindowEx function, this member contains the value of the lpParam
parameter specified in the function call.
If the window being created is a MDI client window, this member contains a pointer to a CLIENTCREATESTRUCT
structure. If the window being created is a MDI child window, this member contains a pointer to an
MDICREATESTRUCT structure.
If the window is being created from a dialog template, this member is the address of a SHORT value that
specifies the size, in bytes, of the window creation data. The value is immediately followed by the creation data.
For more information, see the following Remarks section.
hInstance

Type: HINSTANCE
A handle to the module that owns the new window.
hMenu

Type: HMENU
A handle to the menu to be used by the new window.
hwndParent

Type: HWND
A handle to the parent window, if the window is a child window. If the window is owned, this member identifies
the owner window. If the window is not a child or owned window, this member is NULL .
cy

Type: int
The height of the new window, in pixels.
cx

Type: int
The width of the new window, in pixels.
y

Type: int
The y-coordinate of the upper left corner of the new window. If the new window is a child window, coordinates
are relative to the parent window. Otherwise, the coordinates are relative to the screen origin.
x

Type: int
The x-coordinate of the upper left corner of the new window. If the new window is a child window, coordinates
are relative to the parent window. Otherwise, the coordinates are relative to the screen origin.
style

Type: LONG
The style for the new window. For a list of possible values, see Window Styles.
lpszName

Type: LPCTSTR
The name of the new window.
lpszClass

Type: LPCTSTR
A pointer to a null-terminated string or an atom that specifies the class name of the new window.
dwExStyle

Type: DWORD
The extended window style for the new window. For a list of possible values, see Extended Window Styles.

Remarks
Because the lpszClass member can contain a pointer to a local (and thus inaccessable) atom, do not obtain the
class name by using this member. Use the GetClassName function instead.
You should access the data represented by the lpCreateParams member using a pointer that has been
declared using the UNALIGNED type, because the pointer may not be DWORD aligned. This is demonstrated
in the following example:
typedef struct tagMyData
{
// Define creation data here.
} MYDATA;

typedef struct tagMyDlgData


{
SHORT cbExtra;
MYDATA myData;
} MYDLGDATA, UNALIGNED *PMYDLGDATA;

PMYDLGDATA pMyDlgdata = (PMYDLGDATA) (((LPCREATESTRUCT) lParam)->lpCreateParams);

NOTE
The winuser.h header defines CREATESTRUCT as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
About the Multiple Document Interface
Conceptual
CreateWindow
CreateWindowEx
MDICREATESTRUCT
Reference
Windows
CREATESTRUCTW structure (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Defines the initialization parameters passed to the window procedure of an application. These members are
identical to the parameters of the CreateWindowEx function.

Syntax
typedef struct tagCREATESTRUCTW {
LPVOID lpCreateParams;
HINSTANCE hInstance;
HMENU hMenu;
HWND hwndParent;
int cy;
int cx;
int y;
int x;
LONG style;
LPCWSTR lpszName;
LPCWSTR lpszClass;
DWORD dwExStyle;
} CREATESTRUCTW, *LPCREATESTRUCTW;

Members
lpCreateParams

Type: LPVOID
Contains additional data which may be used to create the window. If the window is being created as a result of a
call to the CreateWindow or CreateWindowEx function, this member contains the value of the lpParam
parameter specified in the function call.
If the window being created is a MDI client window, this member contains a pointer to a CLIENTCREATESTRUCT
structure. If the window being created is a MDI child window, this member contains a pointer to an
MDICREATESTRUCT structure.
If the window is being created from a dialog template, this member is the address of a SHORT value that
specifies the size, in bytes, of the window creation data. The value is immediately followed by the creation data.
For more information, see the following Remarks section.
hInstance

Type: HINSTANCE
A handle to the module that owns the new window.
hMenu

Type: HMENU
A handle to the menu to be used by the new window.
hwndParent

Type: HWND
A handle to the parent window, if the window is a child window. If the window is owned, this member identifies
the owner window. If the window is not a child or owned window, this member is NULL .
cy

Type: int
The height of the new window, in pixels.
cx

Type: int
The width of the new window, in pixels.
y

Type: int
The y-coordinate of the upper left corner of the new window. If the new window is a child window, coordinates
are relative to the parent window. Otherwise, the coordinates are relative to the screen origin.
x

Type: int
The x-coordinate of the upper left corner of the new window. If the new window is a child window, coordinates
are relative to the parent window. Otherwise, the coordinates are relative to the screen origin.
style

Type: LONG
The style for the new window. For a list of possible values, see Window Styles.
lpszName

Type: LPCTSTR
The name of the new window.
lpszClass

Type: LPCTSTR
A pointer to a null-terminated string or an atom that specifies the class name of the new window.
dwExStyle

Type: DWORD
The extended window style for the new window. For a list of possible values, see Extended Window Styles.

Remarks
Because the lpszClass member can contain a pointer to a local (and thus inaccessable) atom, do not obtain the
class name by using this member. Use the GetClassName function instead.
You should access the data represented by the lpCreateParams member using a pointer that has been
declared using the UNALIGNED type, because the pointer may not be DWORD aligned. This is demonstrated
in the following example:
typedef struct tagMyData
{
// Define creation data here.
} MYDATA;

typedef struct tagMyDlgData


{
SHORT cbExtra;
MYDATA myData;
} MYDLGDATA, UNALIGNED *PMYDLGDATA;

PMYDLGDATA pMyDlgdata = (PMYDLGDATA) (((LPCREATESTRUCT) lParam)->lpCreateParams);

NOTE
The winuser.h header defines CREATESTRUCT as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
About the Multiple Document Interface
Conceptual
CreateWindow
CreateWindowEx
MDICREATESTRUCT
Reference
Windows
CreateWindowA macro (winuser.h)
2/1/2021 • 9 minutes to read • Edit Online

Creates an overlapped, pop-up, or child window. It specifies the window class, window title, window style, and
(optionally) the initial position and size of the window. The function also specifies the window's parent or owner,
if any, and the window's menu.
To use extended window styles in addition to the styles supported by CreateWindow , use the CreateWindowEx
function.

Syntax
void CreateWindowA(
lpClassName,
lpWindowName,
dwStyle,
x,
y,
nWidth,
nHeight,
hWndParent,
hMenu,
hInstance,
lpParam
);

Parameters
lpClassName

Type: LPCTSTR
A null -terminated string or a class atom created by a previous call to the RegisterClass or RegisterClassEx
function. The atom must be in the low-order word of lpClassName; the high-order word must be zero. If
lpClassName is a string, it specifies the window class name. The class name can be any name registered with
RegisterClass or RegisterClassEx , provided that the module that registers the class is also the module that
creates the window. The class name can also be any of the predefined system class names. For a list of system
class names, see the Remarks section.
lpWindowName

Type: LPCTSTR
The window name. If the window style specifies a title bar, the window title pointed to by lpWindowName is
displayed in the title bar. When using CreateWindow to create controls, such as buttons, check boxes, and static
controls, use lpWindowName to specify the text of the control. When creating a static control with the SS_ICON
style, use lpWindowName to specify the icon name or identifier. To specify an identifier, use the syntax "#num".
dwStyle

Type: DWORD
The style of the window being created. This parameter can be a combination of the window style values, plus the
control styles indicated in the Remarks section.
x

Type: int
The initial horizontal position of the window. For an overlapped or pop-up window, the x parameter is the initial
x-coordinate of the window's upper-left corner, in screen coordinates. For a child window, x is the x-coordinate of
the upper-left corner of the window relative to the upper-left corner of the parent window's client area. If this
parameter is set to CW_USEDEFAULT , the system selects the default position for the window's upper-left
corner and ignores the y parameter. CW_USEDEFAULT is valid only for overlapped windows; if it is specified
for a pop-up or child window, the x and y parameters are set to zero.
y

Type: int
The initial vertical position of the window. For an overlapped or pop-up window, the y parameter is the initial y-
coordinate of the window's upper-left corner, in screen coordinates. For a child window, y is the initial y-
coordinate of the upper-left corner of the child window relative to the upper-left corner of the parent window's
client area. For a list box, y is the initial y-coordinate of the upper-left corner of the list box's client area relative
to the upper-left corner of the parent window's client area.
If an overlapped window is created with the WS_VISIBLE style bit set and the x parameter is set to
CW_USEDEFAULT , then the y parameter determines how the window is shown. If the y parameter is
CW_USEDEFAULT , then the window manager calls ShowWindow with the SW_SHOW flag after the window
has been created. If the y parameter is some other value, then the window manager calls ShowWindow with
that value as the nCmdShow parameter.
nWidth

Type: int
The width, in device units, of the window. For overlapped windows, nWidth is either the window's width, in
screen coordinates, or CW_USEDEFAULT . If nWidth is CW_USEDEFAULT , the system selects a default width
and height for the window; the default width extends from the initial x-coordinate to the right edge of the
screen, and the default height extends from the initial y-coordinate to the top of the icon area.
CW_USEDEFAULT is valid only for overlapped windows; if CW_USEDEFAULT is specified for a pop-up or child
window, nWidth and nHeight are set to zero.
nHeight

Type: int
The height, in device units, of the window. For overlapped windows, nHeight is the window's height, in screen
coordinates. If nWidth is set to CW_USEDEFAULT , the system ignores nHeight.
hWndParent

Type: HWND
A handle to the parent or owner window of the window being created. To create a child window or an owned
window, supply a valid window handle. This parameter is optional for pop-up windows.
To create a message-only window, supply HWND_MESSAGE or a handle to an existing message-only window.
hMenu

Type: HMENU
A handle to a menu, or specifies a child-window identifier depending on the window style. For an overlapped or
pop-up window, hMenu identifies the menu to be used with the window; it can be NULL if the class menu is to
be used. For a child window, hMenu specifies the child-window identifier, an integer value used by a dialog box
control to notify its parent about events. The application determines the child-window identifier; it must be
unique for all child windows with the same parent window.
hInstance

Type: HINSTANCE
A handle to the instance of the module to be associated with the window.
lpParam

Type: LPVOID
A pointer to a value to be passed to the window through the CREATESTRUCT structure (lpCreateParams
member) pointed to by the lParam param of the WM_CREATE message. This message is sent to the created
window by this function before it returns.
If an application calls CreateWindow to create a MDI client window, lpParam should point to a
CLIENTCREATESTRUCT structure. If an MDI client window calls CreateWindow to create an MDI child window,
lpParam should point to a MDICREATESTRUCT structure. lpParam may be NULL if no additional data is needed.

Returns
Type: HWND
If the function succeeds, the return value is a handle to the new window.
If the function fails, the return value is NULL . To get extended error information, call GetLastError.

Return value
None

Remarks
Before returning, CreateWindow sends a WM_CREATE message to the window procedure. For overlapped,
pop-up, and child windows, CreateWindow sends WM_CREATE , WM_GETMINMAXINFO, and WM_NCCREATE
messages to the window. The lParam parameter of the WM_CREATE message contains a pointer to a
CREATESTRUCT structure. If the WS_VISIBLE style is specified, CreateWindow sends the window all the
messages required to activate and show the window.
If the created window is a child window, its default position is at the bottom of the Z-order. If the created window
is a top-level window, its default position is at the top of the Z-order (but beneath all topmost windows unless
the created window is itself topmost).
For information on controlling whether the Taskbar displays a button for the created window, see Managing
Taskbar Buttons.
For information on removing a window, see the DestroyWindow function.
The following predefined system classes can be specified in the lpClassName parameter. Note the
corresponding control styles you can use in the dwStyle parameter.

SY ST EM C L A SS M EA N IN G
BUTTON Designates a small rectangular child window that represents
a button the user can click to turn it on or off. Button
controls can be used alone or in groups, and they can either
be labeled or appear without text. Button controls typically
change appearance when the user clicks them. For more
information, see Buttons
For a table of the button styles you can specify in the
dwStyle parameter, see Button Styles.

COMBOBOX Designates a control consisting of a list box and a selection


field similar to an edit control. When using this style, an
application should either display the list box at all times or
enable a drop-down list box. If the list box is visible, typing
characters into the selection field highlights the first list box
entry that matches the characters typed. Conversely,
selecting an item in the list box displays the selected text in
the selection field.
For more information, see Combo Boxes. For a table of
the combo box styles you can specify in the dwStyle
parameter, see Combo Box Styles.

EDIT Designates a rectangular child window into which the user


can type text from the keyboard. The user selects the control
and gives it the keyboard focus by clicking it or moving to it
by pressing the TAB key. The user can type text when the
edit control displays a flashing caret; use the mouse to move
the cursor, select characters to be replaced, or position the
cursor for inserting characters; or use the BACKSPACE key to
delete characters. For more information, see Edit Controls.
For a table of the edit control styles you can specify in
the dwStyle parameter, see Edit Control Styles.

LISTBOX Designates a list of character strings. Specify this control


whenever an application must present a list of names, such
as file names, from which the user can choose. The user can
select a string by clicking it. A selected string is highlighted,
and a notification message is passed to the parent window.
For more information, see List Boxes.
For a table of the list box styles you can specify in the
dwStyle parameter, see List Box Styles.

MDICLIENT Designates an MDI client window. This window receives


messages that control the MDI application's child windows.
The recommended style bits are WS_CLIPCHILDREN and
WS_CHILD . Specify the WS_HSCROLL and WS_VSCROLL
styles to create an MDI client window that allows the user to
scroll MDI child windows into view.
For more information, see Multiple Document Interface.

RichEdit Designates a Microsoft Rich Edit 1.0 control. This window


lets the user view and edit text with character and paragraph
formatting, and can include embedded Component Object
Model (COM) objects. For more information, see Rich Edit
Controls.
For a table of the rich edit control styles you can specify
in the dwStyle parameter, see Rich Edit Control Styles.
RICHEDIT_CL ASS Designates a Microsoft Rich Edit 2.0 control. This controls let
the user view and edit text with character and paragraph
formatting, and can include embedded COM objects. For
more information, see Rich Edit Controls.
For a table of the rich edit control styles you can specify
in the dwStyle parameter, see Rich Edit Control Styles.

SCROLLBAR Designates a rectangle that contains a scroll box and has


direction arrows at both ends. The scroll bar sends a
notification message to its parent window whenever the user
clicks the control. The parent window is responsible for
updating the position of the scroll box, if necessary. For
more information, see Scroll Bars.
For a table of the scroll bar control styles you can specify
in the dwStyle parameter, see Scroll Bar Control Styles.

STATIC Designates a simple text field, box, or rectangle used to label,


box, or separate other controls. Static controls take no input
and provide no output. For more information, see Static
Controls.
For a table of the static control styles you can specify in
the dwStyle parameter, see Static Control Styles.

CreateWindow is implemented as a call to the CreateWindowEx function, as shown below.

#define CreateWindowA(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu,


hInstance, lpParam)\
CreateWindowExA(0L, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance,
lpParam)

#define CreateWindowW(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu,


hInstance, lpParam)\
CreateWindowExW(0L, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance,
lpParam)

#ifdef UNICODE
#define CreateWindow CreateWindowW
#else
#define CreateWindow CreateWindowA
#endif

Examples
For an example, see Using Window Classes.

NOTE
The winuser.h header defines CreateWindow as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements
Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

See also
About the Multiple Document Interface
Common Control Window Classes
Conceptual
CreateWindowEx
DestroyWindow
EnableWindow
Other Resources
Reference
RegisterClass
RegisterClassEx
ShowWindow
WM_COMMAND
WM_CREATE
WM_GETMINMAXINFO
WM_NCCREATE
WM_PAINT
Windows
CreateWindowExA function (winuser.h)
2/1/2021 • 10 minutes to read • Edit Online

Creates an overlapped, pop-up, or child window with an extended window style; otherwise, this function is
identical to the CreateWindow function. For more information about creating a window and for full descriptions
of the other parameters of CreateWindowEx , see CreateWindow .

Syntax
HWND CreateWindowExA(
DWORD dwExStyle,
LPCSTR lpClassName,
LPCSTR lpWindowName,
DWORD dwStyle,
int X,
int Y,
int nWidth,
int nHeight,
HWND hWndParent,
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam
);

Parameters
dwExStyle

Type: DWORD
The extended window style of the window being created. For a list of possible values, see Extended Window
Styles.
lpClassName

Type: LPCTSTR
A null -terminated string or a class atom created by a previous call to the RegisterClass or RegisterClassEx
function. The atom must be in the low-order word of lpClassName; the high-order word must be zero. If
lpClassName is a string, it specifies the window class name. The class name can be any name registered with
RegisterClass or RegisterClassEx , provided that the module that registers the class is also the module that
creates the window. The class name can also be any of the predefined system class names.
lpWindowName

Type: LPCTSTR
The window name. If the window style specifies a title bar, the window title pointed to by lpWindowName is
displayed in the title bar. When using CreateWindow to create controls, such as buttons, check boxes, and static
controls, use lpWindowName to specify the text of the control. When creating a static control with the SS_ICON
style, use lpWindowName to specify the icon name or identifier. To specify an identifier, use the syntax "#num".
dwStyle

Type: DWORD
The style of the window being created. This parameter can be a combination of the window style values, plus the
control styles indicated in the Remarks section.
X

Type: int
The initial horizontal position of the window. For an overlapped or pop-up window, the x parameter is the initial
x-coordinate of the window's upper-left corner, in screen coordinates. For a child window, x is the x-coordinate of
the upper-left corner of the window relative to the upper-left corner of the parent window's client area. If x is set
to CW_USEDEFAULT , the system selects the default position for the window's upper-left corner and ignores the
y parameter. CW_USEDEFAULT is valid only for overlapped windows; if it is specified for a pop-up or child
window, the x and y parameters are set to zero.
Y

Type: int
The initial vertical position of the window. For an overlapped or pop-up window, the y parameter is the initial y-
coordinate of the window's upper-left corner, in screen coordinates. For a child window, y is the initial y-
coordinate of the upper-left corner of the child window relative to the upper-left corner of the parent window's
client area. For a list box y is the initial y-coordinate of the upper-left corner of the list box's client area relative to
the upper-left corner of the parent window's client area.
If an overlapped window is created with the WS_VISIBLE style bit set and the x parameter is set to
CW_USEDEFAULT , then the y parameter determines how the window is shown. If the y parameter is
CW_USEDEFAULT , then the window manager calls ShowWindow with the SW_SHOW flag after the window
has been created. If the y parameter is some other value, then the window manager calls ShowWindow with
that value as the nCmdShow parameter.
nWidth

Type: int
The width, in device units, of the window. For overlapped windows, nWidth is the window's width, in screen
coordinates, or CW_USEDEFAULT . If nWidth is CW_USEDEFAULT , the system selects a default width and
height for the window; the default width extends from the initial x-coordinates to the right edge of the screen;
the default height extends from the initial y-coordinate to the top of the icon area. CW_USEDEFAULT is valid
only for overlapped windows; if CW_USEDEFAULT is specified for a pop-up or child window, the nWidth and
nHeight parameter are set to zero.
nHeight

Type: int
The height, in device units, of the window. For overlapped windows, nHeight is the window's height, in screen
coordinates. If the nWidth parameter is set to CW_USEDEFAULT , the system ignores nHeight.
hWndParent

Type: HWND
A handle to the parent or owner window of the window being created. To create a child window or an owned
window, supply a valid window handle. This parameter is optional for pop-up windows.
To create a message-only window, supply HWND_MESSAGE or a handle to an existing message-only window.
hMenu

Type: HMENU
A handle to a menu, or specifies a child-window identifier, depending on the window style. For an overlapped or
pop-up window, hMenu identifies the menu to be used with the window; it can be NULL if the class menu is to
be used. For a child window, hMenu specifies the child-window identifier, an integer value used by a dialog box
control to notify its parent about events. The application determines the child-window identifier; it must be
unique for all child windows with the same parent window.
hInstance

Type: HINSTANCE
A handle to the instance of the module to be associated with the window.
lpParam

Type: LPVOID
Pointer to a value to be passed to the window through the CREATESTRUCT structure (lpCreateParams
member) pointed to by the lParam param of the WM_CREATE message. This message is sent to the created
window by this function before it returns.
If an application calls CreateWindow to create a MDI client window, lpParam should point to a
CLIENTCREATESTRUCT structure. If an MDI client window calls CreateWindow to create an MDI child window,
lpParam should point to a MDICREATESTRUCT structure. lpParam may be NULL if no additional data is needed.

Return value
Type: HWND
If the function succeeds, the return value is a handle to the new window.
If the function fails, the return value is NULL . To get extended error information, call GetLastError.
This function typically fails for one of the following reasons:
an invalid parameter value
the system class was registered by a different module
The WH_CBT hook is installed and returns a failure code
if one of the controls in the dialog template is not registered, or its window window procedure fails
WM_CREATE or WM_NCCREATE

Remarks
The CreateWindowEx function sends WM_NCCREATE, WM_NCCALCSIZE, and WM_CREATE messages to the
window being created.
If the created window is a child window, its default position is at the bottom of the Z-order. If the created window
is a top-level window, its default position is at the top of the Z-order (but beneath all topmost windows unless
the created window is itself topmost).
For information on controlling whether the Taskbar displays a button for the created window, see Managing
Taskbar Buttons.
For information on removing a window, see the DestroyWindow function.
The following predefined control classes can be specified in the lpClassName parameter. Note the
corresponding control styles you can use in the dwStyle parameter.

C L A SS M EA N IN G
BUTTON Designates a small rectangular child window that represents
a button the user can click to turn it on or off. Button
controls can be used alone or in groups, and they can either
be labeled or appear without text. Button controls typically
change appearance when the user clicks them. For more
information, see Buttons.
For a table of the button styles you can specify in the
dwStyle parameter, see Button Styles.

COMBOBOX Designates a control consisting of a list box and a selection


field similar to an edit control. When using this style, an
application should either display the list box at all times or
enable a drop-down list box. If the list box is visible, typing
characters into the selection field highlights the first list box
entry that matches the characters typed. Conversely,
selecting an item in the list box displays the selected text in
the selection field. For more information, see Combo Boxes.
For a table of the combo box styles you can specify in
the dwStyle parameter, see Combo Box Styles.

EDIT Designates a rectangular child window into which the user


can type text from the keyboard. The user selects the control
and gives it the keyboard focus by clicking it or moving to it
by pressing the TAB key. The user can type text when the
edit control displays a flashing caret; use the mouse to move
the cursor, select characters to be replaced, or position the
cursor for inserting characters; or use the key to delete
characters. For more information, see Edit Controls.
For a table of the edit control styles you can specify in
the dwStyle parameter, see Edit Control Styles.

LISTBOX Designates a list of character strings. Specify this control


whenever an application must present a list of names, such
as filenames, from which the user can choose. The user can
select a string by clicking it. A selected string is highlighted,
and a notification message is passed to the parent window.
For more information, see List Boxes.
For a table of the list box styles you can specify in the
dwStyle parameter, see List Box Styles.

MDICLIENT Designates an MDI client window. This window receives


messages that control the MDI application's child windows.
The recommended style bits are WS_CLIPCHILDREN and
WS_CHILD . Specify the WS_HSCROLL and WS_VSCROLL
styles to create an MDI client window that allows the user to
scroll MDI child windows into view. For more information,
see Multiple Document Interface.

RichEdit Designates a Microsoft Rich Edit 1.0 control. This window


lets the user view and edit text with character and paragraph
formatting, and can include embedded Component Object
Model (COM) objects. For more information, see Rich Edit
Controls.
For a table of the rich edit control styles you can specify
in the dwStyle parameter, see Rich Edit Control Styles.
RICHEDIT_CL ASS Designates a Microsoft Rich Edit 2.0 control. This controls let
the user view and edit text with character and paragraph
formatting, and can include embedded COM objects. For
more information, see Rich Edit Controls.
For a table of the rich edit control styles you can specify
in the dwStyle parameter, see Rich Edit Control Styles.

SCROLLBAR Designates a rectangle that contains a scroll box and has


direction arrows at both ends. The scroll bar sends a
notification message to its parent window whenever the user
clicks the control. The parent window is responsible for
updating the position of the scroll box, if necessary. For
more information, see Scroll Bars.
For a table of the scroll bar control styles you can specify
in the dwStyle parameter, see Scroll Bar Control Styles.

STATIC Designates a simple text field, box, or rectangle used to label,


box, or separate other controls. Static controls take no input
and provide no output. For more information, see Static
Controls.
For a table of the static control styles you can specify in
the dwStyle parameter, see Static Control Styles.

The WS_EX_NOACTIVATE value for dwExStyle prevents foreground activation by the system. To prevent queue
activation when the user clicks on the window, you must process the WM_MOUSEACTIVATE message
appropriately. To bring the window to the foreground or to activate it programmatically, use
SetForegroundWindow or SetActiveWindow. Returning FALSE to WM_NCACTIVATE prevents the window from
losing queue activation. However, the return value is ignored at activation time.
With WS_EX_COMPOSITED set, all descendants of a window get bottom-to-top painting order using double-
buffering. Bottom-to-top painting order allows a descendent window to have translucency (alpha) and
transparency (color-key) effects, but only if the descendent window also has the WS_EX_TRANSPARENT bit
set. Double-buffering allows the window and its descendents to be painted without flicker.

Example
The following sample code illustrates the use of CreateWindowExA .
BOOL Create(
PCWSTR lpWindowName,
DWORD dwStyle,
DWORD dwExStyle = 0,
int x = CW_USEDEFAULT,
int y = CW_USEDEFAULT,
int nWidth = CW_USEDEFAULT,
int nHeight = CW_USEDEFAULT,
HWND hWndParent = 0,
HMENU hMenu = 0
)
{
WNDCLASS wc = {0};

wc.lpfnWndProc = DERIVED_TYPE::WindowProc;
wc.hInstance = GetModuleHandle(NULL);
wc.lpszClassName = ClassName();

RegisterClass(&wc);

m_hwnd = CreateWindowEx(
dwExStyle, ClassName(), lpWindowName, dwStyle, x, y,
nWidth, nHeight, hWndParent, hMenu, GetModuleHandle(NULL), this
);

return (m_hwnd ? TRUE : FALSE);


}

NOTE
The winuser.h header defines CreateWindowEx as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
About the Multiple Document Interface
CLIENTCREATESTRUCT
CREATESTRUCT
Conceptual
CreateWindow
DestroyWindow
EnableWindow
Other Resources
Reference
RegisterClass
RegisterClassEx
SetActiveWindow
SetForegroundWindow
SetWindowLong
SetWindowPos
ShowWindow
WM_CREATE
WM_NCCALCSIZE
WM_NCCREATE
WM_PAINT
WM_PARENTNOTIFY
Windows
CreateWindowExW function (winuser.h)
2/1/2021 • 10 minutes to read • Edit Online

Creates an overlapped, pop-up, or child window with an extended window style; otherwise, this function is
identical to the CreateWindow function. For more information about creating a window and for full descriptions
of the other parameters of CreateWindowEx , see CreateWindow .

Syntax
HWND CreateWindowExW(
DWORD dwExStyle,
LPCWSTR lpClassName,
LPCWSTR lpWindowName,
DWORD dwStyle,
int X,
int Y,
int nWidth,
int nHeight,
HWND hWndParent,
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam
);

Parameters
dwExStyle

Type: DWORD
The extended window style of the window being created. For a list of possible values, see Extended Window
Styles.
lpClassName

Type: LPCTSTR
A null -terminated string or a class atom created by a previous call to the RegisterClass or RegisterClassEx
function. The atom must be in the low-order word of lpClassName; the high-order word must be zero. If
lpClassName is a string, it specifies the window class name. The class name can be any name registered with
RegisterClass or RegisterClassEx , provided that the module that registers the class is also the module that
creates the window. The class name can also be any of the predefined system class names.
lpWindowName

Type: LPCTSTR
The window name. If the window style specifies a title bar, the window title pointed to by lpWindowName is
displayed in the title bar. When using CreateWindow to create controls, such as buttons, check boxes, and static
controls, use lpWindowName to specify the text of the control. When creating a static control with the SS_ICON
style, use lpWindowName to specify the icon name or identifier. To specify an identifier, use the syntax "#num".
dwStyle

Type: DWORD
The style of the window being created. This parameter can be a combination of the window style values, plus the
control styles indicated in the Remarks section.
X

Type: int
The initial horizontal position of the window. For an overlapped or pop-up window, the x parameter is the initial
x-coordinate of the window's upper-left corner, in screen coordinates. For a child window, x is the x-coordinate of
the upper-left corner of the window relative to the upper-left corner of the parent window's client area. If x is set
to CW_USEDEFAULT , the system selects the default position for the window's upper-left corner and ignores the
y parameter. CW_USEDEFAULT is valid only for overlapped windows; if it is specified for a pop-up or child
window, the x and y parameters are set to zero.
Y

Type: int
The initial vertical position of the window. For an overlapped or pop-up window, the y parameter is the initial y-
coordinate of the window's upper-left corner, in screen coordinates. For a child window, y is the initial y-
coordinate of the upper-left corner of the child window relative to the upper-left corner of the parent window's
client area. For a list box y is the initial y-coordinate of the upper-left corner of the list box's client area relative to
the upper-left corner of the parent window's client area.
If an overlapped window is created with the WS_VISIBLE style bit set and the x parameter is set to
CW_USEDEFAULT , then the y parameter determines how the window is shown. If the y parameter is
CW_USEDEFAULT , then the window manager calls ShowWindow with the SW_SHOW flag after the window
has been created. If the y parameter is some other value, then the window manager calls ShowWindow with
that value as the nCmdShow parameter.
nWidth

Type: int
The width, in device units, of the window. For overlapped windows, nWidth is the window's width, in screen
coordinates, or CW_USEDEFAULT . If nWidth is CW_USEDEFAULT , the system selects a default width and
height for the window; the default width extends from the initial x-coordinates to the right edge of the screen;
the default height extends from the initial y-coordinate to the top of the icon area. CW_USEDEFAULT is valid
only for overlapped windows; if CW_USEDEFAULT is specified for a pop-up or child window, the nWidth and
nHeight parameter are set to zero.
nHeight

Type: int
The height, in device units, of the window. For overlapped windows, nHeight is the window's height, in screen
coordinates. If the nWidth parameter is set to CW_USEDEFAULT , the system ignores nHeight.
hWndParent

Type: HWND
A handle to the parent or owner window of the window being created. To create a child window or an owned
window, supply a valid window handle. This parameter is optional for pop-up windows.
To create a message-only window, supply HWND_MESSAGE or a handle to an existing message-only window.
hMenu

Type: HMENU
A handle to a menu, or specifies a child-window identifier, depending on the window style. For an overlapped or
pop-up window, hMenu identifies the menu to be used with the window; it can be NULL if the class menu is to
be used. For a child window, hMenu specifies the child-window identifier, an integer value used by a dialog box
control to notify its parent about events. The application determines the child-window identifier; it must be
unique for all child windows with the same parent window.
hInstance

Type: HINSTANCE
A handle to the instance of the module to be associated with the window.
lpParam

Type: LPVOID
Pointer to a value to be passed to the window through the CREATESTRUCT structure (lpCreateParams
member) pointed to by the lParam param of the WM_CREATE message. This message is sent to the created
window by this function before it returns.
If an application calls CreateWindow to create a MDI client window, lpParam should point to a
CLIENTCREATESTRUCT structure. If an MDI client window calls CreateWindow to create an MDI child window,
lpParam should point to a MDICREATESTRUCT structure. lpParam may be NULL if no additional data is needed.

Return value
Type: HWND
If the function succeeds, the return value is a handle to the new window.
If the function fails, the return value is NULL . To get extended error information, call GetLastError.
This function typically fails for one of the following reasons:
an invalid parameter value
the system class was registered by a different module
The WH_CBT hook is installed and returns a failure code
if one of the controls in the dialog template is not registered, or its window window procedure fails
WM_CREATE or WM_NCCREATE

Remarks
The CreateWindowEx function sends WM_NCCREATE, WM_NCCALCSIZE, and WM_CREATE messages to the
window being created.
If the created window is a child window, its default position is at the bottom of the Z-order. If the created window
is a top-level window, its default position is at the top of the Z-order (but beneath all topmost windows unless
the created window is itself topmost).
For information on controlling whether the Taskbar displays a button for the created window, see Managing
Taskbar Buttons.
For information on removing a window, see the DestroyWindow function.
The following predefined control classes can be specified in the lpClassName parameter. Note the
corresponding control styles you can use in the dwStyle parameter.

C L A SS M EA N IN G
BUTTON Designates a small rectangular child window that represents
a button the user can click to turn it on or off. Button
controls can be used alone or in groups, and they can either
be labeled or appear without text. Button controls typically
change appearance when the user clicks them. For more
information, see Buttons.
For a table of the button styles you can specify in the
dwStyle parameter, see Button Styles.

COMBOBOX Designates a control consisting of a list box and a selection


field similar to an edit control. When using this style, an
application should either display the list box at all times or
enable a drop-down list box. If the list box is visible, typing
characters into the selection field highlights the first list box
entry that matches the characters typed. Conversely,
selecting an item in the list box displays the selected text in
the selection field. For more information, see Combo Boxes.
For a table of the combo box styles you can specify in
the dwStyle parameter, see Combo Box Styles.

EDIT Designates a rectangular child window into which the user


can type text from the keyboard. The user selects the control
and gives it the keyboard focus by clicking it or moving to it
by pressing the TAB key. The user can type text when the
edit control displays a flashing caret; use the mouse to move
the cursor, select characters to be replaced, or position the
cursor for inserting characters; or use the key to delete
characters. For more information, see Edit Controls.
For a table of the edit control styles you can specify in
the dwStyle parameter, see Edit Control Styles.

LISTBOX Designates a list of character strings. Specify this control


whenever an application must present a list of names, such
as filenames, from which the user can choose. The user can
select a string by clicking it. A selected string is highlighted,
and a notification message is passed to the parent window.
For more information, see List Boxes.
For a table of the list box styles you can specify in the
dwStyle parameter, see List Box Styles.

MDICLIENT Designates an MDI client window. This window receives


messages that control the MDI application's child windows.
The recommended style bits are WS_CLIPCHILDREN and
WS_CHILD . Specify the WS_HSCROLL and WS_VSCROLL
styles to create an MDI client window that allows the user to
scroll MDI child windows into view. For more information,
see Multiple Document Interface.

RichEdit Designates a Microsoft Rich Edit 1.0 control. This window


lets the user view and edit text with character and paragraph
formatting, and can include embedded Component Object
Model (COM) objects. For more information, see Rich Edit
Controls.
For a table of the rich edit control styles you can specify
in the dwStyle parameter, see Rich Edit Control Styles.
RICHEDIT_CL ASS Designates a Microsoft Rich Edit 2.0 control. This controls let
the user view and edit text with character and paragraph
formatting, and can include embedded COM objects. For
more information, see Rich Edit Controls.
For a table of the rich edit control styles you can specify
in the dwStyle parameter, see Rich Edit Control Styles.

SCROLLBAR Designates a rectangle that contains a scroll box and has


direction arrows at both ends. The scroll bar sends a
notification message to its parent window whenever the user
clicks the control. The parent window is responsible for
updating the position of the scroll box, if necessary. For
more information, see Scroll Bars.
For a table of the scroll bar control styles you can specify
in the dwStyle parameter, see Scroll Bar Control Styles.

STATIC Designates a simple text field, box, or rectangle used to label,


box, or separate other controls. Static controls take no input
and provide no output. For more information, see Static
Controls.
For a table of the static control styles you can specify in
the dwStyle parameter, see Static Control Styles.

The WS_EX_NOACTIVATE value for dwExStyle prevents foreground activation by the system. To prevent queue
activation when the user clicks on the window, you must process the WM_MOUSEACTIVATE message
appropriately. To bring the window to the foreground or to activate it programmatically, use
SetForegroundWindow or SetActiveWindow. Returning FALSE to WM_NCACTIVATE prevents the window from
losing queue activation. However, the return value is ignored at activation time.
With WS_EX_COMPOSITED set, all descendants of a window get bottom-to-top painting order using double-
buffering. Bottom-to-top painting order allows a descendent window to have translucency (alpha) and
transparency (color-key) effects, but only if the descendent window also has the WS_EX_TRANSPARENT bit
set. Double-buffering allows the window and its descendents to be painted without flicker.

Example
The following sample code illustrates the use of CreateWindowExA .
BOOL Create(
PCWSTR lpWindowName,
DWORD dwStyle,
DWORD dwExStyle = 0,
int x = CW_USEDEFAULT,
int y = CW_USEDEFAULT,
int nWidth = CW_USEDEFAULT,
int nHeight = CW_USEDEFAULT,
HWND hWndParent = 0,
HMENU hMenu = 0
)
{
WNDCLASS wc = {0};

wc.lpfnWndProc = DERIVED_TYPE::WindowProc;
wc.hInstance = GetModuleHandle(NULL);
wc.lpszClassName = ClassName();

RegisterClass(&wc);

m_hwnd = CreateWindowEx(
dwExStyle, ClassName(), lpWindowName, dwStyle, x, y,
nWidth, nHeight, hWndParent, hMenu, GetModuleHandle(NULL), this
);

return (m_hwnd ? TRUE : FALSE);


}

NOTE
The winuser.h header defines CreateWindowEx as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
About the Multiple Document Interface
CLIENTCREATESTRUCT
CREATESTRUCT
Conceptual
CreateWindow
DestroyWindow
EnableWindow
Other Resources
Reference
RegisterClass
RegisterClassEx
SetActiveWindow
SetForegroundWindow
SetWindowLong
SetWindowPos
ShowWindow
WM_CREATE
WM_NCCALCSIZE
WM_NCCREATE
WM_PAINT
WM_PARENTNOTIFY
Windows
CreateWindowW macro (winuser.h)
2/1/2021 • 9 minutes to read • Edit Online

Creates an overlapped, pop-up, or child window. It specifies the window class, window title, window style, and
(optionally) the initial position and size of the window. The function also specifies the window's parent or owner,
if any, and the window's menu.
To use extended window styles in addition to the styles supported by CreateWindow , use the CreateWindowEx
function.

Syntax
void CreateWindowW(
lpClassName,
lpWindowName,
dwStyle,
x,
y,
nWidth,
nHeight,
hWndParent,
hMenu,
hInstance,
lpParam
);

Parameters
lpClassName

Type: LPCTSTR
A null -terminated string or a class atom created by a previous call to the RegisterClass or RegisterClassEx
function. The atom must be in the low-order word of lpClassName; the high-order word must be zero. If
lpClassName is a string, it specifies the window class name. The class name can be any name registered with
RegisterClass or RegisterClassEx , provided that the module that registers the class is also the module that
creates the window. The class name can also be any of the predefined system class names. For a list of system
class names, see the Remarks section.
lpWindowName

Type: LPCTSTR
The window name. If the window style specifies a title bar, the window title pointed to by lpWindowName is
displayed in the title bar. When using CreateWindow to create controls, such as buttons, check boxes, and static
controls, use lpWindowName to specify the text of the control. When creating a static control with the SS_ICON
style, use lpWindowName to specify the icon name or identifier. To specify an identifier, use the syntax "#num".
dwStyle

Type: DWORD
The style of the window being created. This parameter can be a combination of the window style values, plus the
control styles indicated in the Remarks section.
x

Type: int
The initial horizontal position of the window. For an overlapped or pop-up window, the x parameter is the initial
x-coordinate of the window's upper-left corner, in screen coordinates. For a child window, x is the x-coordinate of
the upper-left corner of the window relative to the upper-left corner of the parent window's client area. If this
parameter is set to CW_USEDEFAULT , the system selects the default position for the window's upper-left
corner and ignores the y parameter. CW_USEDEFAULT is valid only for overlapped windows; if it is specified
for a pop-up or child window, the x and y parameters are set to zero.
y

Type: int
The initial vertical position of the window. For an overlapped or pop-up window, the y parameter is the initial y-
coordinate of the window's upper-left corner, in screen coordinates. For a child window, y is the initial y-
coordinate of the upper-left corner of the child window relative to the upper-left corner of the parent window's
client area. For a list box, y is the initial y-coordinate of the upper-left corner of the list box's client area relative
to the upper-left corner of the parent window's client area.
If an overlapped window is created with the WS_VISIBLE style bit set and the x parameter is set to
CW_USEDEFAULT , then the y parameter determines how the window is shown. If the y parameter is
CW_USEDEFAULT , then the window manager calls ShowWindow with the SW_SHOW flag after the window
has been created. If the y parameter is some other value, then the window manager calls ShowWindow with
that value as the nCmdShow parameter.
nWidth

Type: int
The width, in device units, of the window. For overlapped windows, nWidth is either the window's width, in
screen coordinates, or CW_USEDEFAULT . If nWidth is CW_USEDEFAULT , the system selects a default width
and height for the window; the default width extends from the initial x-coordinate to the right edge of the
screen, and the default height extends from the initial y-coordinate to the top of the icon area.
CW_USEDEFAULT is valid only for overlapped windows; if CW_USEDEFAULT is specified for a pop-up or child
window, nWidth and nHeight are set to zero.
nHeight

Type: int
The height, in device units, of the window. For overlapped windows, nHeight is the window's height, in screen
coordinates. If nWidth is set to CW_USEDEFAULT , the system ignores nHeight.
hWndParent

Type: HWND
A handle to the parent or owner window of the window being created. To create a child window or an owned
window, supply a valid window handle. This parameter is optional for pop-up windows.
To create a message-only window, supply HWND_MESSAGE or a handle to an existing message-only window.
hMenu

Type: HMENU
A handle to a menu, or specifies a child-window identifier depending on the window style. For an overlapped or
pop-up window, hMenu identifies the menu to be used with the window; it can be NULL if the class menu is to
be used. For a child window, hMenu specifies the child-window identifier, an integer value used by a dialog box
control to notify its parent about events. The application determines the child-window identifier; it must be
unique for all child windows with the same parent window.
hInstance

Type: HINSTANCE
A handle to the instance of the module to be associated with the window.
lpParam

Type: LPVOID
A pointer to a value to be passed to the window through the CREATESTRUCT structure (lpCreateParams
member) pointed to by the lParam param of the WM_CREATE message. This message is sent to the created
window by this function before it returns.
If an application calls CreateWindow to create a MDI client window, lpParam should point to a
CLIENTCREATESTRUCT structure. If an MDI client window calls CreateWindow to create an MDI child window,
lpParam should point to a MDICREATESTRUCT structure. lpParam may be NULL if no additional data is needed.

Returns
Type: HWND
If the function succeeds, the return value is a handle to the new window.
If the function fails, the return value is NULL . To get extended error information, call GetLastError.

Return value
None

Remarks
Before returning, CreateWindow sends a WM_CREATE message to the window procedure. For overlapped,
pop-up, and child windows, CreateWindow sends WM_CREATE , WM_GETMINMAXINFO, and WM_NCCREATE
messages to the window. The lParam parameter of the WM_CREATE message contains a pointer to a
CREATESTRUCT structure. If the WS_VISIBLE style is specified, CreateWindow sends the window all the
messages required to activate and show the window.
If the created window is a child window, its default position is at the bottom of the Z-order. If the created window
is a top-level window, its default position is at the top of the Z-order (but beneath all topmost windows unless
the created window is itself topmost).
For information on controlling whether the Taskbar displays a button for the created window, see Managing
Taskbar Buttons.
For information on removing a window, see the DestroyWindow function.
The following predefined system classes can be specified in the lpClassName parameter. Note the
corresponding control styles you can use in the dwStyle parameter.

SY ST EM C L A SS M EA N IN G
BUTTON Designates a small rectangular child window that represents
a button the user can click to turn it on or off. Button
controls can be used alone or in groups, and they can either
be labeled or appear without text. Button controls typically
change appearance when the user clicks them. For more
information, see Buttons
For a table of the button styles you can specify in the
dwStyle parameter, see Button Styles.

COMBOBOX Designates a control consisting of a list box and a selection


field similar to an edit control. When using this style, an
application should either display the list box at all times or
enable a drop-down list box. If the list box is visible, typing
characters into the selection field highlights the first list box
entry that matches the characters typed. Conversely,
selecting an item in the list box displays the selected text in
the selection field.
For more information, see Combo Boxes. For a table of
the combo box styles you can specify in the dwStyle
parameter, see Combo Box Styles.

EDIT Designates a rectangular child window into which the user


can type text from the keyboard. The user selects the control
and gives it the keyboard focus by clicking it or moving to it
by pressing the TAB key. The user can type text when the
edit control displays a flashing caret; use the mouse to move
the cursor, select characters to be replaced, or position the
cursor for inserting characters; or use the BACKSPACE key to
delete characters. For more information, see Edit Controls.
For a table of the edit control styles you can specify in
the dwStyle parameter, see Edit Control Styles.

LISTBOX Designates a list of character strings. Specify this control


whenever an application must present a list of names, such
as file names, from which the user can choose. The user can
select a string by clicking it. A selected string is highlighted,
and a notification message is passed to the parent window.
For more information, see List Boxes.
For a table of the list box styles you can specify in the
dwStyle parameter, see List Box Styles.

MDICLIENT Designates an MDI client window. This window receives


messages that control the MDI application's child windows.
The recommended style bits are WS_CLIPCHILDREN and
WS_CHILD . Specify the WS_HSCROLL and WS_VSCROLL
styles to create an MDI client window that allows the user to
scroll MDI child windows into view.
For more information, see Multiple Document Interface.

RichEdit Designates a Microsoft Rich Edit 1.0 control. This window


lets the user view and edit text with character and paragraph
formatting, and can include embedded Component Object
Model (COM) objects. For more information, see Rich Edit
Controls.
For a table of the rich edit control styles you can specify
in the dwStyle parameter, see Rich Edit Control Styles.
RICHEDIT_CL ASS Designates a Microsoft Rich Edit 2.0 control. This controls let
the user view and edit text with character and paragraph
formatting, and can include embedded COM objects. For
more information, see Rich Edit Controls.
For a table of the rich edit control styles you can specify
in the dwStyle parameter, see Rich Edit Control Styles.

SCROLLBAR Designates a rectangle that contains a scroll box and has


direction arrows at both ends. The scroll bar sends a
notification message to its parent window whenever the user
clicks the control. The parent window is responsible for
updating the position of the scroll box, if necessary. For
more information, see Scroll Bars.
For a table of the scroll bar control styles you can specify
in the dwStyle parameter, see Scroll Bar Control Styles.

STATIC Designates a simple text field, box, or rectangle used to label,


box, or separate other controls. Static controls take no input
and provide no output. For more information, see Static
Controls.
For a table of the static control styles you can specify in
the dwStyle parameter, see Static Control Styles.

CreateWindow is implemented as a call to the CreateWindowEx function, as shown below.

#define CreateWindowA(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu,


hInstance, lpParam)\
CreateWindowExA(0L, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance,
lpParam)

#define CreateWindowW(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu,


hInstance, lpParam)\
CreateWindowExW(0L, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance,
lpParam)

#ifdef UNICODE
#define CreateWindow CreateWindowW
#else
#define CreateWindow CreateWindowA
#endif

Examples
For an example, see Using Window Classes.

NOTE
The winuser.h header defines CreateWindow as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements
Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

See also
About the Multiple Document Interface
Common Control Window Classes
Conceptual
CreateWindowEx
DestroyWindow
EnableWindow
Other Resources
Reference
RegisterClass
RegisterClassEx
ShowWindow
WM_COMMAND
WM_CREATE
WM_GETMINMAXINFO
WM_NCCREATE
WM_PAINT
Windows
CWPRETSTRUCT structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Defines the message parameters passed to a WH_CALLWNDPROCRET hook procedure, CallWndRetProc.

Syntax
typedef struct tagCWPRETSTRUCT {
LRESULT lResult;
LPARAM lParam;
WPARAM wParam;
UINT message;
HWND hwnd;
} CWPRETSTRUCT, *PCWPRETSTRUCT, *NPCWPRETSTRUCT, *LPCWPRETSTRUCT;

Members
lResult

Type: LRESULT
The return value of the window procedure that processed the message specified by the message value.
lParam

Type: LPARAM
Additional information about the message. The exact meaning depends on the message value.
wParam

Type: WPARAM
Additional information about the message. The exact meaning depends on the message value.
message

Type: UINT
The message.
hwnd

Type: HWND
A handle to the window that processed the message specified by the message value.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]
Header winuser.h (include Windows.h)

See also
CallWndRetProc
Conceptual
Hooks
Reference
SetWindowsHookEx
CWPSTRUCT structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Defines the message parameters passed to a WH_CALLWNDPROC hook procedure, CallWndProc.

Syntax
typedef struct tagCWPSTRUCT {
LPARAM lParam;
WPARAM wParam;
UINT message;
HWND hwnd;
} CWPSTRUCT, *PCWPSTRUCT, *NPCWPSTRUCT, *LPCWPSTRUCT;

Members
lParam

Type: LPARAM
Additional information about the message. The exact meaning depends on the message value.
wParam

Type: WPARAM
Additional information about the message. The exact meaning depends on the message value.
message

Type: UINT
The message.
hwnd

Type: HWND
A handle to the window to receive the message.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
CallWndProc
Conceptual
Hooks
Reference
SetWindowsHookEx
DEBUGHOOKINFO structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains debugging information passed to a WH_DEBUG hook procedure, DebugProc.

Syntax
typedef struct tagDEBUGHOOKINFO {
DWORD idThread;
DWORD idThreadInstaller;
LPARAM lParam;
WPARAM wParam;
int code;
} DEBUGHOOKINFO, *PDEBUGHOOKINFO, *NPDEBUGHOOKINFO, *LPDEBUGHOOKINFO;

Members
idThread

Type: DWORD
A handle to the thread containing the filter function.
idThreadInstaller

Type: DWORD
A handle to the thread that installed the debugging filter function.
lParam

Type: LPARAM
The value to be passed to the hook in the lParam parameter of the DebugProc callback function.
wParam

Type: WPARAM
The value to be passed to the hook in the wParam parameter of the DebugProc callback function.
code

Type: int
The value to be passed to the hook in the nCode parameter of the DebugProc callback function.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]
Header winuser.h (include Windows.h)

See also
Conceptual
DebugProc
Hooks
Reference
SetWindowsHookEx
DeferWindowPos function (winuser.h)
2/1/2021 • 5 minutes to read • Edit Online

Updates the specified multiple-window – position structure for the specified window. The function then returns a
handle to the updated structure. The EndDeferWindowPos function uses the information in this structure to
change the position and size of a number of windows simultaneously. The BeginDeferWindowPos function
creates the structure.

Syntax
HDWP DeferWindowPos(
HDWP hWinPosInfo,
HWND hWnd,
HWND hWndInsertAfter,
int x,
int y,
int cx,
int cy,
UINT uFlags
);

Parameters
hWinPosInfo

Type: HDWP
A handle to a multiple-window – position structure that contains size and position information for one or more
windows. This structure is returned by BeginDeferWindowPos or by the most recent call to DeferWindowPos .
hWnd

Type: HWND
A handle to the window for which update information is stored in the structure. All windows in a multiple-
window – position structure must have the same parent.
hWndInsertAfter

Type: HWND
A handle to the window that precedes the positioned window in the Z order. This parameter must be a window
handle or one of the following values. This parameter is ignored if the SWP_NOZORDER flag is set in the
uFlags parameter.

VA L UE M EA N IN G

Places the window at the bottom of the Z order. If the hWnd


HWND_BOTTOM parameter identifies a topmost window, the window loses its
((HWND)1) topmost status and is placed at the bottom of all other
windows.
Places the window above all non-topmost windows (that is,
HWND_NOTOPMOST behind all topmost windows). This flag has no effect if the
((HWND)-2) window is already a non-topmost window.

Places the window at the top of the Z order.


HWND_TOP
((HWND)0)

Places the window above all non-topmost windows. The


HWND_TOPMOST window maintains its topmost position even when it is
((HWND)-1) deactivated.

Type: int
The x-coordinate of the window's upper-left corner.
y

Type: int
The y-coordinate of the window's upper-left corner.
cx

Type: int
The window's new width, in pixels.
cy

Type: int
The window's new height, in pixels.
uFlags

Type: UINT
A combination of the following values that affect the size and position of the window.

VA L UE M EA N IN G

Draws a frame (defined in the window's class description)


SWP_DRAWFRAME around the window.
0x0020

Sends a WM_NCCALCSIZE message to the window, even if


SWP_FRAMECHANGED the window's size is not being changed. If this flag is not
0x0020 specified, WM_NCCALCSIZE is sent only when the
window's size is being changed.

Hides the window.


SWP_HIDEWINDOW
0x0080
Does not activate the window. If this flag is not set, the
SWP_NOACTIVATE window is activated and moved to the top of either the
0x0010 topmost or non-topmost group (depending on the setting
of the hWndInsertAfter parameter).

Discards the entire contents of the client area. If this flag is


SWP_NOCOPYBITS not specified, the valid contents of the client area are saved
0x0100 and copied back into the client area after the window is sized
or repositioned.

Retains the current position (ignores the x and y


SWP_NOMOVE parameters).
0x0002

Does not change the owner window's position in the Z order.


SWP_NOOWNERZORDER
0x0200

Does not redraw changes. If this flag is set, no repainting of


SWP_NOREDRAW any kind occurs. This applies to the client area, the nonclient
0x0008 area (including the title bar and scroll bars), and any part of
the parent window uncovered as a result of the window
being moved. When this flag is set, the application must
explicitly invalidate or redraw any parts of the window and
parent window that need redrawing.

Same as the SWP_NOOWNERZORDER flag.


SWP_NOREPOSITION
0x0200

Prevents the window from receiving the


SWP_NOSENDCHANGING WM_WINDOWPOSCHANGING message.
0x0400

Retains the current size (ignores the cx and cy parameters).


SWP_NOSIZE
0x0001

Retains the current Z order (ignores the hWndInsertAfter


SWP_NOZORDER parameter).
0x0004

Displays the window.


SWP_SHOWWINDOW
0x0040

Return value
Type: HDWP
The return value identifies the updated multiple-window – position structure. The handle returned by this
function may differ from the handle passed to the function. The new handle that this function returns should be
passed during the next call to the DeferWindowPos or EndDeferWindowPos function.
If insufficient system resources are available for the function to succeed, the return value is NULL . To get
extended error information, call GetLastError.

Remarks
If a call to DeferWindowPos fails, the application should abandon the window-positioning operation and not
call EndDeferWindowPos.
If SWP_NOZORDER is not specified, the system places the window identified by the hWnd parameter in the
position following the window identified by the hWndInsertAfter parameter. If hWndInsertAfter is NULL or
HWND_TOP , the system places the hWnd window at the top of the Z order. If hWndInsertAfter is set to
HWND_BOTTOM , the system places the hWnd window at the bottom of the Z order.
All coordinates for child windows are relative to the upper-left corner of the parent window's client area.
A window can be made a topmost window either by setting hWndInsertAfter to the HWND_TOPMOST flag
and ensuring that the SWP_NOZORDER flag is not set, or by setting the window's position in the Z order so
that it is above any existing topmost windows. When a non-topmost window is made topmost, its owned
windows are also made topmost. Its owners, however, are not changed.
If neither the SWP_NOACTIVATE nor SWP_NOZORDER flag is specified (that is, when the application
requests that a window be simultaneously activated and its position in the Z order changed), the value specified
in hWndInsertAfter is used only in the following circumstances:
Neither the HWND_TOPMOST nor HWND_NOTOPMOST flag is specified in hWndInsertAfter.
The window identified by hWnd is not the active window.
An application cannot activate an inactive window without also bringing it to the top of the Z order. An application
can change an activated window's position in the Z order without restrictions, or it can activate a window and then
move it to the top of the topmost or non-topmost windows.
A topmost window is no longer topmost if it is repositioned to the bottom (HWND_BOTTOM ) of the Z order or
after any non-topmost window. When a topmost window is made non-topmost, its owners and its owned
windows are also made non-topmost windows.
A non-topmost window may own a topmost window, but not vice versa. Any window (for example, a dialog box)
owned by a topmost window is itself made a topmost window to ensure that all owned windows stay above
their owner.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows


10, version 10.0.14393)
See also
BeginDeferWindowPos
Conceptual
EndDeferWindowPos
Reference
ShowWindow
Windows
DefFrameProcA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Provides default processing for any window messages that the window procedure of a multiple-document
interface (MDI) frame window does not process. All window messages that are not explicitly processed by the
window procedure must be passed to the DefFrameProc function, not the DefWindowProc function.

Syntax
LRESULT DefFrameProcA(
HWND hWnd,
HWND hWndMDIClient,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);

Parameters
hWnd

Type: HWND
A handle to the MDI frame window.
hWndMDIClient

Type: HWND
A handle to the MDI client window.
uMsg

Type: UINT
The message to be processed.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.

Return value
Type: LRESULT
The return value specifies the result of the message processing and depends on the message. If the
hWndMDIClient parameter is NULL , the return value is the same as for the DefWindowProc function.
Remarks
When an application's window procedure does not handle a message, it typically passes the message to the
DefWindowProc function to process the message. MDI applications use the DefFrameProc and
DefMDIChildProc functions instead of DefWindowProc to provide default message processing. All messages
that an application would usually pass to DefWindowProc (such as nonclient messages and the WM_SETTEXT
message) should be passed to DefFrameProc instead. The DefFrameProc function also handles the following
messages.

M ESSA GE RESP O N SE

WM_COMMAND Activates the MDI child window that the user chooses. This
message is sent when the user chooses an MDI child
window from the window menu of the MDI frame window.
The window identifier accompanying this message identifies
the MDI child window to be activated.

WM_MENUCHAR Opens the window menu of the active MDI child window
when the user presses the ALT+ – (minus) key combination.

WM_SETFOCUS Passes the keyboard focus to the MDI client window, which
in turn passes it to the active MDI child window.

WM_SIZE Resizes the MDI client window to fit in the new frame
window's client area. If the frame window procedure sizes the
MDI client window to a different size, it should not pass the
message to the DefWindowProc function.

NOTE
The winuser.h header defines DefFrameProc as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
Conceptual
DefMDIChildProc
DefWindowProc
Multiple Document Interface
Reference
WM_SETTEXT
DefFrameProcW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Provides default processing for any window messages that the window procedure of a multiple-document
interface (MDI) frame window does not process. All window messages that are not explicitly processed by the
window procedure must be passed to the DefFrameProc function, not the DefWindowProc function.

Syntax
LRESULT DefFrameProcW(
HWND hWnd,
HWND hWndMDIClient,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);

Parameters
hWnd

Type: HWND
A handle to the MDI frame window.
hWndMDIClient

Type: HWND
A handle to the MDI client window.
uMsg

Type: UINT
The message to be processed.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.

Return value
Type: LRESULT
The return value specifies the result of the message processing and depends on the message. If the
hWndMDIClient parameter is NULL , the return value is the same as for the DefWindowProc function.
Remarks
When an application's window procedure does not handle a message, it typically passes the message to the
DefWindowProc function to process the message. MDI applications use the DefFrameProc and
DefMDIChildProc functions instead of DefWindowProc to provide default message processing. All messages
that an application would usually pass to DefWindowProc (such as nonclient messages and the WM_SETTEXT
message) should be passed to DefFrameProc instead. The DefFrameProc function also handles the following
messages.

M ESSA GE RESP O N SE

WM_COMMAND Activates the MDI child window that the user chooses. This
message is sent when the user chooses an MDI child
window from the window menu of the MDI frame window.
The window identifier accompanying this message identifies
the MDI child window to be activated.

WM_MENUCHAR Opens the window menu of the active MDI child window
when the user presses the ALT+ – (minus) key combination.

WM_SETFOCUS Passes the keyboard focus to the MDI client window, which
in turn passes it to the active MDI child window.

WM_SIZE Resizes the MDI client window to fit in the new frame
window's client area. If the frame window procedure sizes the
MDI client window to a different size, it should not pass the
message to the DefWindowProc function.

NOTE
The winuser.h header defines DefFrameProc as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
Conceptual
DefMDIChildProc
DefWindowProc
Multiple Document Interface
Reference
WM_SETTEXT
DefMDIChildProcA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Provides default processing for any window message that the window procedure of a multiple-document
interface (MDI) child window does not process. A window message not processed by the window procedure
must be passed to the DefMDIChildProc function, not to the DefWindowProc function.

Syntax
LRESULT LRESULT DefMDIChildProcA(
HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);

Parameters
hWnd

Type: HWND
A handle to the MDI child window.
uMsg

Type: UINT
The message to be processed.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.

Return value
Type: LRESULT
The return value specifies the result of the message processing and depends on the message.

Remarks
The DefMDIChildProc function assumes that the parent window of the MDI child window identified by the
hWnd parameter was created with the MDICLIENT class.
When an application's window procedure does not handle a message, it typically passes the message to the
DefWindowProc function to process the message. MDI applications use the DefFrameProc and
DefMDIChildProc functions instead of DefWindowProc to provide default message processing. All messages
that an application would usually pass to DefWindowProc (such as nonclient messages and the WM_SETTEXT
message) should be passed to DefMDIChildProc instead. In addition, DefMDIChildProc also handles the
following messages.

M ESSA GE RESP O N SE

WM_CHILDACTIVATE Performs activation processing when MDI child windows are


sized, moved, or displayed. This message must be passed.

WM_GETMINMAXINFO Calculates the size of a maximized MDI child window, based


on the current size of the MDI client window.

WM_MENUCHAR Passes the message to the MDI frame window.

WM_MOVE Recalculates MDI client scroll bars if they are present.

WM_SETFOCUS Activates the child window if it is not the active MDI child
window.

WM_SIZE Performs operations necessary for changing the size of a


window, especially for maximizing or restoring an MDI child
window. Failing to pass this message to the
DefMDIChildProc function produces highly undesirable
results.

WM_SYSCOMMAND Handles window menu commands: SC_NEXTWINDOW ,


SC_PREVWINDOW , SC_MOVE , SC_SIZE , and
SC_MAXIMIZE .

NOTE
The winuser.h header defines DefMDIChildProc as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll
See also
Conceptual
DefFrameProc
DefWindowProc
Multiple Document Interface
Reference
WM_CHILDACTIVATE
WM_GETMINMAXINFO
WM_MENUCHAR
WM_MOVE
WM_SETFOCUS
WM_SETTEXT
WM_SIZE
WM_SYSCOMMAND
DefMDIChildProcW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Provides default processing for any window message that the window procedure of a multiple-document
interface (MDI) child window does not process. A window message not processed by the window procedure
must be passed to the DefMDIChildProc function, not to the DefWindowProc function.

Syntax
LRESULT LRESULT DefMDIChildProcW(
HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);

Parameters
hWnd

Type: HWND
A handle to the MDI child window.
uMsg

Type: UINT
The message to be processed.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.

Return value
Type: LRESULT
The return value specifies the result of the message processing and depends on the message.

Remarks
The DefMDIChildProc function assumes that the parent window of the MDI child window identified by the
hWnd parameter was created with the MDICLIENT class.
When an application's window procedure does not handle a message, it typically passes the message to the
DefWindowProc function to process the message. MDI applications use the DefFrameProc and
DefMDIChildProc functions instead of DefWindowProc to provide default message processing. All messages
that an application would usually pass to DefWindowProc (such as nonclient messages and the WM_SETTEXT
message) should be passed to DefMDIChildProc instead. In addition, DefMDIChildProc also handles the
following messages.

M ESSA GE RESP O N SE

WM_CHILDACTIVATE Performs activation processing when MDI child windows are


sized, moved, or displayed. This message must be passed.

WM_GETMINMAXINFO Calculates the size of a maximized MDI child window, based


on the current size of the MDI client window.

WM_MENUCHAR Passes the message to the MDI frame window.

WM_MOVE Recalculates MDI client scroll bars if they are present.

WM_SETFOCUS Activates the child window if it is not the active MDI child
window.

WM_SIZE Performs operations necessary for changing the size of a


window, especially for maximizing or restoring an MDI child
window. Failing to pass this message to the
DefMDIChildProc function produces highly undesirable
results.

WM_SYSCOMMAND Handles window menu commands: SC_NEXTWINDOW ,


SC_PREVWINDOW , SC_MOVE , SC_SIZE , and
SC_MAXIMIZE .

NOTE
The winuser.h header defines DefMDIChildProc as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll
See also
Conceptual
DefFrameProc
DefWindowProc
Multiple Document Interface
Reference
WM_CHILDACTIVATE
WM_GETMINMAXINFO
WM_MENUCHAR
WM_MOVE
WM_SETFOCUS
WM_SETTEXT
WM_SIZE
WM_SYSCOMMAND
DefWindowProcA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Calls the default window procedure to provide default processing for any window messages that an application
does not process. This function ensures that every message is processed. DefWindowProc is called with the
same parameters received by the window procedure.

Syntax
LRESULT LRESULT DefWindowProcA(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);

Parameters
hWnd

Type: HWND
A handle to the window procedure that received the message.
Msg

Type: UINT
The message.
wParam

Type: WPARAM
Additional message information. The content of this parameter depends on the value of the Msg parameter.
lParam

Type: LPARAM
Additional message information. The content of this parameter depends on the value of the Msg parameter.

Return value
Type: LRESULT
The return value is the result of the message processing and depends on the message.

Remarks
NOTE
The winuser.h header defines DefWindowProc as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
CallWindowProc
Conceptual
DefDlgProc
Reference
Window Procedures
WindowProc
DefWindowProcW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Calls the default window procedure to provide default processing for any window messages that an application
does not process. This function ensures that every message is processed. DefWindowProc is called with the
same parameters received by the window procedure.

Syntax
LRESULT LRESULT DefWindowProcW(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);

Parameters
hWnd

Type: HWND
A handle to the window procedure that received the message.
Msg

Type: UINT
The message.
wParam

Type: WPARAM
Additional message information. The content of this parameter depends on the value of the Msg parameter.
lParam

Type: LPARAM
Additional message information. The content of this parameter depends on the value of the Msg parameter.

Return value
Type: LRESULT
The return value is the result of the message processing and depends on the message.

Remarks
NOTE
The winuser.h header defines DefWindowProc as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
CallWindowProc
Conceptual
DefDlgProc
Reference
Window Procedures
WindowProc
DeregisterShellHookWindow function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

[This function is not intended for general use. It may be altered or unavailable in subsequent versions of
Windows.]
Unregisters a specified Shell window that is registered to receive Shell hook messages.

Syntax
BOOL DeregisterShellHookWindow(
HWND hwnd
);

Parameters
hwnd

Type: HWND
A handle to the window to be unregistered. The window was registered with a call to the
RegisterShellHookWindow function.

Return value
Type: BOOL
TRUE if the function succeeds; FALSE if the function fails.

Remarks
This function was not included in the SDK headers and libraries until Windows XP with Service Pack 1 (SP1) and
Windows Server 2003. If you do not have a header file and import library for this function, you can call the
function using LoadLibrary and GetProcAddress.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll
See also
Conceptual
Reference
RegisterShellHookWindow
Windows
DestroyWindow function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Destroys the specified window. The function sends WM_DESTROY and WM_NCDESTROY messages to the
window to deactivate it and remove the keyboard focus from it. The function also destroys the window's menu,
flushes the thread message queue, destroys timers, removes clipboard ownership, and breaks the clipboard
viewer chain (if the window is at the top of the viewer chain).
If the specified window is a parent or owner window, DestroyWindow automatically destroys the associated
child or owned windows when it destroys the parent or owner window. The function first destroys child or
owned windows, and then it destroys the parent or owner window.
DestroyWindow also destroys modeless dialog boxes created by the CreateDialog function.

Syntax
BOOL DestroyWindow(
HWND hWnd
);

Parameters
hWnd

Type: HWND
A handle to the window to be destroyed.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
A thread cannot use DestroyWindow to destroy a window created by a different thread.
If the window being destroyed is a child window that does not have the WS_EX_NOPARENTNOTIFY style, a
WM_PARENTNOTIFY message is sent to the parent.
Examples
For an example, see Destroying a Window.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]
Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
CreateDialog
CreateWindow
CreateWindowEx
Reference
WM_DESTROY
WM_NCDESTROY
WM_PARENTNOTIFY
Windows
DispatchMessage function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Dispatches a message to a window procedure. It is typically used to dispatch a message retrieved by the
GetMessage function.

Syntax
LRESULT DispatchMessage(
const MSG *lpMsg
);

Parameters
lpMsg

Type: const MSG *


A pointer to a structure that contains the message.

Return value
Type: LRESULT
The return value specifies the value returned by the window procedure. Although its meaning depends on the
message being dispatched, the return value generally is ignored.

Remarks
The MSG structure must contain valid message values. If the lpmsg parameter points to a WM_TIMER message
and the lParam parameter of the WM_TIMER message is not NULL , lParam points to a function that is called
instead of the window procedure.
Note that the application is responsible for retrieving and dispatching input messages to the dialog box. Most
applications use the main message loop for this. However, to permit the user to move to and to select controls
by using the keyboard, the application must call IsDialogMessage. For more information, see Dialog Box
Keyboard Interface.
Examples
For an example, see Creating a Message Loop.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows


Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetMessage
IsDialogMessage
MSG
Messages and Message Queues
PeekMessage
Reference
TranslateMessage
WM_TIMER
DispatchMessageA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Dispatches a message to a window procedure. It is typically used to dispatch a message retrieved by the
GetMessage function.

Syntax
LRESULT DispatchMessageA(
const MSG *lpMsg
);

Parameters
lpMsg

Type: const MSG *


A pointer to a structure that contains the message.

Return value
Type: LRESULT
The return value specifies the value returned by the window procedure. Although its meaning depends on the
message being dispatched, the return value generally is ignored.

Remarks
The MSG structure must contain valid message values. If the lpmsg parameter points to a WM_TIMER message
and the lParam parameter of the WM_TIMER message is not NULL , lParam points to a function that is called
instead of the window procedure.
Note that the application is responsible for retrieving and dispatching input messages to the dialog box. Most
applications use the main message loop for this. However, to permit the user to move to and to select controls
by using the keyboard, the application must call IsDialogMessage. For more information, see Dialog Box
Keyboard Interface.
Examples
For an example, see Creating a Message Loop.

NOTE
The winuser.h header defines DispatchMessage as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements
Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetMessage
IsDialogMessage
MSG
Messages and Message Queues
PeekMessage
Reference
TranslateMessage
WM_TIMER
DispatchMessageW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Dispatches a message to a window procedure. It is typically used to dispatch a message retrieved by the
GetMessage function.

Syntax
LRESULT DispatchMessageW(
const MSG *lpMsg
);

Parameters
lpMsg

Type: const MSG *


A pointer to a structure that contains the message.

Return value
Type: LRESULT
The return value specifies the value returned by the window procedure. Although its meaning depends on the
message being dispatched, the return value generally is ignored.

Remarks
The MSG structure must contain valid message values. If the lpmsg parameter points to a WM_TIMER message
and the lParam parameter of the WM_TIMER message is not NULL , lParam points to a function that is called
instead of the window procedure.
Note that the application is responsible for retrieving and dispatching input messages to the dialog box. Most
applications use the main message loop for this. However, to permit the user to move to and to select controls
by using the keyboard, the application must call IsDialogMessage. For more information, see Dialog Box
Keyboard Interface.
Examples
For an example, see Creating a Message Loop.

NOTE
The winuser.h header defines DispatchMessage as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements
Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetMessage
IsDialogMessage
MSG
Messages and Message Queues
PeekMessage
Reference
TranslateMessage
WM_TIMER
EndDeferWindowPos function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Simultaneously updates the position and size of one or more windows in a single screen-refreshing cycle.

Syntax
BOOL EndDeferWindowPos(
HDWP hWinPosInfo
);

Parameters
hWinPosInfo

Type: HDWP
A handle to a multiple-window – position structure that contains size and position information for one or more
windows. This internal structure is returned by the BeginDeferWindowPos function or by the most recent call to
the DeferWindowPos function.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
The EndDeferWindowPos function sends the WM_WINDOWPOSCHANGING and
WM_WINDOWPOSCHANGED messages to each window identified in the internal structure.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll
API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows
10, version 10.0.14393)

See also
BeginDeferWindowPos
Conceptual
DeferWindowPos
Reference
WM_WINDOWPOSCHANGED
WM_WINDOWPOSCHANGING
Windows
EndTask function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

[This function is not intended for general use. It may be altered or unavailable in subsequent versions of
Windows.]
Forcibly closes the specified window.

Syntax
BOOL EndTask(
HWND hWnd,
BOOL fShutDown,
BOOL fForce
);

Parameters
hWnd

Type: HWND
A handle to the window to be closed.
fShutDown

Type: BOOL
Ignored. Must be FALSE .
fForce

Type: BOOL
A TRUE for this parameter will force the destruction of the window if an initial attempt fails to gently close the
window using WM_CLOSE. With a FALSE for this parameter, only the close with WM_CLOSE is attempted.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is FALSE . To get extended error information, call GetLastError.

Remarks
This function was not included in the SDK headers and libraries until Windows XP with Service Pack 1 (SP1) and
Windows Server 2003. If you do not have a header file and import library for this function, you can call the
function using LoadLibrary and GetProcAddress.

Requirements
Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
CloseWindow
Conceptual
DestroyWindow
Reference
WM_CLOSE
Windows
EnumChildWindows function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Enumerates the child windows that belong to the specified parent window by passing the handle to each child
window, in turn, to an application-defined callback function. EnumChildWindows continues until the last child
window is enumerated or the callback function returns FALSE .

Syntax
BOOL EnumChildWindows(
HWND hWndParent,
WNDENUMPROC lpEnumFunc,
LPARAM lParam
);

Parameters
hWndParent

Type: HWND
A handle to the parent window whose child windows are to be enumerated. If this parameter is NULL , this
function is equivalent to EnumWindows.
lpEnumFunc

Type: WNDENUMPROC
A pointer to an application-defined callback function. For more information, see EnumChildProc.
lParam

Type: LPARAM
An application-defined value to be passed to the callback function.

Return value
Type: BOOL
The return value is not used.

Remarks
If a child window has created child windows of its own, EnumChildWindows enumerates those windows as
well.
A child window that is moved or repositioned in the Z order during the enumeration process will be properly
enumerated. The function does not enumerate a child window that is destroyed before being enumerated or
that is created during the enumeration process.

Requirements
Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
EnumChildProc
EnumThreadWindows
EnumWindows
GetWindow
Reference
Windows
EnumPropsA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Enumerates all entries in the property list of a window by passing them, one by one, to the specified callback
function. EnumProps continues until the last entry is enumerated or the callback function returns FALSE .
To pass application-defined data to the callback function, use EnumPropsEx function.

Syntax
int EnumPropsA(
HWND hWnd,
PROPENUMPROCA lpEnumFunc
);

Parameters
hWnd

Type: HWND
A handle to the window whose property list is to be enumerated.
lpEnumFunc

Type: PROPENUMPROC
A pointer to the callback function. For more information about the callback function, see the PropEnumProc
function.

Return value
Type: int
The return value specifies the last value returned by the callback function. It is -1 if the function did not find a
property for enumeration.

Remarks
An application can remove only those properties it has added. It must not remove properties added by other
applications or by the system itself.

NOTE
The winuser.h header defines EnumProps as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements
Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
Conceptual
EnumPropsEx
PropEnumProc
Reference
Window Properties
EnumPropsExA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Enumerates all entries in the property list of a window by passing them, one by one, to the specified callback
function. EnumPropsEx continues until the last entry is enumerated or the callback function returns FALSE .

Syntax
int EnumPropsExA(
HWND hWnd,
PROPENUMPROCEXA lpEnumFunc,
LPARAM lParam
);

Parameters
hWnd

Type: HWND
A handle to the window whose property list is to be enumerated.
lpEnumFunc

Type: PROPENUMPROCEX
A pointer to the callback function. For more information about the callback function, see the PropEnumProcEx
function.
lParam

Type: LPARAM
Application-defined data to be passed to the callback function.

Return value
Type: int
The return value specifies the last value returned by the callback function. It is -1 if the function did not find a
property for enumeration.

Remarks
An application can remove only those properties it has added. It must not remove properties added by other
applications or by the system itself.
Examples
For an example, see Listing Window Properties for a Given Window.
NOTE
The winuser.h header defines EnumPropsEx as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
Conceptual
PropEnumProcEx
Reference
Window Properties
EnumPropsExW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Enumerates all entries in the property list of a window by passing them, one by one, to the specified callback
function. EnumPropsEx continues until the last entry is enumerated or the callback function returns FALSE .

Syntax
int EnumPropsExW(
HWND hWnd,
PROPENUMPROCEXW lpEnumFunc,
LPARAM lParam
);

Parameters
hWnd

Type: HWND
A handle to the window whose property list is to be enumerated.
lpEnumFunc

Type: PROPENUMPROCEX
A pointer to the callback function. For more information about the callback function, see the PropEnumProcEx
function.
lParam

Type: LPARAM
Application-defined data to be passed to the callback function.

Return value
Type: int
The return value specifies the last value returned by the callback function. It is -1 if the function did not find a
property for enumeration.

Remarks
An application can remove only those properties it has added. It must not remove properties added by other
applications or by the system itself.
Examples
For an example, see Listing Window Properties for a Given Window.
NOTE
The winuser.h header defines EnumPropsEx as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
Conceptual
PropEnumProcEx
Reference
Window Properties
EnumPropsW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Enumerates all entries in the property list of a window by passing them, one by one, to the specified callback
function. EnumProps continues until the last entry is enumerated or the callback function returns FALSE .
To pass application-defined data to the callback function, use EnumPropsEx function.

Syntax
int EnumPropsW(
HWND hWnd,
PROPENUMPROCW lpEnumFunc
);

Parameters
hWnd

Type: HWND
A handle to the window whose property list is to be enumerated.
lpEnumFunc

Type: PROPENUMPROC
A pointer to the callback function. For more information about the callback function, see the PropEnumProc
function.

Return value
Type: int
The return value specifies the last value returned by the callback function. It is -1 if the function did not find a
property for enumeration.

Remarks
An application can remove only those properties it has added. It must not remove properties added by other
applications or by the system itself.

NOTE
The winuser.h header defines EnumProps as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements
Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
Conceptual
EnumPropsEx
PropEnumProc
Reference
Window Properties
EnumThreadWindows function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Enumerates all nonchild windows associated with a thread by passing the handle to each window, in turn, to an
application-defined callback function. EnumThreadWindows continues until the last window is enumerated or
the callback function returns FALSE . To enumerate child windows of a particular window, use the
EnumChildWindows function.

Syntax
BOOL EnumThreadWindows(
DWORD dwThreadId,
WNDENUMPROC lpfn,
LPARAM lParam
);

Parameters
dwThreadId

Type: DWORD
The identifier of the thread whose windows are to be enumerated.
lpfn

Type: WNDENUMPROC
A pointer to an application-defined callback function. For more information, see EnumThreadWndProc.
lParam

Type: LPARAM
An application-defined value to be passed to the callback function.

Return value
Type: BOOL
If the callback function returns TRUE for all windows in the thread specified by dwThreadId, the return value is
TRUE . If the callback function returns FALSE on any enumerated window, or if there are no windows found in
the thread specified by dwThreadId, the return value is FALSE .

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]
Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
EnumChildWindows
EnumThreadWndProc
EnumWindows
Reference
Windows
EnumWindows function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Enumerates all top-level windows on the screen by passing the handle to each window, in turn, to an
application-defined callback function. EnumWindows continues until the last top-level window is enumerated
or the callback function returns FALSE .

Syntax
BOOL EnumWindows(
WNDENUMPROC lpEnumFunc,
LPARAM lParam
);

Parameters
lpEnumFunc

Type: WNDENUMPROC
A pointer to an application-defined callback function. For more information, see EnumWindowsProc.
lParam

Type: LPARAM
An application-defined value to be passed to the callback function.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If EnumWindowsProc returns zero, the return value is also zero. In this case, the callback function should call
SetLastError to obtain a meaningful error code to be returned to the caller of EnumWindows .

Remarks
The EnumWindows function does not enumerate child windows, with the exception of a few top-level windows
owned by the system that have the WS_CHILD style.
This function is more reliable than calling the GetWindow function in a loop. An application that calls
GetWindow to perform this task risks being caught in an infinite loop or referencing a handle to a window that
has been destroyed.

Note For Windows 8 and later, EnumWindows enumerates only top-level windows of desktop apps.
Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
EnumChildWindows
EnumWindowsProc
GetWindow
Reference
Windows
EVENTMSG structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains information about a hardware message sent to the system message queue. This structure is used to
store message information for the JournalPlaybackProc callback function.

Syntax
typedef struct tagEVENTMSG {
UINT message;
UINT paramL;
UINT paramH;
DWORD time;
HWND hwnd;
} EVENTMSG, *PEVENTMSGMSG, *NPEVENTMSGMSG, *LPEVENTMSGMSG, *PEVENTMSG, *NPEVENTMSG, *LPEVENTMSG;

Members
message

Type: UINT
The message.
paramL

Type: UINT
Additional information about the message. The exact meaning depends on the message value.
paramH

Type: UINT
Additional information about the message. The exact meaning depends on the message value.
time

Type: DWORD
The time at which the message was posted.
hwnd

Type: HWND
A handle to the window to which the message was posted.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]
Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
Conceptual
Hooks
JournalPlaybackProc
Reference
SetWindowsHookEx
FindWindowA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves a handle to the top-level window whose class name and window name match the specified strings.
This function does not search child windows. This function does not perform a case-sensitive search.
To search child windows, beginning with a specified child window, use the FindWindowEx function.

Syntax
HWND FindWindowA(
LPCSTR lpClassName,
LPCSTR lpWindowName
);

Parameters
lpClassName

Type: LPCTSTR
The class name or a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The
atom must be in the low-order word of lpClassName; the high-order word must be zero.
If lpClassName points to a string, it specifies the window class name. The class name can be any name
registered with RegisterClass or RegisterClassEx, or any of the predefined control-class names.
If lpClassName is NULL , it finds any window whose title matches the lpWindowName parameter.
lpWindowName

Type: LPCTSTR
The window name (the window's title). If this parameter is NULL , all window names match.

Return value
Type: HWND
If the function succeeds, the return value is a handle to the window that has the specified class name and
window name.
If the function fails, the return value is NULL . To get extended error information, call GetLastError.

Remarks
If the lpWindowName parameter is not NULL , FindWindow calls the GetWindowText function to retrieve the
window name for comparison. For a description of a potential problem that can arise, see the Remarks for
GetWindowText .
Examples
For an example, see Retrieving the Number of Mouse Wheel Scroll Lines.
NOTE
The winuser.h header defines FindWindow as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
EnumWindows
FindWindowEx
GetClassName
GetWindowText
Reference
RegisterClass
RegisterClassEx
Windows
FindWindowExA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves a handle to a window whose class name and window name match the specified strings. The function
searches child windows, beginning with the one following the specified child window. This function does not
perform a case-sensitive search.

Syntax
HWND FindWindowExA(
HWND hWndParent,
HWND hWndChildAfter,
LPCSTR lpszClass,
LPCSTR lpszWindow
);

Parameters
hWndParent

Type: HWND
A handle to the parent window whose child windows are to be searched.
If hwndParent is NULL , the function uses the desktop window as the parent window. The function searches
among windows that are child windows of the desktop.
If hwndParent is HWND_MESSAGE , the function searches all message-only windows.
hWndChildAfter

Type: HWND
A handle to a child window. The search begins with the next child window in the Z order. The child window must
be a direct child window of hwndParent, not just a descendant window.
If hwndChildAfter is NULL , the search begins with the first child window of hwndParent.
Note that if both hwndParent and hwndChildAfter are NULL , the function searches all top-level and message-
only windows.
lpszClass

Type: LPCTSTR
The class name or a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The
atom must be placed in the low-order word of lpszClass; the high-order word must be zero.
If lpszClass is a string, it specifies the window class name. The class name can be any name registered with
RegisterClass or RegisterClassEx, or any of the predefined control-class names, or it can be MAKEINTATOM(0x8000) .
In this latter case, 0x8000 is the atom for a menu class. For more information, see the Remarks section of this
topic.
lpszWindow
Type: LPCTSTR
The window name (the window's title). If this parameter is NULL , all window names match.

Return value
Type: HWND
If the function succeeds, the return value is a handle to the window that has the specified class and window
names.
If the function fails, the return value is NULL . To get extended error information, call GetLastError.

Remarks
If the lpszWindow parameter is not NULL , FindWindowEx calls the GetWindowText function to retrieve the
window name for comparison. For a description of a potential problem that can arise, see the Remarks section
of GetWindowText .
An application can call this function in the following way.
FindWindowEx( NULL, NULL, MAKEINTATOM(0x8000), NULL );

Note that 0x8000 is the atom for a menu class. When an application calls this function, the function checks
whether a context menu is being displayed that the application created.

NOTE
The winuser.h header defines FindWindowEx as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows


8.1)

See also
Conceptual
EnumWindows
FindWindow
GetClassName
GetWindowText
Reference
RegisterClass
RegisterClassEx
Windows
FindWindowExW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves a handle to a window whose class name and window name match the specified strings. The function
searches child windows, beginning with the one following the specified child window. This function does not
perform a case-sensitive search.

Syntax
HWND FindWindowExW(
HWND hWndParent,
HWND hWndChildAfter,
LPCWSTR lpszClass,
LPCWSTR lpszWindow
);

Parameters
hWndParent

Type: HWND
A handle to the parent window whose child windows are to be searched.
If hwndParent is NULL , the function uses the desktop window as the parent window. The function searches
among windows that are child windows of the desktop.
If hwndParent is HWND_MESSAGE , the function searches all message-only windows.
hWndChildAfter

Type: HWND
A handle to a child window. The search begins with the next child window in the Z order. The child window must
be a direct child window of hwndParent, not just a descendant window.
If hwndChildAfter is NULL , the search begins with the first child window of hwndParent.
Note that if both hwndParent and hwndChildAfter are NULL , the function searches all top-level and message-
only windows.
lpszClass

Type: LPCTSTR
The class name or a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The
atom must be placed in the low-order word of lpszClass; the high-order word must be zero.
If lpszClass is a string, it specifies the window class name. The class name can be any name registered with
RegisterClass or RegisterClassEx, or any of the predefined control-class names, or it can be MAKEINTATOM(0x8000) .
In this latter case, 0x8000 is the atom for a menu class. For more information, see the Remarks section of this
topic.
lpszWindow
Type: LPCTSTR
The window name (the window's title). If this parameter is NULL , all window names match.

Return value
Type: HWND
If the function succeeds, the return value is a handle to the window that has the specified class and window
names.
If the function fails, the return value is NULL . To get extended error information, call GetLastError.

Remarks
If the lpszWindow parameter is not NULL , FindWindowEx calls the GetWindowText function to retrieve the
window name for comparison. For a description of a potential problem that can arise, see the Remarks section
of GetWindowText .
An application can call this function in the following way.
FindWindowEx( NULL, NULL, MAKEINTATOM(0x8000), NULL );

Note that 0x8000 is the atom for a menu class. When an application calls this function, the function checks
whether a context menu is being displayed that the application created.

NOTE
The winuser.h header defines FindWindowEx as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows


8.1)

See also
Conceptual
EnumWindows
FindWindow
GetClassName
GetWindowText
Reference
RegisterClass
RegisterClassEx
Windows
FindWindowW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves a handle to the top-level window whose class name and window name match the specified strings.
This function does not search child windows. This function does not perform a case-sensitive search.
To search child windows, beginning with a specified child window, use the FindWindowEx function.

Syntax
HWND FindWindowW(
LPCWSTR lpClassName,
LPCWSTR lpWindowName
);

Parameters
lpClassName

Type: LPCTSTR
The class name or a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The
atom must be in the low-order word of lpClassName; the high-order word must be zero.
If lpClassName points to a string, it specifies the window class name. The class name can be any name
registered with RegisterClass or RegisterClassEx, or any of the predefined control-class names.
If lpClassName is NULL , it finds any window whose title matches the lpWindowName parameter.
lpWindowName

Type: LPCTSTR
The window name (the window's title). If this parameter is NULL , all window names match.

Return value
Type: HWND
If the function succeeds, the return value is a handle to the window that has the specified class name and
window name.
If the function fails, the return value is NULL . To get extended error information, call GetLastError.

Remarks
If the lpWindowName parameter is not NULL , FindWindow calls the GetWindowText function to retrieve the
window name for comparison. For a description of a potential problem that can arise, see the Remarks for
GetWindowText .
Examples
For an example, see Retrieving the Number of Mouse Wheel Scroll Lines.
NOTE
The winuser.h header defines FindWindow as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
EnumWindows
FindWindowEx
GetClassName
GetWindowText
Reference
RegisterClass
RegisterClassEx
Windows
GetAltTabInfoA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves status information for the specified window if it is the application-switching (ALT+TAB) window.

Syntax
BOOL GetAltTabInfoA(
HWND hwnd,
int iItem,
PALTTABINFO pati,
LPSTR pszItemText,
UINT cchItemText
);

Parameters
hwnd

Type: HWND
A handle to the window for which status information will be retrieved. This window must be the application-
switching window.
iItem

Type: int
The index of the icon in the application-switching window. If the pszItemText parameter is not NULL , the name
of the item is copied to the pszItemText string. If this parameter is –1, the name of the item is not copied.
pati

Type: PALTTABINFO
A pointer to an ALTTABINFO structure to receive the status information. Note that you must set the csSize
member to sizeof(ALTTABINFO) before calling this function.
pszItemText

Type: LPTSTR
The name of the item. If this parameter is NULL , the name of the item is not copied.
cchItemText

Type: UINT
The size, in characters, of the pszItemText buffer.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
The application-switching window enables you to switch to the most recently used application window. To
display the application-switching window, press ALT+TAB. To select an application from the list, continue to hold
ALT down and press TAB to move through the list. Add SHIFT to reverse direction through the list.

NOTE
The winuser.h header defines GetAltTabInfo as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
ALTTABINFO
Conceptual
Reference
Windows
GetAltTabInfoW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves status information for the specified window if it is the application-switching (ALT+TAB) window.

Syntax
BOOL GetAltTabInfoW(
HWND hwnd,
int iItem,
PALTTABINFO pati,
LPWSTR pszItemText,
UINT cchItemText
);

Parameters
hwnd

Type: HWND
A handle to the window for which status information will be retrieved. This window must be the application-
switching window.
iItem

Type: int
The index of the icon in the application-switching window. If the pszItemText parameter is not NULL , the name
of the item is copied to the pszItemText string. If this parameter is –1, the name of the item is not copied.
pati

Type: PALTTABINFO
A pointer to an ALTTABINFO structure to receive the status information. Note that you must set the csSize
member to sizeof(ALTTABINFO) before calling this function.
pszItemText

Type: LPTSTR
The name of the item. If this parameter is NULL , the name of the item is not copied.
cchItemText

Type: UINT
The size, in characters, of the pszItemText buffer.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
The application-switching window enables you to switch to the most recently used application window. To
display the application-switching window, press ALT+TAB. To select an application from the list, continue to hold
ALT down and press TAB to move through the list. Add SHIFT to reverse direction through the list.

NOTE
The winuser.h header defines GetAltTabInfo as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
ALTTABINFO
Conceptual
Reference
Windows
GetAncestor function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the handle to the ancestor of the specified window.

Syntax
HWND GetAncestor(
HWND hwnd,
UINT gaFlags
);

Parameters
hwnd

Type: HWND
A handle to the window whose ancestor is to be retrieved. If this parameter is the desktop window, the function
returns NULL .
gaFlags

Type: UINT
The ancestor to be retrieved. This parameter can be one of the following values.

VA L UE M EA N IN G

Retrieves the parent window. This does not include the


GA_PARENT owner, as it does with the GetParent function.
1

Retrieves the root window by walking the chain of parent


GA_ROOT windows.
2

Retrieves the owned root window by walking the chain of


GA_ROOTOWNER parent and owner windows returned by GetParent.
3

Return value
Type: HWND
The return value is the handle to the ancestor window.

Requirements
Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows


8.1)

See also
Conceptual
GetParent
Reference
Windows
GetClassInfoA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves information about a window class.

Note The GetClassInfo function has been superseded by the GetClassInfoEx function. You can still use GetClassInfo ,
however, if you do not need information about the class small icon.

Syntax
BOOL GetClassInfoA(
HINSTANCE hInstance,
LPCSTR lpClassName,
LPWNDCLASSA lpWndClass
);

Parameters
hInstance

Type: HINSTANCE
A handle to the instance of the application that created the class. To retrieve information about classes defined
by the system (such as buttons or list boxes), set this parameter to NULL .
lpClassName

Type: LPCTSTR
The class name. The name must be that of a preregistered class or a class registered by a previous call to the
RegisterClass or RegisterClassEx function.
Alternatively, this parameter can be an atom. If so, it must be a class atom created by a previous call to
RegisterClass or RegisterClassEx. The atom must be in the low-order word of lpClassName; the high-order word
must be zero.
lpWndClass

Type: LPWNDCL ASS


A pointer to a WNDCLASS structure that receives the information about the class.

Return value
Type: BOOL
If the function finds a matching class and successfully copies the data, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
NOTE
The winuser.h header defines GetClassInfo as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)

See also
Conceptual
GetClassInfoEx
GetClassLong
GetClassName
Reference
RegisterClass
RegisterClassEx
WNDCLASS
Window Classes
GetClassInfoExA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves information about a window class, including a handle to the small icon associated with the window
class. The GetClassInfo function does not retrieve a handle to the small icon.

Syntax
BOOL GetClassInfoExA(
HINSTANCE hInstance,
LPCSTR lpszClass,
LPWNDCLASSEXA lpwcx
);

Parameters
hInstance

Type: HINSTANCE
A handle to the instance of the application that created the class. To retrieve information about classes defined
by the system (such as buttons or list boxes), set this parameter to NULL .
lpszClass

Type: LPCTSTR
The class name. The name must be that of a preregistered class or a class registered by a previous call to the
RegisterClass or RegisterClassEx function. Alternatively, this parameter can be a class atom created by a previous
call to RegisterClass or RegisterClassEx . The atom must be in the low-order word of lpszClass; the high-
order word must be zero.
lpwcx

Type: LPWNDCL ASSEX


A pointer to a WNDCLASSEX structure that receives the information about the class.

Return value
Type: BOOL
If the function finds a matching class and successfully copies the data, the return value is nonzero.
If the function does not find a matching class and successfully copy the data, the return value is zero. To get
extended error information, call GetLastError.

Remarks
Class atoms are created using the RegisterClass or RegisterClassEx function, not the GlobalAddAtom function.
NOTE
The winuser.h header defines GetClassInfoEx as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)

See also
Conceptual
GetClassLong
GetClassName
Reference
RegisterClass
RegisterClassEx
Window Classes
GetClassInfoExW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves information about a window class, including a handle to the small icon associated with the window
class. The GetClassInfo function does not retrieve a handle to the small icon.

Syntax
BOOL GetClassInfoExW(
HINSTANCE hInstance,
LPCWSTR lpszClass,
LPWNDCLASSEXW lpwcx
);

Parameters
hInstance

Type: HINSTANCE
A handle to the instance of the application that created the class. To retrieve information about classes defined
by the system (such as buttons or list boxes), set this parameter to NULL .
lpszClass

Type: LPCTSTR
The class name. The name must be that of a preregistered class or a class registered by a previous call to the
RegisterClass or RegisterClassEx function. Alternatively, this parameter can be a class atom created by a previous
call to RegisterClass or RegisterClassEx . The atom must be in the low-order word of lpszClass; the high-
order word must be zero.
lpwcx

Type: LPWNDCL ASSEX


A pointer to a WNDCLASSEX structure that receives the information about the class.

Return value
Type: BOOL
If the function finds a matching class and successfully copies the data, the return value is nonzero.
If the function does not find a matching class and successfully copy the data, the return value is zero. To get
extended error information, call GetLastError.

Remarks
Class atoms are created using the RegisterClass or RegisterClassEx function, not the GlobalAddAtom function.
NOTE
The winuser.h header defines GetClassInfoEx as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)

See also
Conceptual
GetClassLong
GetClassName
Reference
RegisterClass
RegisterClassEx
Window Classes
GetClassInfoW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves information about a window class.

Note The GetClassInfo function has been superseded by the GetClassInfoEx function. You can still use GetClassInfo ,
however, if you do not need information about the class small icon.

Syntax
BOOL GetClassInfoW(
HINSTANCE hInstance,
LPCWSTR lpClassName,
LPWNDCLASSW lpWndClass
);

Parameters
hInstance

Type: HINSTANCE
A handle to the instance of the application that created the class. To retrieve information about classes defined
by the system (such as buttons or list boxes), set this parameter to NULL .
lpClassName

Type: LPCTSTR
The class name. The name must be that of a preregistered class or a class registered by a previous call to the
RegisterClass or RegisterClassEx function.
Alternatively, this parameter can be an atom. If so, it must be a class atom created by a previous call to
RegisterClass or RegisterClassEx. The atom must be in the low-order word of lpClassName; the high-order word
must be zero.
lpWndClass

Type: LPWNDCL ASS


A pointer to a WNDCLASS structure that receives the information about the class.

Return value
Type: BOOL
If the function finds a matching class and successfully copies the data, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
NOTE
The winuser.h header defines GetClassInfo as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)

See also
Conceptual
GetClassInfoEx
GetClassLong
GetClassName
Reference
RegisterClass
RegisterClassEx
WNDCLASS
Window Classes
GetClassLongA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the specified 32-bit (DWORD ) value from the WNDCLASSEX structure associated with the specified
window.

Note If you are retrieving a pointer or a handle, this function has been superseded by the GetClassLongPtr function.
(Pointers and handles are 32 bits on 32-bit Windows and 64 bits on 64-bit Windows.)

Syntax
DWORD GetClassLongA(
HWND hWnd,
int nIndex
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
nIndex

Type: int
The value to be retrieved. To retrieve a value from the extra class memory, specify the positive, zero-based byte
offset of the value to be retrieved. Valid values are in the range zero through the number of bytes of extra class
memory, minus four; for example, if you specified 12 or more bytes of extra class memory, a value of 8 would
be an index to the third integer. To retrieve any other value from the WNDCLASSEX structure, specify one of the
following values.

VA L UE M EA N IN G

Retrieves an ATOM value that uniquely identifies the


GCW_ATOM window class. This is the same atom that the RegisterClassEx
-32 function returns.

Retrieves the size, in bytes, of the extra memory associated


GCL_CBCLSEXTRA with the class.
-20

Retrieves the size, in bytes, of the extra window memory


GCL_CBWNDEXTRA associated with each window in the class. For information on
-18 how to access this memory, see GetWindowLong.
Retrieves a handle to the background brush associated with
GCL_HBRBACKGROUND the class.
-10

Retrieves a handle to the cursor associated with the class.


GCL_HCURSOR
-12

Retrieves a handle to the icon associated with the class.


GCL_HICON
-14

Retrieves a handle to the small icon associated with the class.


GCL_HICONSM
-34

Retrieves a handle to the module that registered the class.


GCL_HMODULE
-16

Retrieves the address of the menu name string. The string


GCL_MENUNAME identifies the menu resource associated with the class.
-8

Retrieves the window-class style bits.


GCL_STYLE
-26

Retrieves the address of the window procedure, or a handle


GCL_WNDPROC representing the address of the window procedure. You
-24 must use the CallWindowProc function to call the window
procedure.

Return value
Type: DWORD
If the function succeeds, the return value is the requested value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
Reserve extra class memory by specifying a nonzero value in the cbClsExtra member of the WNDCLASSEX
structure used with the RegisterClassEx function.

NOTE
The winuser.h header defines GetClassLong as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.
Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-1 (introduced in


Windows 8.1)

See also
Conceptual
GetClassLongPtr
GetWindowLong
Reference
RegisterClassEx
SetClassLong
WNDCLASSEX
Window Classes
GetClassLongPtrA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the specified value from the WNDCLASSEX structure associated with the specified window.

Note To write code that is compatible with both 32-bit and 64-bit versions of Windows, use GetClassLongPtr . When
compiling for 32-bit Windows, GetClassLongPtr is defined as a call to the GetClassLong function.

Syntax
ULONG_PTR GetClassLongPtrA(
HWND hWnd,
int nIndex
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
nIndex

Type: int
The value to be retrieved. To retrieve a value from the extra class memory, specify the positive, zero-based byte
offset of the value to be retrieved. Valid values are in the range zero through the number of bytes of extra class
memory, minus eight; for example, if you specified 24 or more bytes of extra class memory, a value of 16 would
be an index to the third integer. To retrieve any other value from the WNDCLASSEX structure, specify one of the
following values.

VA L UE M EA N IN G

Retrieves an ATOM value that uniquely identifies the


GCW_ATOM window class. This is the same atom that the RegisterClassEx
-32 function returns.

Retrieves the size, in bytes, of the extra memory associated


GCL_CBCLSEXTRA with the class.
-20

Retrieves the size, in bytes, of the extra window memory


GCL_CBWNDEXTRA associated with each window in the class. For information on
-18 how to access this memory, see GetWindowLongPtr.
Retrieves a handle to the background brush associated with
GCLP_HBRBACKGROUND the class.
-10

Retrieves a handle to the cursor associated with the class.


GCLP_HCURSOR
-12

Retrieves a handle to the icon associated with the class.


GCLP_HICON
-14

Retrieves a handle to the small icon associated with the class.


GCLP_HICONSM
-34

Retrieves a handle to the module that registered the class.


GCLP_HMODULE
-16

Retrieves the pointer to the menu name string. The string


GCLP_MENUNAME identifies the menu resource associated with the class.
-8

Retrieves the window-class style bits.


GCL_STYLE
-26

Retrieves the address of the window procedure, or a handle


GCLP_WNDPROC representing the address of the window procedure. You
-24 must use the CallWindowProc function to call the window
procedure.

Return value
Type: ULONG_PTR
If the function succeeds, the return value is the requested value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
Reserve extra class memory by specifying a nonzero value in the cbClsExtra member of the WNDCLASSEX
structure used with the RegisterClassEx function.

NOTE
The winuser.h header defines GetClassLongPtr as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.
Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-2 (introduced in


Windows 10, version 10.0.10240)

See also
Conceptual
GetWindowLongPtr
Reference
RegisterClassEx
SetClassLongPtr
WNDCLASSEX
Window Classes
GetClassLongPtrW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the specified value from the WNDCLASSEX structure associated with the specified window.

Note To write code that is compatible with both 32-bit and 64-bit versions of Windows, use GetClassLongPtr . When
compiling for 32-bit Windows, GetClassLongPtr is defined as a call to the GetClassLong function.

Syntax
ULONG_PTR GetClassLongPtrW(
HWND hWnd,
int nIndex
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
nIndex

Type: int
The value to be retrieved. To retrieve a value from the extra class memory, specify the positive, zero-based byte
offset of the value to be retrieved. Valid values are in the range zero through the number of bytes of extra class
memory, minus eight; for example, if you specified 24 or more bytes of extra class memory, a value of 16 would
be an index to the third integer. To retrieve any other value from the WNDCLASSEX structure, specify one of the
following values.

VA L UE M EA N IN G

Retrieves an ATOM value that uniquely identifies the


GCW_ATOM window class. This is the same atom that the RegisterClassEx
-32 function returns.

Retrieves the size, in bytes, of the extra memory associated


GCL_CBCLSEXTRA with the class.
-20

Retrieves the size, in bytes, of the extra window memory


GCL_CBWNDEXTRA associated with each window in the class. For information on
-18 how to access this memory, see GetWindowLongPtr.
Retrieves a handle to the background brush associated with
GCLP_HBRBACKGROUND the class.
-10

Retrieves a handle to the cursor associated with the class.


GCLP_HCURSOR
-12

Retrieves a handle to the icon associated with the class.


GCLP_HICON
-14

Retrieves a handle to the small icon associated with the class.


GCLP_HICONSM
-34

Retrieves a handle to the module that registered the class.


GCLP_HMODULE
-16

Retrieves the pointer to the menu name string. The string


GCLP_MENUNAME identifies the menu resource associated with the class.
-8

Retrieves the window-class style bits.


GCL_STYLE
-26

Retrieves the address of the window procedure, or a handle


GCLP_WNDPROC representing the address of the window procedure. You
-24 must use the CallWindowProc function to call the window
procedure.

Return value
Type: ULONG_PTR
If the function succeeds, the return value is the requested value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
Reserve extra class memory by specifying a nonzero value in the cbClsExtra member of the WNDCLASSEX
structure used with the RegisterClassEx function.

NOTE
The winuser.h header defines GetClassLongPtr as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.
Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-2 (introduced in


Windows 10, version 10.0.10240)

See also
Conceptual
GetWindowLongPtr
Reference
RegisterClassEx
SetClassLongPtr
WNDCLASSEX
Window Classes
GetClassLongW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the specified 32-bit (DWORD ) value from the WNDCLASSEX structure associated with the specified
window.

Note If you are retrieving a pointer or a handle, this function has been superseded by the GetClassLongPtr function.
(Pointers and handles are 32 bits on 32-bit Windows and 64 bits on 64-bit Windows.)

Syntax
DWORD GetClassLongW(
HWND hWnd,
int nIndex
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
nIndex

Type: int
The value to be retrieved. To retrieve a value from the extra class memory, specify the positive, zero-based byte
offset of the value to be retrieved. Valid values are in the range zero through the number of bytes of extra class
memory, minus four; for example, if you specified 12 or more bytes of extra class memory, a value of 8 would
be an index to the third integer. To retrieve any other value from the WNDCLASSEX structure, specify one of the
following values.

VA L UE M EA N IN G

Retrieves an ATOM value that uniquely identifies the


GCW_ATOM window class. This is the same atom that the RegisterClassEx
-32 function returns.

Retrieves the size, in bytes, of the extra memory associated


GCL_CBCLSEXTRA with the class.
-20

Retrieves the size, in bytes, of the extra window memory


GCL_CBWNDEXTRA associated with each window in the class. For information on
-18 how to access this memory, see GetWindowLong.
Retrieves a handle to the background brush associated with
GCL_HBRBACKGROUND the class.
-10

Retrieves a handle to the cursor associated with the class.


GCL_HCURSOR
-12

Retrieves a handle to the icon associated with the class.


GCL_HICON
-14

Retrieves a handle to the small icon associated with the class.


GCL_HICONSM
-34

Retrieves a handle to the module that registered the class.


GCL_HMODULE
-16

Retrieves the address of the menu name string. The string


GCL_MENUNAME identifies the menu resource associated with the class.
-8

Retrieves the window-class style bits.


GCL_STYLE
-26

Retrieves the address of the window procedure, or a handle


GCL_WNDPROC representing the address of the window procedure. You
-24 must use the CallWindowProc function to call the window
procedure.

Return value
Type: DWORD
If the function succeeds, the return value is the requested value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
Reserve extra class memory by specifying a nonzero value in the cbClsExtra member of the WNDCLASSEX
structure used with the RegisterClassEx function.

NOTE
The winuser.h header defines GetClassLong as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.
Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-1 (introduced in


Windows 8.1)

See also
Conceptual
GetClassLongPtr
GetWindowLong
Reference
RegisterClassEx
SetClassLong
WNDCLASSEX
Window Classes
GetClassName function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the name of the class to which the specified window belongs.

Syntax
int GetClassName(
HWND hWnd,
LPTSTR lpClassName,
int nMaxCount
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
lpClassName

Type: LPTSTR
The class name string.
nMaxCount

Type: int
The length of the lpClassName buffer, in characters. The buffer must be large enough to include the terminating
null character; otherwise, the class name string is truncated to nMaxCount-1 characters.

Return value
Type: int
If the function succeeds, the return value is the number of characters copied to the buffer, not including the
terminating null character.
If the function fails, the return value is zero. To get extended error information, call GetLastError function.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows


Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)

See also
FindWindowA function, GetClassInfoA function, GetClassLongA function, GetClassWord function, Window
Classes
GetClassNameA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the name of the class to which the specified window belongs.

Syntax
int GetClassNameA(
HWND hWnd,
LPSTR lpClassName,
int nMaxCount
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
lpClassName

Type: LPTSTR
The class name string.
nMaxCount

Type: int
The length of the lpClassName buffer, in characters. The buffer must be large enough to include the terminating
null character; otherwise, the class name string is truncated to nMaxCount-1 characters.

Return value
Type: int
If the function succeeds, the return value is the number of characters copied to the buffer, not including the
terminating null character.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
NOTE
The winuser.h header defines GetClassName as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.
Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)

See also
Conceptual
FindWindow
GetClassInfo
GetClassLong
GetClassWord
Reference
Window Classes
GetClassNameW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the name of the class to which the specified window belongs.

Syntax
int GetClassNameW(
HWND hWnd,
LPWSTR lpClassName,
int nMaxCount
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
lpClassName

Type: LPTSTR
The class name string.
nMaxCount

Type: int
The length of the lpClassName buffer, in characters. The buffer must be large enough to include the terminating
null character; otherwise, the class name string is truncated to nMaxCount-1 characters.

Return value
Type: int
If the function succeeds, the return value is the number of characters copied to the buffer, not including the
terminating null character.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
NOTE
The winuser.h header defines GetClassName as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.
Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)

See also
Conceptual
FindWindow
GetClassInfo
GetClassLong
GetClassWord
Reference
Window Classes
GetClassWord function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the 16-bit (WORD ) value at the specified offset into the extra class memory for the window class to
which the specified window belongs.

Note This function is deprecated for any use other than nIndex set to GCW_ATOM . The function is provided only for
compatibility with 16-bit versions of Windows. Applications should use the GetClassLongPtr or GetClassLongPtr function.

Syntax
WORD GetClassWord(
HWND hWnd,
int nIndex
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
nIndex

Type: int
The zero-based byte offset of the value to be retrieved. Valid values are in the range zero through the number of
bytes of class memory, minus two; for example, if you specified 10 or more bytes of extra class memory, a value
of eight would be an index to the fifth 16-bit integer. There is an additional valid value as shown in the following
table.

VA L UE M EA N IN G

Retrieves an ATOM value that uniquely identifies the


GCW_ATOM window class. This is the same atom that the RegisterClass or
-32 RegisterClassEx function returns.

Return value
Type: WORD
If the function succeeds, the return value is the requested 16-bit value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
Reserve extra class memory by specifying a nonzero value in the cbClsExtra member of the WNDCLASS
structure used with the RegisterClass function.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-2 (introduced in


Windows 10, version 10.0.10240)

See also
Conceptual
GetClassLong
Reference
RegisterClass
RegisterClassEx
SetClassWord
WNDCLASS
Window Classes
GetClientRect function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the coordinates of a window's client area. The client coordinates specify the upper-left and lower-right
corners of the client area. Because client coordinates are relative to the upper-left corner of a window's client
area, the coordinates of the upper-left corner are (0,0).

Syntax
BOOL GetClientRect(
HWND hWnd,
LPRECT lpRect
);

Parameters
hWnd

Type: HWND
A handle to the window whose client coordinates are to be retrieved.
lpRect

Type: LPRECT
A pointer to a RECT structure that receives the client coordinates. The left and top members are zero. The right
and bottom members contain the width and height of the window.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
In conformance with conventions for the RECT structure, the bottom-right coordinates of the returned rectangle
are exclusive. In other words, the pixel at (right , bottom ) lies immediately outside the rectangle.
Examples
For example, see Creating, Enumerating, and Sizing Child Windows.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]
Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetWindowRect
Other Resources
RECT
Reference
Windows
GetDesktopWindow function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves a handle to the desktop window. The desktop window covers the entire screen. The desktop window is
the area on top of which other windows are painted.

Syntax
HWND GetDesktopWindow();

Parameters
This function has no parameters.

Return value
Type: HWND
The return value is a handle to the desktop window.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetWindow
Reference
Windows
GetForegroundWindow function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves a handle to the foreground window (the window with which the user is currently working). The system
assigns a slightly higher priority to the thread that creates the foreground window than it does to other threads.

Syntax
HWND GetForegroundWindow();

Parameters
This function has no parameters.

Return value
Type: HWND
The return value is a handle to the foreground window. The foreground window can be NULL in certain
circumstances, such as when a window is losing activation.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
Reference
SetForegroundWindow
Windows
GetGUIThreadInfo function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves information about the active window or a specified GUI thread.

Syntax
BOOL GetGUIThreadInfo(
DWORD idThread,
PGUITHREADINFO pgui
);

Parameters
idThread

Type: DWORD
The identifier for the thread for which information is to be retrieved. To retrieve this value, use the
GetWindowThreadProcessId function. If this parameter is NULL , the function returns information for the
foreground thread.
pgui

Type: LPGUITHREADINFO
A pointer to a GUITHREADINFO structure that receives information describing the thread. Note that you must
set the cbSize member to sizeof(GUITHREADINFO) before calling this function.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
This function succeeds even if the active window is not owned by the calling process. If the specified thread does
not exist or have an input queue, the function will fail.
This function is useful for retrieving out-of-context information about a thread. The information retrieved is the
same as if an application retrieved the information about itself.
For an edit control, the returned rcCaret rectangle contains the caret plus information on text direction and
padding. Thus, it may not give the correct position of the cursor. The Sans Serif font uses four characters for the
cursor:

C URSO R C H A RA C T ER UN IC O DE C O DE P O IN T

CURSOR_LTR 0xf00c
CURSOR_RTL 0xf00d

CURSOR_THAI 0xf00e

CURSOR_USA 0xfff (this is a marker value with no associated glyph)

To get the actual insertion point in the rcCaret rectangle, perform the following steps.
1. Call GetKeyboardLayout to retrieve the current input language.
2. Determine the character used for the cursor, based on the current input language.
3. Call CreateFont using Sans Serif for the font, the height given by rcCaret , and a width of zero . For fnWeight
, call SystemParametersInfo(SPI_GETCARETWIDTH, 0, pvParam, 0) . If pvParam is greater than 1, set fnWeight to
700, otherwise set fnWeight to 400.
4. Select the font into a device context (DC) and use GetCharABCWidths to get the B width of the appropriate
cursor character.
5. Add the B width to rcCaret .left to obtain the actual insertion point.
The function may not return valid window handles in the GUITHREADINFO structure when called to retrieve
information for the foreground thread, such as when a window is losing activation.
DPI Virtualization
The coordinates returned in the rcCaret rect of the GUITHREADINFO struct are logical coordinates in terms of the
window associated with the caret. They are not virtualized into the mode of the calling thread.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows


8.1)

See also
Conceptual
GUITHREADINFO
GetCursorInfo
GetWindowThreadProcessId
Reference
Windows
GetInputState function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Determines whether there are mouse-button or keyboard messages in the calling thread's message queue.

Syntax
BOOL GetInputState();

Parameters
This function has no parameters.

Return value
Type: BOOL
If the queue contains one or more new mouse-button or keyboard messages, the return value is nonzero.
If there are no new mouse-button or keyboard messages in the queue, the return value is zero.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
Conceptual
GetQueueStatus
Messages and Message Queues
Reference
GetLastActivePopup function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Determines which pop-up window owned by the specified window was most recently active.

Syntax
HWND GetLastActivePopup(
HWND hWnd
);

Parameters
hWnd

Type: HWND
A handle to the owner window.

Return value
Type: HWND
The return value identifies the most recently active pop-up window. The return value is the same as the hWnd
parameter, if any of the following conditions are met:
The window identified by hWnd was most recently active.
The window identified by hWnd does not own any pop-up windows.
The window identifies by hWnd is not a top-level window, or it is owned by another window.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-3 (introduced in Windows


10, version 10.0.10240)
See also
AnyPopup
Conceptual
Reference
ShowOwnedPopups
Windows
GetLayeredWindowAttributes function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the opacity and transparency color key of a layered window.

Syntax
BOOL GetLayeredWindowAttributes(
HWND hwnd,
COLORREF *pcrKey,
BYTE *pbAlpha,
DWORD *pdwFlags
);

Parameters
hwnd

Type: HWND
A handle to the layered window. A layered window is created by specifying WS_EX_L AYERED when creating
the window with the CreateWindowEx function or by setting WS_EX_L AYERED using SetWindowLong after the
window has been created.
pcrKey

Type: COLORREF *
A pointer to a COLORREF value that receives the transparency color key to be used when composing the layered
window. All pixels painted by the window in this color will be transparent. This can be NULL if the argument is
not needed.
pbAlpha

Type: BYTE*
The Alpha value used to describe the opacity of the layered window. Similar to the SourceConstantAlpha
member of the BLENDFUNCTION structure. When the variable referred to by pbAlpha is 0, the window is
completely transparent. When the variable referred to by pbAlpha is 255, the window is opaque. This can be
NULL if the argument is not needed.
pdwFlags

Type: DWORD*
A layering flag. This parameter can be NULL if the value is not needed. The layering flag can be one or more of
the following values.

VA L UE M EA N IN G

Use pbAlpha to determine the opacity of the layered


LWA_ALPHA window.
0x00000002
Use pcrKey as the transparency color.
LWA_COLORKEY
0x00000001

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
GetLayeredWindowAttributes can be called only if the application has previously called
SetLayeredWindowAttributes on the window. The function will fail if the layered window was setup with
UpdateLayeredWindow.
For more information, see Using Layered Windows.

Requirements

Minimum suppor ted client Windows XP [desktop apps only]

Minimum suppor ted ser ver Windows Server 2003 [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows


8.1)

See also
Conceptual
CreateWindowEx
Reference
SetLayeredWindowAttributes
SetWindowLong
Using Windows
Windows
GetMessage function (winuser.h)
2/1/2021 • 4 minutes to read • Edit Online

Retrieves a message from the calling thread's message queue. The function dispatches incoming sent messages
until a posted message is available for retrieval.
Unlike GetMessage , the PeekMessage function does not wait for a message to be posted before returning.

Syntax
BOOL GetMessage(
LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax
);

Parameters
lpMsg

Type: LPMSG
A pointer to an MSG structure that receives message information from the thread's message queue.
hWnd

Type: HWND
A handle to the window whose messages are to be retrieved. The window must belong to the current thread.
If hWnd is NULL , GetMessage retrieves messages for any window that belongs to the current thread, and any
messages on the current thread's message queue whose hwnd value is NULL (see the MSG structure).
Therefore if hWnd is NULL , both window messages and thread messages are processed.
If hWnd is -1, GetMessage retrieves only messages on the current thread's message queue whose hwnd value
is NULL , that is, thread messages as posted by PostMessage (when the hWnd parameter is NULL ) or
PostThreadMessage.
wMsgFilterMin

Type: UINT
The integer value of the lowest message value to be retrieved. Use WM_KEYFIRST (0x0100) to specify the first
keyboard message or WM_MOUSEFIRST (0x0200) to specify the first mouse message.
Use WM_INPUT here and in wMsgFilterMax to specify only the WM_INPUT messages.
If wMsgFilterMin and wMsgFilterMax are both zero, GetMessage returns all available messages (that is, no
range filtering is performed).
wMsgFilterMax

Type: UINT
The integer value of the highest message value to be retrieved. Use WM_KEYL AST to specify the last keyboard
message or WM_MOUSEL AST to specify the last mouse message.
Use WM_INPUT here and in wMsgFilterMin to specify only the WM_INPUT messages.
If wMsgFilterMin and wMsgFilterMax are both zero, GetMessage returns all available messages (that is, no
range filtering is performed).

Return value
Type: BOOL
If the function retrieves a message other than WM_QUIT, the return value is nonzero.
If the function retrieves the WM_QUIT message, the return value is zero.
If there is an error, the return value is -1. For example, the function fails if hWnd is an invalid window handle or
lpMsg is an invalid pointer. To get extended error information, call GetLastError.
Because the return value can be nonzero, zero, or -1, avoid code like this:

while (GetMessage( lpMsg, hWnd, 0, 0)) ...

The possibility of a -1 return value in the case that hWnd is an invalid parameter (such as referring to a window
that has already been destroyed) means that such code can lead to fatal application errors. Instead, use code like
this:

BOOL bRet;

while( (bRet = GetMessage( &msg, hWnd, 0, 0 )) != 0)


{
if (bRet == -1)
{
// handle the error and possibly exit
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}

Remarks
An application typically uses the return value to determine whether to end the main message loop and exit the
program.
The GetMessage function retrieves messages associated with the window identified by the hWnd parameter or
any of its children, as specified by the IsChild function, and within the range of message values given by the
wMsgFilterMin and wMsgFilterMax parameters. Note that an application can only use the low word in the
wMsgFilterMin and wMsgFilterMax parameters; the high word is reserved for the system.
Note that GetMessage always retrieves WM_QUIT messages, no matter which values you specify for
wMsgFilterMin and wMsgFilterMax.
During this call, the system delivers pending, nonqueued messages, that is, messages sent to windows owned
by the calling thread using the SendMessage, SendMessageCallback, SendMessageTimeout, or
SendNotifyMessage function. Then the first queued message that matches the specified filter is retrieved. The
system may also process internal events. If no filter is specified, messages are processed in the following order:
Sent messages
Posted messages
Input (hardware) messages and system internal events
Sent messages (again)
WM_PAINT messages
WM_TIMER messages
To retrieve input messages before posted messages, use the wMsgFilterMin and wMsgFilterMax parameters.
GetMessage does not remove WM_PAINT messages from the queue. The messages remain in the queue until
processed.
If a top-level window stops responding to messages for more than several seconds, the system considers the
window to be not responding and replaces it with a ghost window that has the same z-order, location, size, and
visual attributes. This allows the user to move it, resize it, or even close the application. However, these are the
only actions available because the application is actually not responding. When in the debugger mode, the
system does not generate a ghost window.
DPI Virtualization
This API does not participate in DPI virtualization. The output is in the mode of the window that the message is
targeting. The calling thread is not taken into consideration.
Examples
For an example, see Creating a Message Loop.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
IsChild
MSG
Messages and Message Queues
PeekMessage
PostMessage
PostThreadMessage
Reference
WaitMessage
GetMessageA function (winuser.h)
2/1/2021 • 4 minutes to read • Edit Online

Retrieves a message from the calling thread's message queue. The function dispatches incoming sent messages
until a posted message is available for retrieval.
Unlike GetMessage , the PeekMessage function does not wait for a message to be posted before returning.

Syntax
BOOL GetMessageA(
LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax
);

Parameters
lpMsg

Type: LPMSG
A pointer to an MSG structure that receives message information from the thread's message queue.
hWnd

Type: HWND
A handle to the window whose messages are to be retrieved. The window must belong to the current thread.
If hWnd is NULL , GetMessage retrieves messages for any window that belongs to the current thread, and any
messages on the current thread's message queue whose hwnd value is NULL (see the MSG structure).
Therefore if hWnd is NULL , both window messages and thread messages are processed.
If hWnd is -1, GetMessage retrieves only messages on the current thread's message queue whose hwnd value
is NULL , that is, thread messages as posted by PostMessage (when the hWnd parameter is NULL ) or
PostThreadMessage.
wMsgFilterMin

Type: UINT
The integer value of the lowest message value to be retrieved. Use WM_KEYFIRST (0x0100) to specify the first
keyboard message or WM_MOUSEFIRST (0x0200) to specify the first mouse message.
Use WM_INPUT here and in wMsgFilterMax to specify only the WM_INPUT messages.
If wMsgFilterMin and wMsgFilterMax are both zero, GetMessage returns all available messages (that is, no
range filtering is performed).
wMsgFilterMax

Type: UINT
The integer value of the highest message value to be retrieved. Use WM_KEYL AST to specify the last keyboard
message or WM_MOUSEL AST to specify the last mouse message.
Use WM_INPUT here and in wMsgFilterMin to specify only the WM_INPUT messages.
If wMsgFilterMin and wMsgFilterMax are both zero, GetMessage returns all available messages (that is, no
range filtering is performed).

Return value
Type: BOOL
If the function retrieves a message other than WM_QUIT, the return value is nonzero.
If the function retrieves the WM_QUIT message, the return value is zero.
If there is an error, the return value is -1. For example, the function fails if hWnd is an invalid window handle or
lpMsg is an invalid pointer. To get extended error information, call GetLastError.
Because the return value can be nonzero, zero, or -1, avoid code like this:

while (GetMessage( lpMsg, hWnd, 0, 0)) ...

The possibility of a -1 return value in the case that hWnd is an invalid parameter (such as referring to a window
that has already been destroyed) means that such code can lead to fatal application errors. Instead, use code like
this:

BOOL bRet;

while( (bRet = GetMessage( &msg, hWnd, 0, 0 )) != 0)


{
if (bRet == -1)
{
// handle the error and possibly exit
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}

Remarks
An application typically uses the return value to determine whether to end the main message loop and exit the
program.
The GetMessage function retrieves messages associated with the window identified by the hWnd parameter or
any of its children, as specified by the IsChild function, and within the range of message values given by the
wMsgFilterMin and wMsgFilterMax parameters. Note that an application can only use the low word in the
wMsgFilterMin and wMsgFilterMax parameters; the high word is reserved for the system.
Note that GetMessage always retrieves WM_QUIT messages, no matter which values you specify for
wMsgFilterMin and wMsgFilterMax.
During this call, the system delivers pending, nonqueued messages, that is, messages sent to windows owned
by the calling thread using the SendMessage, SendMessageCallback, SendMessageTimeout, or
SendNotifyMessage function. Then the first queued message that matches the specified filter is retrieved. The
system may also process internal events. If no filter is specified, messages are processed in the following order:
Sent messages
Posted messages
Input (hardware) messages and system internal events
Sent messages (again)
WM_PAINT messages
WM_TIMER messages
To retrieve input messages before posted messages, use the wMsgFilterMin and wMsgFilterMax parameters.
GetMessage does not remove WM_PAINT messages from the queue. The messages remain in the queue until
processed.
If a top-level window stops responding to messages for more than several seconds, the system considers the
window to be not responding and replaces it with a ghost window that has the same z-order, location, size, and
visual attributes. This allows the user to move it, resize it, or even close the application. However, these are the
only actions available because the application is actually not responding. When in the debugger mode, the
system does not generate a ghost window.
DPI Virtualization
This API does not participate in DPI virtualization. The output is in the mode of the window that the message is
targeting. The calling thread is not taken into consideration.
Examples
For an example, see Creating a Message Loop.

NOTE
The winuser.h header defines GetMessage as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
IsChild
MSG
Messages and Message Queues
PeekMessage
PostMessage
PostThreadMessage
Reference
WaitMessage
GetMessageExtraInfo function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the extra message information for the current thread. Extra message information is an application- or
driver-defined value associated with the current thread's message queue.

Syntax
LPARAM GetMessageExtraInfo();

Parameters
This function has no parameters.

Return value
Type: LPARAM
The return value specifies the extra information. The meaning of the extra information is device specific.

Remarks
To set a thread's extra message information, use the SetMessageExtraInfo function.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows


10, version 10.0.14393)

See also
Conceptual
GetMessage
Messages and Message Queues
PeekMessage
Reference
SetMessageExtraInfo
GetMessagePos function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the cursor position for the last message retrieved by the GetMessage function.
To determine the current position of the cursor, use the GetCursorPos function.

Syntax
DWORD GetMessagePos();

Parameters
This function has no parameters.

Return value
Type: DWORD
The return value specifies the x- and y-coordinates of the cursor position. The x-coordinate is the low order
shor t and the y-coordinate is the high-order shor t .

Remarks
As noted above, the x-coordinate is in the low-order shor t of the return value; the y-coordinate is in the high-
order shor t (both represent signed values because they can take negative values on systems with multiple
monitors). If the return value is assigned to a variable, you can use the MAKEPOINTS macro to obtain a POINTS
structure from the return value. You can also use the GET_X_LPARAM or GET_Y_LPARAM macro to extract the x-
or y-coordinate.

Impor tant Do not use the LOWORD or HIWORD macros to extract the x- and y- coordinates of the cursor position because
these macros return incorrect results on systems with multiple monitors. Systems with multiple monitors can have negative x-
and y- coordinates, and LOWORD and HIWORD treat the coordinates as unsigned quantities.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)


Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-1 (introduced in Windows


8.1)

See also
Conceptual
GetCursorPos
GetMessage
GetMessageTime
HIWORD
LOWORD
MAKEPOINTS
Messages and Message Queues
Other Resources
POINTS
Reference
GetMessageTime function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the message time for the last message retrieved by the GetMessage function. The time is a long
integer that specifies the elapsed time, in milliseconds, from the time the system was started to the time the
message was created (that is, placed in the thread's message queue).

Syntax
LONG GetMessageTime();

Parameters
This function has no parameters.

Return value
Type: LONG
The return value specifies the message time.

Remarks
The return value from the GetMessageTime function does not necessarily increase between subsequent
messages, because the value wraps to the minimum value for a long integer if the timer count exceeds the
maximum value for a long integer.
To calculate time delays between messages, subtract the time of the first message from the time of the second
message (ignoring overflow) and compare the result of the subtraction against the desired delay amount.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-1 (introduced in Windows


8.1)
See also
Conceptual
GetMessage
GetMessagePos
Messages and Message Queues
Reference
GetMessageW function (winuser.h)
2/1/2021 • 4 minutes to read • Edit Online

Retrieves a message from the calling thread's message queue. The function dispatches incoming sent messages
until a posted message is available for retrieval.
Unlike GetMessage , the PeekMessage function does not wait for a message to be posted before returning.

Syntax
BOOL GetMessageW(
LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax
);

Parameters
lpMsg

Type: LPMSG
A pointer to an MSG structure that receives message information from the thread's message queue.
hWnd

Type: HWND
A handle to the window whose messages are to be retrieved. The window must belong to the current thread.
If hWnd is NULL , GetMessage retrieves messages for any window that belongs to the current thread, and any
messages on the current thread's message queue whose hwnd value is NULL (see the MSG structure).
Therefore if hWnd is NULL , both window messages and thread messages are processed.
If hWnd is -1, GetMessage retrieves only messages on the current thread's message queue whose hwnd value
is NULL , that is, thread messages as posted by PostMessage (when the hWnd parameter is NULL ) or
PostThreadMessage.
wMsgFilterMin

Type: UINT
The integer value of the lowest message value to be retrieved. Use WM_KEYFIRST (0x0100) to specify the first
keyboard message or WM_MOUSEFIRST (0x0200) to specify the first mouse message.
Use WM_INPUT here and in wMsgFilterMax to specify only the WM_INPUT messages.
If wMsgFilterMin and wMsgFilterMax are both zero, GetMessage returns all available messages (that is, no
range filtering is performed).
wMsgFilterMax

Type: UINT
The integer value of the highest message value to be retrieved. Use WM_KEYL AST to specify the last keyboard
message or WM_MOUSEL AST to specify the last mouse message.
Use WM_INPUT here and in wMsgFilterMin to specify only the WM_INPUT messages.
If wMsgFilterMin and wMsgFilterMax are both zero, GetMessage returns all available messages (that is, no
range filtering is performed).

Return value
Type: BOOL
If the function retrieves a message other than WM_QUIT, the return value is nonzero.
If the function retrieves the WM_QUIT message, the return value is zero.
If there is an error, the return value is -1. For example, the function fails if hWnd is an invalid window handle or
lpMsg is an invalid pointer. To get extended error information, call GetLastError.
Because the return value can be nonzero, zero, or -1, avoid code like this:

while (GetMessage( lpMsg, hWnd, 0, 0)) ...

The possibility of a -1 return value in the case that hWnd is an invalid parameter (such as referring to a window
that has already been destroyed) means that such code can lead to fatal application errors. Instead, use code like
this:

BOOL bRet;

while( (bRet = GetMessage( &msg, hWnd, 0, 0 )) != 0)


{
if (bRet == -1)
{
// handle the error and possibly exit
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}

Remarks
An application typically uses the return value to determine whether to end the main message loop and exit the
program.
The GetMessage function retrieves messages associated with the window identified by the hWnd parameter or
any of its children, as specified by the IsChild function, and within the range of message values given by the
wMsgFilterMin and wMsgFilterMax parameters. Note that an application can only use the low word in the
wMsgFilterMin and wMsgFilterMax parameters; the high word is reserved for the system.
Note that GetMessage always retrieves WM_QUIT messages, no matter which values you specify for
wMsgFilterMin and wMsgFilterMax.
During this call, the system delivers pending, nonqueued messages, that is, messages sent to windows owned
by the calling thread using the SendMessage, SendMessageCallback, SendMessageTimeout, or
SendNotifyMessage function. Then the first queued message that matches the specified filter is retrieved. The
system may also process internal events. If no filter is specified, messages are processed in the following order:
Sent messages
Posted messages
Input (hardware) messages and system internal events
Sent messages (again)
WM_PAINT messages
WM_TIMER messages
To retrieve input messages before posted messages, use the wMsgFilterMin and wMsgFilterMax parameters.
GetMessage does not remove WM_PAINT messages from the queue. The messages remain in the queue until
processed.
If a top-level window stops responding to messages for more than several seconds, the system considers the
window to be not responding and replaces it with a ghost window that has the same z-order, location, size, and
visual attributes. This allows the user to move it, resize it, or even close the application. However, these are the
only actions available because the application is actually not responding. When in the debugger mode, the
system does not generate a ghost window.
DPI Virtualization
This API does not participate in DPI virtualization. The output is in the mode of the window that the message is
targeting. The calling thread is not taken into consideration.
Examples
For an example, see Creating a Message Loop.

NOTE
The winuser.h header defines GetMessage as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
IsChild
MSG
Messages and Message Queues
PeekMessage
PostMessage
PostThreadMessage
Reference
WaitMessage
GetNextWindow macro (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves a handle to the next or previous window in the Z-Order. The next window is below the specified
window; the previous window is above.
If the specified window is a topmost window, the function searches for a topmost window. If the specified
window is a top-level window, the function searches for a top-level window. If the specified window is a child
window, the function searches for a child window.

Syntax
void GetNextWindow(
hWnd,
wCmd
);

Parameters
hWnd

Type: HWND
A handle to a window. The window handle retrieved is relative to this window, based on the value of the wCmd
parameter.
wCmd

Type: UINT
Indicates whether the function returns a handle to the next window or the previous window. This parameter can
be either of the following values.

VA L UE M EA N IN G

Returns a handle to the window below the given window.


GW_HWNDNEXT
2

Returns a handle to the window above the given window.


GW_HWNDPREV
3

Return value
None

Remarks
This function is implemented as a call to the GetWindow function.
#define GetNextWindow(hWnd, wCmd) GetWindow(hWnd, wCmd)

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

See also
Conceptual
GetTopWindow
GetWindow
Reference
Windows
GetParent function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves a handle to the specified window's parent or owner.


To retrieve a handle to a specified ancestor, use the GetAncestor function.

Syntax
HWND GetParent(
HWND hWnd
);

Parameters
hWnd

Type: HWND
A handle to the window whose parent window handle is to be retrieved.

Return value
Type: HWND
If the window is a child window, the return value is a handle to the parent window. If the window is a top-level
window with the WS_POPUP style, the return value is a handle to the owner window.
If the function fails, the return value is NULL . To get extended error information, call GetLastError.
This function typically fails for one of the following reasons:
The window is a top-level window that is unowned or does not have the WS_POPUP style.
The owner window has WS_POPUP style.

Remarks
To obtain a window's owner window, instead of using GetParent , use GetWindow with the GW_OWNER flag.
To obtain the parent window and not the owner, instead of using GetParent , use GetAncestor with the
GA_PARENT flag.
Examples
For an example, see Initializing a Dialog Box.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]
Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetAncestor
GetWindow
Reference
SetParent
Windows
Windows Styles
GetProcessDefaultLayout function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the default layout that is used when windows are created with no parent or owner.

Syntax
BOOL GetProcessDefaultLayout(
DWORD *pdwDefaultLayout
);

Parameters
pdwDefaultLayout

Type: DWORD*
The current default process layout. For a list of values, see SetProcessDefaultLayout.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
The layout specifies how text and graphics are laid out in a window; the default is left to right. The
GetProcessDefaultLayout function lets you know if the default layout has changed, from using
SetProcessDefaultLayout.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll
API set ext-ms-win-ntuser-window-l1-1-3 (introduced in Windows
10, version 10.0.10240)

See also
Conceptual
Reference
SetProcessDefaultLayout
Windows
GetPropA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves a data handle from the property list of the specified window. The character string identifies the handle
to be retrieved. The string and handle must have been added to the property list by a previous call to the
SetProp function.

Syntax
HANDLE GetPropA(
HWND hWnd,
LPCSTR lpString
);

Parameters
hWnd

Type: HWND
A handle to the window whose property list is to be searched.
lpString

Type: LPCTSTR
An atom that identifies a string. If this parameter is an atom, it must have been created by using the
GlobalAddAtom function. The atom, a 16-bit value, must be placed in the low-order word of the lpString
parameter; the high-order word must be zero.

Return value
Type: HANDLE
If the property list contains the string, the return value is the associated data handle. Otherwise, the return value
is NULL .

Remarks
NOTE
The winuser.h header defines GetProp as an alias which automatically selects the ANSI or Unicode version of this function
based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that
not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see
Conventions for Function Prototypes.

Requirements
Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GlobalAddAtom
Reference
SetProp
Window Properties
ITaskbarList2::MarkFullscreenWindow
GetPropW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves a data handle from the property list of the specified window. The character string identifies the handle
to be retrieved. The string and handle must have been added to the property list by a previous call to the
SetProp function.

Syntax
HANDLE GetPropW(
HWND hWnd,
LPCWSTR lpString
);

Parameters
hWnd

Type: HWND
A handle to the window whose property list is to be searched.
lpString

Type: LPCTSTR
An atom that identifies a string. If this parameter is an atom, it must have been created by using the
GlobalAddAtom function. The atom, a 16-bit value, must be placed in the low-order word of the lpString
parameter; the high-order word must be zero.

Return value
Type: HANDLE
If the property list contains the string, the return value is the associated data handle. Otherwise, the return value
is NULL .

Remarks
NOTE
The winuser.h header defines GetProp as an alias which automatically selects the ANSI or Unicode version of this function
based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that
not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see
Conventions for Function Prototypes.

Requirements
Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GlobalAddAtom
Reference
SetProp
Window Properties
ITaskbarList2::MarkFullscreenWindow
GetQueueStatus function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the type of messages found in the calling thread's message queue.

Syntax
DWORD GetQueueStatus(
UINT flags
);

Parameters
flags

Type: UINT
The types of messages for which to check. This parameter can be one or more of the following values.

VA L UE M EA N IN G

An input, WM_TIMER, WM_PAINT, WM_HOTKEY, or posted


QS_ALLEVENTS message is in the queue.
(QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT |
QS_HOTKEY)

Any message is in the queue.


QS_ALLINPUT
(QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT |
QS_HOTKEY | QS_SENDMESSAGE)

A posted message (other than those listed here) is in the


QS_ALLPOSTMESSAGE queue.
0x0100

A WM_HOTKEY message is in the queue.


QS_HOTKEY
0x0080

An input message is in the queue.


QS_INPUT
(QS_MOUSE | QS_KEY | QS_RAWINPUT)

A WM_KEYUP, WM_KEYDOWN, WM_SYSKEYUP, or


QS_KEY WM_SYSKEYDOWN message is in the queue.
0x0001

A WM_MOUSEMOVE message or mouse-button message


QS_MOUSE (WM_LBUTTONUP, WM_RBUTTONDOWN, and so on).
(QS_MOUSEMOVE | QS_MOUSEBUTTON)
A mouse-button message (WM_LBUTTONUP,
QS_MOUSEBUTTON WM_RBUTTONDOWN, and so on).
0x0004

A WM_MOUSEMOVE message is in the queue.


QS_MOUSEMOVE
0x0002

A WM_PAINT message is in the queue.


QS_PAINT
0x0020

A posted message (other than those listed here) is in the


QS_POSTMESSAGE queue.
0x0008

A raw input message is in the queue. For more information,


QS_RAWINPUT see Raw Input.
0x0400
Windows 2000: This flag is not supported.

A message sent by another thread or application is in the


QS_SENDMESSAGE queue.
0x0040

A WM_TIMER message is in the queue.


QS_TIMER
0x0010

Return value
Type: DWORD
The high-order word of the return value indicates the types of messages currently in the queue. The low-order
word indicates the types of messages that have been added to the queue and that are still in the queue since the
last call to the GetQueueStatus , GetMessage, or PeekMessage function.

Remarks
The presence of a QS_ flag in the return value does not guarantee that a subsequent call to the GetMessage or
PeekMessage function will return a message. GetMessage and PeekMessage perform some internal filtering
that may cause the message to be processed internally. For this reason, the return value from GetQueueStatus
should be considered only a hint as to whether GetMessage or PeekMessage should be called.
The QS_ALLPOSTMESSAGE and QS_POSTMESSAGE flags differ in when they are cleared.
QS_POSTMESSAGE is cleared when you call GetMessage or PeekMessage, whether or not you are filtering
messages. QS_ALLPOSTMESSAGE is cleared when you call GetMessage or PeekMessage without filtering
messages (wMsgFilterMin and wMsgFilterMax are 0). This can be useful when you call PeekMessage multiple
times to get messages in different ranges.

Requirements
Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetInputState
GetMessage
Messages and Message Queues
PeekMessage
Reference
GetShellWindow function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves a handle to the Shell's desktop window.

Syntax
HWND GetShellWindow();

Parameters
This function has no parameters.

Return value
Type: HWND
The return value is the handle of the Shell's desktop window. If no Shell process is present, the return value is
NULL .

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetDesktopWindow
GetWindow
Reference
Windows
GetSysColor function (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Retrieves the current color of the specified display element. Display elements are the parts of a window and the
display that appear on the system display screen.

Syntax
DWORD GetSysColor(
int nIndex
);

Parameters
nIndex

Type: int
The display element whose color is to be retrieved. This parameter can be one of the following values.

VA L UE M EA N IN G

Dark shadow for three-dimensional display elements.


COLOR_3DDKSHADOW
21

Face color for three-dimensional display elements and for


COLOR_3DFACE dialog box backgrounds.
15

Highlight color for three-dimensional display elements (for


COLOR_3DHIGHLIGHT edges facing the light source.)
20

Highlight color for three-dimensional display elements (for


COLOR_3DHILIGHT edges facing the light source.)
20

Light color for three-dimensional display elements (for edges


COLOR_3DLIGHT facing the light source.)
22

Shadow color for three-dimensional display elements (for


COLOR_3DSHADOW edges facing away from the light source).
16

Active window border.


COLOR_ACTIVEBORDER
10
Active window title bar.
COLOR_ACTIVECAPTION
The associated foreground color is
2
COLOR_CAPTIONTEXT .
Specifies the left side color in the color gradient of an
active window's title bar if the gradient effect is enabled.

Background color of multiple document interface (MDI)


COLOR_APPWORKSPACE applications.
12

Desktop.
COLOR_BACKGROUND
1

Face color for three-dimensional display elements and for


COLOR_BTNFACE dialog box backgrounds. The associated foreground color is
15 COLOR_BTNTEXT .

Highlight color for three-dimensional display elements (for


COLOR_BTNHIGHLIGHT edges facing the light source.)
20

Highlight color for three-dimensional display elements (for


COLOR_BTNHILIGHT edges facing the light source.)
20

Shadow color for three-dimensional display elements (for


COLOR_BTNSHADOW edges facing away from the light source).
16

Text on push buttons. The associated background color is


COLOR_BTNTEXT COLOR_BTNFACE.
18

Text in caption, size box, and scroll bar arrow box. The
COLOR_CAPTIONTEXT associated background color is COLOR_ACTIVECAPTION.
9

Desktop.
COLOR_DESKTOP
1

Right side color in the color gradient of an active window's


COLOR_GRADIENTACTIVECAPTION title bar. COLOR_ACTIVECAPTION specifies the left side color.
27 Use SPI_GETGRADIENTCAPTIONS with the
SystemParametersInfo function to determine whether the
gradient effect is enabled.

Right side color in the color gradient of an inactive window's


COLOR_GRADIENTINACTIVECAPTION title bar. COLOR_INACTIVECAPTION specifies the left side
28 color.
Grayed (disabled) text. This color is set to 0 if the current
COLOR_GRAYTEXT display driver does not support a solid gray color.
17

Item(s) selected in a control. The associated foreground color


COLOR_HIGHLIGHT is COLOR_HIGHLIGHTTEXT.
13

Text of item(s) selected in a control. The associated


COLOR_HIGHLIGHTTEXT background color is COLOR_HIGHLIGHT.
14

Color for a hyperlink or hot-tracked item. The associated


COLOR_HOTLIGHT background color is COLOR_WINDOW.
26

Inactive window border.


COLOR_INACTIVEBORDER
11

Inactive window caption.


COLOR_INACTIVECAPTION
The associated foreground color is
3
COLOR_INACTIVECAPTIONTEXT.
Specifies the left side color in the color gradient of an
inactive window's title bar if the gradient effect is
enabled.

Color of text in an inactive caption. The associated


COLOR_INACTIVECAPTIONTEXT background color is COLOR_INACTIVECAPTION.
19

Background color for tooltip controls. The associated


COLOR_INFOBK foreground color is COLOR_INFOTEXT.
24

Text color for tooltip controls. The associated background


COLOR_INFOTEXT color is COLOR_INFOBK.
23

Menu background. The associated foreground color is


COLOR_MENU COLOR_MENUTEXT.
4

The color used to highlight menu items when the menu


COLOR_MENUHILIGHT appears as a flat menu (see SystemParametersInfo). The
29 highlighted menu item is outlined with COLOR_HIGHLIGHT.
Windows 2000: This value is not supported.
The background color for the menu bar when menus appear
COLOR_MENUBAR as flat menus (see SystemParametersInfo). However,
30 COLOR_MENU continues to specify the background color of
the menu popup.
Windows 2000: This value is not supported.

Text in menus. The associated background color is


COLOR_MENUTEXT COLOR_MENU.
7

Scroll bar gray area.


COLOR_SCROLLBAR
0

Window background. The associated foreground colors are


COLOR_WINDOW COLOR_WINDOWTEXT and COLOR_HOTLITE.
5

Window frame.
COLOR_WINDOWFRAME
6

Text in windows. The associated background color is


COLOR_WINDOWTEXT COLOR_WINDOW.
8

Return value
Type: DWORD
The function returns the red, green, blue (RGB) color value of the given element.
If the nIndex parameter is out of range, the return value is zero. Because zero is also a valid RGB value, you
cannot use GetSysColor to determine whether a system color is supported by the current platform. Instead,
use the GetSysColorBrush function, which returns NULL if the color is not supported.

Remarks
To display the component of the RGB value, use the GetRValue, GetGValue, and GetBValue macros.
System colors for monochrome displays are usually interpreted as shades of gray.
To paint with a system color brush, an application should use GetSysColorBrush(nIndex) , instead of
CreateSolidBrush(GetSysColor(nIndex)) , because GetSysColorBrush returns a cached brush, instead of allocating
a new one.
Color is an important visual element of most user interfaces. For guidelines about using color in your
applications, see Color.
Examples
For an example, see SetSysColors.

Requirements
Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
CreateSolidBrush
GetSysColorBrush
SetSysColors
SystemParametersInfo
GetSystemMetrics function (winuser.h)
2/1/2021 • 16 minutes to read • Edit Online

Retrieves the specified system metric or system configuration setting.


Note that all dimensions retrieved by GetSystemMetrics are in pixels.

Syntax
int GetSystemMetrics(
int nIndex
);

Parameters
nIndex

Type: int
The system metric or configuration setting to be retrieved. This parameter can be one of the following values.
Note that all SM_CX* values are widths and all SM_CY* values are heights. Also note that all settings designed to
return Boolean data represent TRUE as any nonzero value, and FALSE as a zero value.

VA L UE M EA N IN G

The flags that specify how the system arranged minimized


SM_ARRANGE windows. For more information, see the Remarks section in
56 this topic.

The value that specifies how the system is started:


SM_CLEANBOOT 0 Normal boot
67
1 Fail-safe boot
2 Fail-safe with network boot
A fail-safe boot (also called SafeBoot, Safe Mode, or Clean
Boot) bypasses the user startup files.

The number of display monitors on a desktop. For more


SM_CMONITORS information, see the Remarks section in this topic.
80

The number of buttons on a mouse, or zero if no mouse is


SM_CMOUSEBUTTONS installed.
43

Reflects the state of the laptop or slate mode, 0 for Slate


SM_CONVERTIBLESL ATEMODE Mode and non-zero otherwise. When this system metric
0x2003 changes, the system sends a broadcast message via
WM_SETTINGCHANGE with "ConvertibleSlateMode" in the
LPARAM. Note that this system metric doesn't apply to
desktop PCs. In that case, use GetAutoRotationState.
The width of a window border, in pixels. This is equivalent to
SM_CXBORDER the SM_CXEDGE value for windows with the 3-D look.
5

The width of a cursor, in pixels. The system cannot create


SM_CXCURSOR cursors of other sizes.
13

This value is the same as SM_CXFIXEDFRAME.


SM_CXDLGFRAME
7

The width of the rectangle around the location of a first click


SM_CXDOUBLECLK in a double-click sequence, in pixels. The second click must
36 occur within the rectangle that is defined by
SM_CXDOUBLECLK and SM_CYDOUBLECLK for the system
to consider the two clicks a double-click. The two clicks must
also occur within a specified time.
To set the width of the double-click rectangle, call
SystemParametersInfo with SPI_SETDOUBLECLKWIDTH.

The number of pixels on either side of a mouse-down point


SM_CXDRAG that the mouse pointer can move before a drag operation
68 begins. This allows the user to click and release the mouse
button easily without unintentionally starting a drag
operation. If this value is negative, it is subtracted from the
left of the mouse-down point and added to the right of it.

The width of a 3-D border, in pixels. This metric is the 3-D


SM_CXEDGE counterpart of SM_CXBORDER.
45

The thickness of the frame around the perimeter of a


SM_CXFIXEDFRAME window that has a caption but is not sizable, in pixels.
7 SM_CXFIXEDFRAME is the height of the horizontal border,
and SM_CYFIXEDFRAME is the width of the vertical border.
This value is the same as SM_CXDLGFRAME.

The width of the left and right edges of the focus rectangle
SM_CXFOCUSBORDER that the DrawFocusRect draws. This value is in pixels.
83
Windows 2000: This value is not supported.

This value is the same as SM_CXSIZEFRAME.


SM_CXFRAME
32

The width of the client area for a full-screen window on the


SM_CXFULLSCREEN primary display monitor, in pixels. To get the coordinates of
16 the portion of the screen that is not obscured by the system
taskbar or by application desktop toolbars, call the
SystemParametersInfo function with the SPI_GETWORKAREA
value.
The width of the arrow bitmap on a horizontal scroll bar, in
SM_CXHSCROLL pixels.
21

The width of the thumb box in a horizontal scroll bar, in


SM_CXHTHUMB pixels.
10

The default width of an icon, in pixels. The LoadIcon function


SM_CXICON can load only icons with the dimensions that SM_CXICON
11 and SM_CYICON specifies.

The width of a grid cell for items in large icon view, in pixels.
SM_CXICONSPACING Each item fits into a rectangle of size SM_CXICONSPACING
38 by SM_CYICONSPACING when arranged. This value is always
greater than or equal to SM_CXICON.

The default width, in pixels, of a maximized top-level window


SM_CXMAXIMIZED on the primary display monitor.
61

The default maximum width of a window that has a caption


SM_CXMAXTRACK and sizing borders, in pixels. This metric refers to the entire
59 desktop. The user cannot drag the window frame to a size
larger than these dimensions. A window can override this
value by processing the WM_GETMINMAXINFO message.

The width of the default menu check-mark bitmap, in pixels.


SM_CXMENUCHECK
71

The width of menu bar buttons, such as the child window


SM_CXMENUSIZE close button that is used in the multiple document interface,
54 in pixels.

The minimum width of a window, in pixels.


SM_CXMIN
28

The width of a minimized window, in pixels.


SM_CXMINIMIZED
57

The width of a grid cell for a minimized window, in pixels.


SM_CXMINSPACING Each minimized window fits into a rectangle this size when
47 arranged. This value is always greater than or equal to
SM_CXMINIMIZED.

The minimum tracking width of a window, in pixels. The user


SM_CXMINTRACK cannot drag the window frame to a size smaller than these
34 dimensions. A window can override this value by processing
the WM_GETMINMAXINFO message.
The amount of border padding for captioned windows, in
SM_CXPADDEDBORDER pixels.
92
Windows XP/2000: This value is not supported.

The width of the screen of the primary display monitor, in


SM_CXSCREEN pixels. This is the same value obtained by calling
0 GetDeviceCaps as follows:
GetDeviceCaps( hdcPrimaryMonitor, HORZRES) .

The width of a button in a window caption or title bar, in


SM_CXSIZE pixels.
30

The thickness of the sizing border around the perimeter of a


SM_CXSIZEFRAME window that can be resized, in pixels. SM_CXSIZEFRAME is
32 the width of the horizontal border, and SM_CYSIZEFRAME is
the height of the vertical border.
This value is the same as SM_CXFRAME.

The recommended width of a small icon, in pixels. Small icons


SM_CXSMICON typically appear in window captions and in small icon view.
49

The width of small caption buttons, in pixels.


SM_CXSMSIZE
52

The width of the virtual screen, in pixels. The virtual screen is


SM_CXVIRTUALSCREEN the bounding rectangle of all display monitors. The
78 SM_XVIRTUALSCREEN metric is the coordinates for the left
side of the virtual screen.

The width of a vertical scroll bar, in pixels.


SM_CXVSCROLL
2

The height of a window border, in pixels. This is equivalent to


SM_CYBORDER the SM_CYEDGE value for windows with the 3-D look.
6

The height of a caption area, in pixels.


SM_CYCAPTION
4

The height of a cursor, in pixels. The system cannot create


SM_CYCURSOR cursors of other sizes.
14

This value is the same as SM_CYFIXEDFRAME.


SM_CYDLGFRAME
8
The height of the rectangle around the location of a first click
SM_CYDOUBLECLK in a double-click sequence, in pixels. The second click must
37 occur within the rectangle defined by SM_CXDOUBLECLK
and SM_CYDOUBLECLK for the system to consider the two
clicks a double-click. The two clicks must also occur within a
specified time.
To set the height of the double-click rectangle, call
SystemParametersInfo with SPI_SETDOUBLECLKHEIGHT.

The number of pixels above and below a mouse-down point


SM_CYDRAG that the mouse pointer can move before a drag operation
69 begins. This allows the user to click and release the mouse
button easily without unintentionally starting a drag
operation. If this value is negative, it is subtracted from
above the mouse-down point and added below it.

The height of a 3-D border, in pixels. This is the 3-D


SM_CYEDGE counterpart of SM_CYBORDER.
46

The thickness of the frame around the perimeter of a


SM_CYFIXEDFRAME window that has a caption but is not sizable, in pixels.
8 SM_CXFIXEDFRAME is the height of the horizontal border,
and SM_CYFIXEDFRAME is the width of the vertical border.
This value is the same as SM_CYDLGFRAME.

The height of the top and bottom edges of the focus


SM_CYFOCUSBORDER rectangle drawn by DrawFocusRect. This value is in pixels.
84
Windows 2000: This value is not supported.

This value is the same as SM_CYSIZEFRAME.


SM_CYFRAME
33

The height of the client area for a full-screen window on the


SM_CYFULLSCREEN primary display monitor, in pixels. To get the coordinates of
17 the portion of the screen not obscured by the system
taskbar or by application desktop toolbars, call the
SystemParametersInfo function with the SPI_GETWORKAREA
value.

The height of a horizontal scroll bar, in pixels.


SM_CYHSCROLL
3

The default height of an icon, in pixels. The LoadIcon


SM_CYICON function can load only icons with the dimensions
12 SM_CXICON and SM_CYICON.

The height of a grid cell for items in large icon view, in pixels.
SM_CYICONSPACING Each item fits into a rectangle of size SM_CXICONSPACING
39 by SM_CYICONSPACING when arranged. This value is always
greater than or equal to SM_CYICON.
For double byte character set versions of the system, this is
SM_CYKANJIWINDOW the height of the Kanji window at the bottom of the screen,
18 in pixels.

The default height, in pixels, of a maximized top-level


SM_CYMAXIMIZED window on the primary display monitor.
62

The default maximum height of a window that has a caption


SM_CYMAXTRACK and sizing borders, in pixels. This metric refers to the entire
60 desktop. The user cannot drag the window frame to a size
larger than these dimensions. A window can override this
value by processing the WM_GETMINMAXINFO message.

The height of a single-line menu bar, in pixels.


SM_CYMENU
15

The height of the default menu check-mark bitmap, in pixels.


SM_CYMENUCHECK
72

The height of menu bar buttons, such as the child window


SM_CYMENUSIZE close button that is used in the multiple document interface,
55 in pixels.

The minimum height of a window, in pixels.


SM_CYMIN
29

The height of a minimized window, in pixels.


SM_CYMINIMIZED
58

The height of a grid cell for a minimized window, in pixels.


SM_CYMINSPACING Each minimized window fits into a rectangle this size when
48 arranged. This value is always greater than or equal to
SM_CYMINIMIZED.

The minimum tracking height of a window, in pixels. The user


SM_CYMINTRACK cannot drag the window frame to a size smaller than these
35 dimensions. A window can override this value by processing
the WM_GETMINMAXINFO message.

The height of the screen of the primary display monitor, in


SM_CYSCREEN pixels. This is the same value obtained by calling
1 GetDeviceCaps as follows:
GetDeviceCaps( hdcPrimaryMonitor, VERTRES) .

The height of a button in a window caption or title bar, in


SM_CYSIZE pixels.
31
The thickness of the sizing border around the perimeter of a
SM_CYSIZEFRAME window that can be resized, in pixels. SM_CXSIZEFRAME is
33 the width of the horizontal border, and SM_CYSIZEFRAME is
the height of the vertical border.
This value is the same as SM_CYFRAME.

The height of a small caption, in pixels.


SM_CYSMCAPTION
51

The recommended height of a small icon, in pixels. Small


SM_CYSMICON icons typically appear in window captions and in small icon
50 view.

The height of small caption buttons, in pixels.


SM_CYSMSIZE
53

The height of the virtual screen, in pixels. The virtual screen


SM_CYVIRTUALSCREEN is the bounding rectangle of all display monitors. The
79 SM_YVIRTUALSCREEN metric is the coordinates for the top
of the virtual screen.

The height of the arrow bitmap on a vertical scroll bar, in


SM_CYVSCROLL pixels.
20

The height of the thumb box in a vertical scroll bar, in pixels.


SM_CYVTHUMB
9

Nonzero if User32.dll supports DBCS; otherwise, 0.


SM_DBCSENABLED
42

Nonzero if the debug version of User.exe is installed;


SM_DEBUG otherwise, 0.
22

Nonzero if the current operating system is Windows 7 or


SM_DIGITIZER Windows Server 2008 R2 and the Tablet PC Input service is
94 started; otherwise, 0. The return value is a bitmask that
specifies the type of digitizer input supported by the device.
For more information, see Remarks.
Windows Ser ver 2008, Windows Vista and
Windows XP/2000: This value is not supported.
Nonzero if Input Method Manager/Input Method Editor
SM_IMMENABLED features are enabled; otherwise, 0.
82
SM_IMMENABLED indicates whether the system is ready
to use a Unicode-based IME on a Unicode application.
To ensure that a language-dependent IME works, check
SM_DBCSENABLED and the system ANSI code page.
Otherwise the ANSI-to-Unicode conversion may not be
performed correctly, or some components like fonts or
registry settings may not be present.

Nonzero if there are digitizers in the system; otherwise, 0.


SM_MAXIMUMTOUCHES
SM_MAXIMUMTOUCHES returns the aggregate
95
maximum of the maximum number of contacts
supported by every digitizer in the system. If the system
has only single-touch digitizers, the return value is 1. If
the system has multi-touch digitizers, the return value is
the number of simultaneous contacts the hardware can
provide.
Windows Ser ver 2008, Windows Vista and
Windows XP/2000: This value is not supported.

Nonzero if the current operating system is the Windows XP,


SM_MEDIACENTER Media Center Edition, 0 if not.
87

Nonzero if drop-down menus are right-aligned with the


SM_MENUDROPALIGNMENT corresponding menu-bar item; 0 if the menus are left-
40 aligned.

Nonzero if the system is enabled for Hebrew and Arabic


SM_MIDEASTENABLED languages, 0 if not.
74

Nonzero if a mouse is installed; otherwise, 0. This value is


SM_MOUSEPRESENT rarely zero, because of support for virtual mice and because
19 some systems detect the presence of the port instead of the
presence of a mouse.

Nonzero if a mouse with a horizontal scroll wheel is installed;


SM_MOUSEHORIZONTALWHEELPRESENT otherwise 0.
91

Nonzero if a mouse with a vertical scroll wheel is installed;


SM_MOUSEWHEELPRESENT otherwise 0.
75

The least significant bit is set if a network is present;


SM_NETWORK otherwise, it is cleared. The other bits are reserved for future
63 use.

Nonzero if the Microsoft Windows for Pen computing


SM_PENWINDOWS extensions are installed; zero otherwise.
41
This system metric is used in a Terminal Services
SM_REMOTECONTROL environment to determine if the current Terminal Server
0x2001 session is being remotely controlled. Its value is nonzero if
the current session is remotely controlled; otherwise, 0.
You can use terminal services management tools such as
Terminal Services Manager (tsadmin.msc) and
shadow.exe to control a remote session. When a session
is being remotely controlled, another user can view the
contents of that session and potentially interact with it.

This system metric is used in a Terminal Services


SM_REMOTESESSION environment. If the calling process is associated with a
0x1000 Terminal Services client session, the return value is nonzero.
If the calling process is associated with the Terminal Services
console session, the return value is 0. Windows
Ser ver 2003 and Windows XP: The console session is
not necessarily the physical console. For more information,
see WTSGetActiveConsoleSessionId.

Nonzero if all the display monitors have the same color


SM_SAMEDISPL AYFORMAT format, otherwise, 0. Two displays can have the same bit
81 depth, but different color formats. For example, the red,
green, and blue pixels can be encoded with different
numbers of bits, or those bits can be located in different
places in a pixel color value.

This system metric should be ignored; it always returns 0.


SM_SECURE
44

The build number if the system is Windows Server 2003 R2;


SM_SERVERR2 otherwise, 0.
89

Nonzero if the user requires an application to present


SM_SHOWSOUNDS information visually in situations where it would otherwise
70 present the information only in audible form; otherwise, 0.

Nonzero if the current session is shutting down; otherwise,


SM_SHUTTINGDOWN 0.
0x2000
Windows 2000: This value is not supported.

Nonzero if the computer has a low-end (slow) processor;


SM_SLOWMACHINE otherwise, 0.
73

Nonzero if the current operating system is Windows 7


SM_STARTER Starter Edition, Windows Vista Starter, or Windows XP
88 Starter Edition; otherwise, 0.

Nonzero if the meanings of the left and right mouse buttons


SM_SWAPBUTTON are swapped; otherwise, 0.
23
Reflects the state of the docking mode, 0 for Undocked
SM_SYSTEMDOCKED Mode and non-zero otherwise. When this system metric
0x2004 changes, the system sends a broadcast message via
WM_SETTINGCHANGE with "SystemDockMode" in the
LPARAM.

Nonzero if the current operating system is the Windows XP


SM_TABLETPC Tablet PC edition or if the current operating system is
86 Windows Vista or Windows 7 and the Tablet PC Input
service is started; otherwise, 0. The SM_DIGITIZER setting
indicates the type of digitizer input supported by a device
running Windows 7 or Windows Server 2008 R2. For more
information, see Remarks.

The coordinates for the left side of the virtual screen. The
SM_XVIRTUALSCREEN virtual screen is the bounding rectangle of all display
76 monitors. The SM_CXVIRTUALSCREEN metric is the width of
the virtual screen.

The coordinates for the top of the virtual screen. The virtual
SM_YVIRTUALSCREEN screen is the bounding rectangle of all display monitors. The
77 SM_CYVIRTUALSCREEN metric is the height of the virtual
screen.

Return value
Type: int
If the function succeeds, the return value is the requested system metric or configuration setting.
If the function fails, the return value is 0. GetLastError does not provide extended error information.

Remarks
System metrics can vary from display to display.
GetSystemMetrics (SM_CMONITORS) counts only visible display monitors. This is different from
EnumDisplayMonitors, which enumerates both visible display monitors and invisible pseudo-monitors that are
associated with mirroring drivers. An invisible pseudo-monitor is associated with a pseudo-device used to
mirror application drawing for remoting or other purposes.
The SM_ARRANGE setting specifies how the system arranges minimized windows, and consists of a starting
position and a direction. The starting position can be one of the following values.

VA L UE M EA N IN G

ARW_BOTTOMLEFT Start at the lower-left corner of the screen. The default


position.

ARW_BOTTOMRIGHT Start at the lower-right corner of the screen. Equivalent to


ARW_STARTRIGHT.

ARW_TOPLEFT Start at the upper-left corner of the screen. Equivalent to


ARW_STARTTOP.

ARW_TOPRIGHT Start at the upper-right corner of the screen. Equivalent to


ARW_STARTTOP | SRW_STARTRIGHT.
The direction in which to arrange minimized windows can be one of the following values.

VA L UE M EA N IN G

ARW_DOWN Arrange vertically, top to bottom.

ARW_HIDE Hide minimized windows by moving them off the visible area
of the screen.

ARW_LEFT Arrange horizontally, left to right.

ARW_RIGHT Arrange horizontally, right to left.

ARW_UP Arrange vertically, bottom to top.

The SM_DIGITIZER setting specifies the type of digitizers that are installed on a device running Windows 7 or
Windows Server 2008 R2. The return value is a bitmask that specifies one or more of the following values.

VA L UE M EA N IN G

NID_INTEGRATED_TOUCH The device has an integrated touch digitizer.


0x01

NID_EXTERNAL_TOUCH The device has an external touch digitizer.


0x02

NID_INTEGRATED_PEN The device has an integrated pen digitizer.


0x04

NID_EXTERNAL_PEN The device has an external pen digitizer.


0x08

NID_MULTI_INPUT The device supports multiple sources of digitizer input.


0x40

NID_READY The device is ready to receive digitizer input.


0x80

This API is not DPI aware, and should not be used if the calling thread is per-monitor DPI aware. For the DPI-
aware version of this API, see GetSystemMetricsForDPI. For more information on DPI awareness, see the
Windows High DPI documentation.
Examples
The following example uses the GetSystemMetrics function to determine whether a mouse is installed and
whether the mouse buttons are swapped. The example also uses the SystemParametersInfo function to retrieve
the mouse threshold and speed. It displays the information in the console.
#include <windows.h>
#include <stdio.h>
#pragma comment(lib, "user32.lib")

void main()
{
BOOL fResult;
int aMouseInfo[3];

fResult = GetSystemMetrics(SM_MOUSEPRESENT);

if (fResult == 0)
printf("No mouse installed.\n");
else
{
printf("Mouse installed.\n");

// Determine whether the buttons are swapped.

fResult = GetSystemMetrics(SM_SWAPBUTTON);

if (fResult == 0)
printf("Buttons not swapped.\n");
else printf("Buttons swapped.\n");

// Get the mouse speed and the threshold values.

fResult = SystemParametersInfo(
SPI_GETMOUSE, // get mouse information
0, // not used
&aMouseInfo, // holds mouse information
0); // not used

if( fResult )
{
printf("Speed: %d\n", aMouseInfo[2]);
printf("Threshold (x,y): %d,%d\n",
aMouseInfo[0], aMouseInfo[1]);
}
}
}

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-sysparams-ext-l1-1-0 (introduced in


Windows 8)
See also
EnumDisplayMonitors
GetSystemMetricsForDPI
SystemParametersInfo
GetTitleBarInfo function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves information about the specified title bar.

Syntax
BOOL GetTitleBarInfo(
HWND hwnd,
PTITLEBARINFO pti
);

Parameters
hwnd

Type: HWND
A handle to the title bar whose information is to be retrieved.
pti

Type: PTITLEBARINFO
A pointer to a TITLEBARINFO structure to receive the information. Note that you must set the cbSize member to
sizeof(TITLEBARINFO) before calling this function.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll
API set ext-ms-win-ntuser-window-l1-1-3 (introduced in Windows
10, version 10.0.10240)

See also
Conceptual
Reference
TITLEBARINFO
Windows
GetTopWindow function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Examines the Z order of the child windows associated with the specified parent window and retrieves a handle
to the child window at the top of the Z order.

Syntax
HWND GetTopWindow(
HWND hWnd
);

Parameters
hWnd

Type: HWND
A handle to the parent window whose child windows are to be examined. If this parameter is NULL , the function
returns a handle to the window at the top of the Z order.

Return value
Type: HWND
If the function succeeds, the return value is a handle to the child window at the top of the Z order. If the specified
window has no child windows, the return value is NULL . To get extended error information, use the GetLastError
function.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows


10, version 10.0.14393)

See also
Conceptual
GetNextWindow
GetWindow
Reference
Windows
GetWindow function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves a handle to a window that has the specified relationship (Z-Order or owner) to the specified window.

Syntax
HWND GetWindow(
HWND hWnd,
UINT uCmd
);

Parameters
hWnd

Type: HWND
A handle to a window. The window handle retrieved is relative to this window, based on the value of the uCmd
parameter.
uCmd

Type: UINT
The relationship between the specified window and the window whose handle is to be retrieved. This parameter
can be one of the following values.

VA L UE M EA N IN G

The retrieved handle identifies the child window at the top of


GW_CHILD the Z order, if the specified window is a parent window;
5 otherwise, the retrieved handle is NULL . The function
examines only child windows of the specified window. It does
not examine descendant windows.

The retrieved handle identifies the enabled popup window


GW_ENABLEDPOPUP owned by the specified window (the search uses the first
6 such window found using GW_HWNDNEXT ); otherwise, if
there are no enabled popup windows, the retrieved handle is
that of the specified window.

The retrieved handle identifies the window of the same type


GW_HWNDFIRST that is highest in the Z order.
0
If the specified window is a topmost window, the handle
identifies a topmost window. If the specified window is a
top-level window, the handle identifies a top-level
window. If the specified window is a child window, the
handle identifies a sibling window.
The retrieved handle identifies the window of the same type
GW_HWNDL AST that is lowest in the Z order.
1
If the specified window is a topmost window, the handle
identifies a topmost window. If the specified window is a
top-level window, the handle identifies a top-level
window. If the specified window is a child window, the
handle identifies a sibling window.

The retrieved handle identifies the window below the


GW_HWNDNEXT specified window in the Z order.
2
If the specified window is a topmost window, the handle
identifies a topmost window. If the specified window is a
top-level window, the handle identifies a top-level
window. If the specified window is a child window, the
handle identifies a sibling window.

The retrieved handle identifies the window above the


GW_HWNDPREV specified window in the Z order.
3
If the specified window is a topmost window, the handle
identifies a topmost window. If the specified window is a
top-level window, the handle identifies a top-level
window. If the specified window is a child window, the
handle identifies a sibling window.

The retrieved handle identifies the specified window's owner


GW_OWNER window, if any. For more information, see Owned Windows.
4

Return value
Type: HWND
If the function succeeds, the return value is a window handle. If no window exists with the specified relationship
to the specified window, the return value is NULL . To get extended error information, call GetLastError.

Remarks
The EnumChildWindows function is more reliable than calling GetWindow in a loop. An application that calls
GetWindow to perform this task risks being caught in an infinite loop or referencing a handle to a window that
has been destroyed.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)


Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
EnumChildWindows
Reference
Windows
GetWindowDisplayAffinity function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the current display affinity setting, from any process, for a given window.

Syntax
BOOL GetWindowDisplayAffinity(
HWND hWnd,
DWORD *pdwAffinity
);

Parameters
hWnd

Type: HWND
A handle to the window.
pdwAffinity

Type: DWORD*
A pointer to a variable that receives the display affinity setting. See SetWindowDisplayAffinity for a list of affinity
settings and their meanings.

Return value
Type: BOOL
This function succeeds only when the window is layered and Desktop Windows Manager is composing the
desktop. If this function succeeds, it returns TRUE ; otherwise, it returns FALSE . To get extended error
information, call GetLastError.

Remarks
This function and SetWindowDisplayAffinity are designed to support the window content protection feature
unique to Windows 7. This feature enables applications to protect their own onscreen window content from
being captured or copied via a specific set of public operating system features and APIs. However, it works only
when the Desktop Window Manager (DWM) is composing the desktop.
It is important to note that unlike a security feature or an implementation of Digital Rights Management (DRM),
there is no guarantee that using SetWindowDisplayAffinity and GetWindowDisplayAffinity , and other
necessary functions such as DwmIsCompositionEnabled, will strictly protect windowed content, as in the case
where someone takes a photograph of the screen.

Requirements
Minimum suppor ted client Windows 7 [desktop apps only]

Minimum suppor ted ser ver Windows Server 2008 R2 [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows


8.1)

See also
Conceptual
Windows
GetWindowInfo function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves information about the specified window.

Syntax
BOOL GetWindowInfo(
HWND hwnd,
PWINDOWINFO pwi
);

Parameters
hwnd

Type: HWND
A handle to the window whose information is to be retrieved.
pwi

Type: PWINDOWINFO
A pointer to a WINDOWINFO structure to receive the information. Note that you must set the cbSize member
to sizeof(WINDOWINFO) before calling this function.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
To get extended error information, call GetLastError.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib
DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
Reference
WINDOWINFO
Windows
GetWindowLongA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves information about the specified window. The function also retrieves the 32-bit (DWORD ) value at the
specified offset into the extra window memory.

Note If you are retrieving a pointer or a handle, this function has been superseded by the GetWindowLongPtr function.
(Pointers and handles are 32 bits on 32-bit Windows and 64 bits on 64-bit Windows.) To write code that is compatible with
both 32-bit and 64-bit versions of Windows, use GetWindowLongPtr .

Syntax
LONG GetWindowLongA(
HWND hWnd,
int nIndex
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
nIndex

Type: int
The zero-based offset to the value to be retrieved. Valid values are in the range zero through the number of
bytes of extra window memory, minus four; for example, if you specified 12 or more bytes of extra memory, a
value of 8 would be an index to the third 32-bit integer. To retrieve any other value, specify one of the following
values.

VA L UE M EA N IN G

Retrieves the extended window styles.


GWL_EXSTYLE
-20

Retrieves a handle to the application instance.


GWL_HINSTANCE
-6

Retrieves a handle to the parent window, if any.


GWL_HWNDPARENT
-8
Retrieves the identifier of the window.
GWL_ID
-12

Retrieves the window styles.


GWL_STYLE
-16

Retrieves the user data associated with the window. This data
GWL_USERDATA is intended for use by the application that created the
-21 window. Its value is initially zero.

Retrieves the address of the window procedure, or a handle


GWL_WNDPROC representing the address of the window procedure. You
-4 must use the CallWindowProc function to call the window
procedure.

The following values are also available when the hWnd parameter identifies a dialog box.

VA L UE M EA N IN G

Retrieves the address of the dialog box procedure, or a


DWL_DLGPROC handle representing the address of the dialog box
DWLP_MSGRESULT + sizeof(LRESULT) procedure. You must use the CallWindowProc function to call
the dialog box procedure.

Retrieves the return value of a message processed in the


DWL_MSGRESULT dialog box procedure.
0

Retrieves extra information private to the application, such as


DWL_USER handles or pointers.
DWLP_DLGPROC + sizeof(DLGPROC)

Return value
Type: LONG
If the function succeeds, the return value is the requested value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If SetWindowLong has not been called previously, GetWindowLong returns zero for values in the extra
window or class memory.

Remarks
Reserve extra window memory by specifying a nonzero value in the cbWndExtra member of the
WNDCLASSEX structure used with the RegisterClassEx function.
Examples
For an example, see Creating, Enumerating, and Sizing Child Windows.
NOTE
The winuser.h header defines GetWindowLong as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)

See also
CallWindowProc
Conceptual
GetWindowLongPtr
Reference
RegisterClassEx
SetParent
SetWindowLong
WNDCLASS
Window Classes
GetWindowLongPtrA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves information about the specified window. The function also retrieves the value at a specified offset into
the extra window memory.

Note To write code that is compatible with both 32-bit and 64-bit versions of Windows, use GetWindowLongPtr . When
compiling for 32-bit Windows, GetWindowLongPtr is defined as a call to the GetWindowLong function.

Syntax
LONG_PTR GetWindowLongPtrA(
HWND hWnd,
int nIndex
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
nIndex

Type: int
The zero-based offset to the value to be retrieved. Valid values are in the range zero through the number of
bytes of extra window memory, minus the size of a LONG_PTR . To retrieve any other value, specify one of the
following values.

VA L UE M EA N IN G

Retrieves the extended window styles.


GWL_EXSTYLE
-20

Retrieves a handle to the application instance.


GWLP_HINSTANCE
-6

Retrieves a handle to the parent window, if there is one.


GWLP_HWNDPARENT
-8
Retrieves the identifier of the window.
GWLP_ID
-12

Retrieves the window styles.


GWL_STYLE
-16

Retrieves the user data associated with the window. This data
GWLP_USERDATA is intended for use by the application that created the
-21 window. Its value is initially zero.

Retrieves the pointer to the window procedure, or a handle


GWLP_WNDPROC representing the pointer to the window procedure. You must
-4 use the CallWindowProc function to call the window
procedure.

The following values are also available when the hWnd parameter identifies a dialog box.

VA L UE M EA N IN G

Retrieves the pointer to the dialog box procedure, or a


DWLP_DLGPROC handle representing the pointer to the dialog box procedure.
DWLP_MSGRESULT + sizeof(LRESULT) You must use the CallWindowProc function to call the dialog
box procedure.

Retrieves the return value of a message processed in the


DWLP_MSGRESULT dialog box procedure.
0

Retrieves extra information private to the application, such as


DWLP_USER handles or pointers.
DWLP_DLGPROC + sizeof(DLGPROC)

Return value
Type: LONG_PTR
If the function succeeds, the return value is the requested value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If SetWindowLong or SetWindowLongPtr has not been called previously, GetWindowLongPtr returns zero for
values in the extra window or class memory.

Remarks
Reserve extra window memory by specifying a nonzero value in the cbWndExtra member of the
WNDCLASSEX structure used with the RegisterClassEx function.
NOTE
The winuser.h header defines GetWindowLongPtr as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)

See also
CallWindowProc
Conceptual
Reference
RegisterClassEx
SetParent
SetWindowLongPtr
WNDCLASSEX
Window Classes
GetWindowLongPtrW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves information about the specified window. The function also retrieves the value at a specified offset into
the extra window memory.

Note To write code that is compatible with both 32-bit and 64-bit versions of Windows, use GetWindowLongPtr . When
compiling for 32-bit Windows, GetWindowLongPtr is defined as a call to the GetWindowLong function.

Syntax
LONG_PTR GetWindowLongPtrW(
HWND hWnd,
int nIndex
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
nIndex

Type: int
The zero-based offset to the value to be retrieved. Valid values are in the range zero through the number of
bytes of extra window memory, minus the size of a LONG_PTR . To retrieve any other value, specify one of the
following values.

VA L UE M EA N IN G

Retrieves the extended window styles.


GWL_EXSTYLE
-20

Retrieves a handle to the application instance.


GWLP_HINSTANCE
-6

Retrieves a handle to the parent window, if there is one.


GWLP_HWNDPARENT
-8
Retrieves the identifier of the window.
GWLP_ID
-12

Retrieves the window styles.


GWL_STYLE
-16

Retrieves the user data associated with the window. This data
GWLP_USERDATA is intended for use by the application that created the
-21 window. Its value is initially zero.

Retrieves the pointer to the window procedure, or a handle


GWLP_WNDPROC representing the pointer to the window procedure. You must
-4 use the CallWindowProc function to call the window
procedure.

The following values are also available when the hWnd parameter identifies a dialog box.

VA L UE M EA N IN G

Retrieves the pointer to the dialog box procedure, or a


DWLP_DLGPROC handle representing the pointer to the dialog box procedure.
DWLP_MSGRESULT + sizeof(LRESULT) You must use the CallWindowProc function to call the dialog
box procedure.

Retrieves the return value of a message processed in the


DWLP_MSGRESULT dialog box procedure.
0

Retrieves extra information private to the application, such as


DWLP_USER handles or pointers.
DWLP_DLGPROC + sizeof(DLGPROC)

Return value
Type: LONG_PTR
If the function succeeds, the return value is the requested value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If SetWindowLong or SetWindowLongPtr has not been called previously, GetWindowLongPtr returns zero for
values in the extra window or class memory.

Remarks
Reserve extra window memory by specifying a nonzero value in the cbWndExtra member of the
WNDCLASSEX structure used with the RegisterClassEx function.
NOTE
The winuser.h header defines GetWindowLongPtr as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)

See also
CallWindowProc
Conceptual
Reference
RegisterClassEx
SetParent
SetWindowLongPtr
WNDCLASSEX
Window Classes
GetWindowLongW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves information about the specified window. The function also retrieves the 32-bit (DWORD ) value at the
specified offset into the extra window memory.

Note If you are retrieving a pointer or a handle, this function has been superseded by the GetWindowLongPtr function.
(Pointers and handles are 32 bits on 32-bit Windows and 64 bits on 64-bit Windows.) To write code that is compatible with
both 32-bit and 64-bit versions of Windows, use GetWindowLongPtr .

Syntax
LONG GetWindowLongW(
HWND hWnd,
int nIndex
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
nIndex

Type: int
The zero-based offset to the value to be retrieved. Valid values are in the range zero through the number of
bytes of extra window memory, minus four; for example, if you specified 12 or more bytes of extra memory, a
value of 8 would be an index to the third 32-bit integer. To retrieve any other value, specify one of the following
values.

VA L UE M EA N IN G

Retrieves the extended window styles.


GWL_EXSTYLE
-20

Retrieves a handle to the application instance.


GWL_HINSTANCE
-6

Retrieves a handle to the parent window, if any.


GWL_HWNDPARENT
-8
Retrieves the identifier of the window.
GWL_ID
-12

Retrieves the window styles.


GWL_STYLE
-16

Retrieves the user data associated with the window. This data
GWL_USERDATA is intended for use by the application that created the
-21 window. Its value is initially zero.

Retrieves the address of the window procedure, or a handle


GWL_WNDPROC representing the address of the window procedure. You
-4 must use the CallWindowProc function to call the window
procedure.

The following values are also available when the hWnd parameter identifies a dialog box.

VA L UE M EA N IN G

Retrieves the address of the dialog box procedure, or a


DWL_DLGPROC handle representing the address of the dialog box
DWLP_MSGRESULT + sizeof(LRESULT) procedure. You must use the CallWindowProc function to call
the dialog box procedure.

Retrieves the return value of a message processed in the


DWL_MSGRESULT dialog box procedure.
0

Retrieves extra information private to the application, such as


DWL_USER handles or pointers.
DWLP_DLGPROC + sizeof(DLGPROC)

Return value
Type: LONG
If the function succeeds, the return value is the requested value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If SetWindowLong has not been called previously, GetWindowLong returns zero for values in the extra
window or class memory.

Remarks
Reserve extra window memory by specifying a nonzero value in the cbWndExtra member of the
WNDCLASSEX structure used with the RegisterClassEx function.
Examples
For an example, see Creating, Enumerating, and Sizing Child Windows.
NOTE
The winuser.h header defines GetWindowLong as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)

See also
CallWindowProc
Conceptual
GetWindowLongPtr
Reference
RegisterClassEx
SetParent
SetWindowLong
WNDCLASS
Window Classes
GetWindowModuleFileNameA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the full path and file name of the module associated with the specified window handle.

Syntax
UINT GetWindowModuleFileNameA(
HWND hwnd,
LPSTR pszFileName,
UINT cchFileNameMax
);

Parameters
hwnd

Type: HWND
A handle to the window whose module file name is to be retrieved.
pszFileName

Type: LPTSTR
The path and file name.
cchFileNameMax

Type: UINT
The maximum number of characters that can be copied into the lpszFileName buffer.

Return value
Type: UINT
The return value is the total number of characters copied into the buffer.

Remarks
NOTE
The winuser.h header defines GetWindowModuleFileName as an alias which automatically selects the ANSI or Unicode
version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-
neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For
more information, see Conventions for Function Prototypes.

Requirements
Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
Windows Overview
GetWindowModuleFileNameW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the full path and file name of the module associated with the specified window handle.

Syntax
UINT GetWindowModuleFileNameW(
HWND hwnd,
LPWSTR pszFileName,
UINT cchFileNameMax
);

Parameters
hwnd

Type: HWND
A handle to the window whose module file name is to be retrieved.
pszFileName

Type: LPTSTR
The path and file name.
cchFileNameMax

Type: UINT
The maximum number of characters that can be copied into the lpszFileName buffer.

Return value
Type: UINT
The return value is the total number of characters copied into the buffer.

Remarks
NOTE
The winuser.h header defines GetWindowModuleFileName as an alias which automatically selects the ANSI or Unicode
version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-
neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For
more information, see Conventions for Function Prototypes.

Requirements
Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
Windows Overview
GetWindowPlacement function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the show state and the restored, minimized, and maximized positions of the specified window.

Syntax
BOOL GetWindowPlacement(
HWND hWnd,
WINDOWPLACEMENT *lpwndpl
);

Parameters
hWnd

Type: HWND
A handle to the window.
lpwndpl

Type: WINDOWPL ACEMENT *


A pointer to the WINDOWPLACEMENT structure that receives the show state and position information. Before
calling GetWindowPlacement , set the length member to sizeof(WINDOWPLACEMENT) . GetWindowPlacement
fails if lpwndpl-> length is not set correctly.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
The flags member of WINDOWPLACEMENT retrieved by this function is always zero. If the window identified
by the hWnd parameter is maximized, the showCmd member is SW_SHOWMAXIMIZED. If the window is
minimized, showCmd is SW_SHOWMINIMIZED. Otherwise, it is SW_SHOWNORMAL.
The length member of WINDOWPLACEMENT must be set to sizeof(WINDOWPL ACEMENT ). If this member is
not set correctly, the function returns FALSE . For additional remarks on the proper use of window placement
coordinates, see WINDOWPL ACEMENT .

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]
Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
Reference
SetWindowPlacement
WINDOWPLACEMENT
Windows
GetWindowRect function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in screen
coordinates that are relative to the upper-left corner of the screen.

Syntax
BOOL GetWindowRect(
HWND hWnd,
LPRECT lpRect
);

Parameters
hWnd

Type: HWND
A handle to the window.
lpRect

Type: LPRECT
A pointer to a RECT structure that receives the screen coordinates of the upper-left and lower-right corners of
the window.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
In conformance with conventions for the RECT structure, the bottom-right coordinates of the returned rectangle
are exclusive. In other words, the pixel at (right , bottom ) lies immediately outside the rectangle.
GetWindowRect is virtualized for DPI.
In Windows Vista and later, the Window Rect now includes the area occupied by the drop shadow.
Calling GetWindowRect will have different behavior depending on whether the window has ever been shown or
not. If the window has not been shown before, GetWindowRect will not include the area of the drop shadow.
To get the window bounds excluding the drop shadow, use DwmGetWindowAttribute, specifying
DWMWA_EXTENDED_FRAME_BOUNDS . Note that unlike the Window Rect, the DWM Extended Frame
Bounds are not adjusted for DPI. Getting the extended frame bounds can only be done after the window has
been shown at least once.
Examples
For an example, see Initializing a Dialog Box.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetClientRect
Reference
ScreenToClient
SetWindowPos
Windows
GetWindowTextA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control,
the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another
application.

Syntax
int GetWindowTextA(
HWND hWnd,
LPSTR lpString,
int nMaxCount
);

Parameters
hWnd

Type: HWND
A handle to the window or control containing the text.
lpString

Type: LPTSTR
The buffer that will receive the text. If the string is as long or longer than the buffer, the string is truncated and
terminated with a null character.
nMaxCount

Type: int
The maximum number of characters to copy to the buffer, including the null character. If the text exceeds this
limit, it is truncated.

Return value
Type: int
If the function succeeds, the return value is the length, in characters, of the copied string, not including the
terminating null character. If the window has no title bar or text, if the title bar is empty, or if the window or
control handle is invalid, the return value is zero. To get extended error information, call GetLastError.
This function cannot retrieve the text of an edit control in another application.

Remarks
If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be
sent to the specified window or control. If the target window is owned by another process and has a caption,
GetWindowText retrieves the window caption text. If the window does not have a caption, the return value is a
null string. This behavior is by design. It allows applications to call GetWindowText without becoming
unresponsive if the process that owns the target window is not responding. However, if the target window is not
responding and it belongs to the calling application, GetWindowText will cause the calling application to
become unresponsive.
To retrieve the text of a control in another process, send a WM_GETTEXT message directly instead of calling
GetWindowText .
Examples
For an example, see Sending a Message.

NOTE
The winuser.h header defines GetWindowText as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows


10, version 10.0.14393)

See also
Conceptual
GetWindowTextLength
Reference
SetWindowText
WM_GETTEXT
Windows
GetWindowTextLengthA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the length, in characters, of the specified window's title bar text (if the window has a title bar). If the
specified window is a control, the function retrieves the length of the text within the control. However,
GetWindowTextLength cannot retrieve the length of the text of an edit control in another application.

Syntax
int GetWindowTextLengthA(
HWND hWnd
);

Parameters
hWnd

Type: HWND
A handle to the window or control.

Return value
Type: int
If the function succeeds, the return value is the length, in characters, of the text. Under certain conditions, this
value might be greater than the length of the text (see Remarks).
If the window has no text, the return value is zero.
Function failure is indicated by a return value of zero and a GetLastError result that is nonzero.

NOTE
This function does not clear the most recent error information. To determine success or failure, clear the most recent error
information by calling SetLastError with 0, then call GetLastError.

Remarks
If the target window is owned by the current process, GetWindowTextLength causes a WM_GETTEXTLENGTH
message to be sent to the specified window or control.
Under certain conditions, the GetWindowTextLength function may return 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 double-byte character set (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. It can also occur when an application uses the ANSI version of GetWindowTextLength with a
window whose window procedure is Unicode, or the Unicode version of GetWindowTextLength with a
window whose window procedure is ANSI. For more information on ANSI and ANSI functions, see Conventions
for Function Prototypes.
To obtain the exact length of the text, use the WM_GETTEXT, LB_GETTEXT, or CB_GETLBTEXT messages, or the
GetWindowText function.

NOTE
The winuser.h header defines GetWindowTextLength as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows


8.1)

See also
CB_GETLBTEXT
Conceptual
GetWindowText
LB_GETTEXT
Other Resources
Reference
SetWindowText
WM_GETTEXT
WM_GETTEXTLENGTH
Windows
GetWindowTextLengthW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the length, in characters, of the specified window's title bar text (if the window has a title bar). If the
specified window is a control, the function retrieves the length of the text within the control. However,
GetWindowTextLength cannot retrieve the length of the text of an edit control in another application.

Syntax
int GetWindowTextLengthW(
HWND hWnd
);

Parameters
hWnd

Type: HWND
A handle to the window or control.

Return value
Type: int
If the function succeeds, the return value is the length, in characters, of the text. Under certain conditions, this
value might be greater than the length of the text (see Remarks).
If the window has no text, the return value is zero.
Function failure is indicated by a return value of zero and a GetLastError result that is nonzero.

NOTE
This function does not clear the most recent error information. To determine success or failure, clear the most recent error
information by calling SetLastError with 0, then call GetLastError.

Remarks
If the target window is owned by the current process, GetWindowTextLength causes a WM_GETTEXTLENGTH
message to be sent to the specified window or control.
Under certain conditions, the GetWindowTextLength function may return 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 double-byte character set (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. It can also occur when an application uses the ANSI version of GetWindowTextLength with a
window whose window procedure is Unicode, or the Unicode version of GetWindowTextLength with a
window whose window procedure is ANSI. For more information on ANSI and ANSI functions, see Conventions
for Function Prototypes.
To obtain the exact length of the text, use the WM_GETTEXT, LB_GETTEXT, or CB_GETLBTEXT messages, or the
GetWindowText function.

NOTE
The winuser.h header defines GetWindowTextLength as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows


8.1)

See also
CB_GETLBTEXT
Conceptual
GetWindowText
LB_GETTEXT
Other Resources
Reference
SetWindowText
WM_GETTEXT
WM_GETTEXTLENGTH
Windows
GetWindowTextW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control,
the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another
application.

Syntax
int GetWindowTextW(
HWND hWnd,
LPWSTR lpString,
int nMaxCount
);

Parameters
hWnd

Type: HWND
A handle to the window or control containing the text.
lpString

Type: LPTSTR
The buffer that will receive the text. If the string is as long or longer than the buffer, the string is truncated and
terminated with a null character.
nMaxCount

Type: int
The maximum number of characters to copy to the buffer, including the null character. If the text exceeds this
limit, it is truncated.

Return value
Type: int
If the function succeeds, the return value is the length, in characters, of the copied string, not including the
terminating null character. If the window has no title bar or text, if the title bar is empty, or if the window or
control handle is invalid, the return value is zero. To get extended error information, call GetLastError.
This function cannot retrieve the text of an edit control in another application.

Remarks
If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be
sent to the specified window or control. If the target window is owned by another process and has a caption,
GetWindowText retrieves the window caption text. If the window does not have a caption, the return value is a
null string. This behavior is by design. It allows applications to call GetWindowText without becoming
unresponsive if the process that owns the target window is not responding. However, if the target window is not
responding and it belongs to the calling application, GetWindowText will cause the calling application to
become unresponsive.
To retrieve the text of a control in another process, send a WM_GETTEXT message directly instead of calling
GetWindowText .
Examples
For an example, see Sending a Message.

NOTE
The winuser.h header defines GetWindowText as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows


10, version 10.0.14393)

See also
Conceptual
GetWindowTextLength
Reference
SetWindowText
WM_GETTEXT
Windows
GetWindowThreadProcessId function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves the identifier of the thread that created the specified window and, optionally, the identifier of the
process that created the window.

Syntax
DWORD GetWindowThreadProcessId(
HWND hWnd,
LPDWORD lpdwProcessId
);

Parameters
hWnd

Type: HWND
A handle to the window.
lpdwProcessId

Type: LPDWORD
A pointer to a variable that receives the process identifier. If this parameter is not NULL ,
GetWindowThreadProcessId copies the identifier of the process to the variable; otherwise, it does not.

Return value
Type: DWORD
The return value is the identifier of the thread that created the window.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll
API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows
8)

See also
Windows Overview
GUITHREADINFO structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains information about a GUI thread.

Syntax
typedef struct tagGUITHREADINFO {
DWORD cbSize;
DWORD flags;
HWND hwndActive;
HWND hwndFocus;
HWND hwndCapture;
HWND hwndMenuOwner;
HWND hwndMoveSize;
HWND hwndCaret;
RECT rcCaret;
} GUITHREADINFO, *PGUITHREADINFO, *LPGUITHREADINFO;

Members
cbSize

Type: DWORD
The size of this structure, in bytes. The caller must set this member to sizeof(GUITHREADINFO) .
flags

Type: DWORD
The thread state. This member can be one or more of the following values.

VA L UE M EA N IN G

The caret's blink state. This bit is set if the caret is visible.
GUI_CARETBLINKING
0x00000001

The thread's menu state. This bit is set if the thread is in


GUI_INMENUMODE menu mode.
0x00000004

The thread's move state. This bit is set if the thread is in a


GUI_INMOVESIZE move or size loop.
0x00000002

The thread's pop-up menu state. This bit is set if the thread
GUI_POPUPMENUMODE has an active pop-up menu.
0x00000010
The thread's system menu state. This bit is set if the thread is
GUI_SYSTEMMENUMODE in a system menu mode.
0x00000008

hwndActive

Type: HWND
A handle to the active window within the thread.
hwndFocus

Type: HWND
A handle to the window that has the keyboard focus.
hwndCapture

Type: HWND
A handle to the window that has captured the mouse.
hwndMenuOwner

Type: HWND
A handle to the window that owns any active menus.
hwndMoveSize

Type: HWND
A handle to the window in a move or size loop.
hwndCaret

Type: HWND
A handle to the window that is displaying the caret.
rcCaret

Type: RECT
The caret's bounding rectangle, in client coordinates, relative to the window specified by the hwndCaret
member.

Remarks
This structure is used with the GetGUIThreadInfo function to retrieve information about the active window or a
specified GUI thread.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]
Header winuser.h (include Windows.h)

Redistributable Service Pack 3

See also
Conceptual
GetGUIThreadInfo
Reference
Windows
HOOKPROC callback function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

An application-defined or library-defined callback function used with the SetWindowsHookEx function. The
system calls this function after the SendMessage function is called. The hook procedure can examine the
message; it cannot modify it.
The HOOKPROC type defines a pointer to this callback function. CallWndRetProc is a placeholder for the
application-defined or library-defined function name.

Syntax
HOOKPROC Hookproc;

LRESULT Hookproc(
int code,
WPARAM wParam,
LPARAM lParam
)
{...}

Parameters
code

wParam

Type: WPARAM
Specifies whether the message is sent by the current process. If the message is sent by the current process, it is
nonzero; otherwise, it is NULL .
lParam

Type: LPARAM
A pointer to a CWPRETSTRUCT structure that contains details about the message.

Return value
Type: LRESULT
If nCode is less than zero, the hook procedure must return the value returned by CallNextHookEx.
If nCode is greater than or equal to zero, it is highly recommended that you call CallNextHookEx and return the
value it returns; otherwise, other applications that have installed WH_CALLWNDPROCRET hooks will not receive
hook notifications and may behave incorrectly as a result. If the hook procedure does not call CallNextHookEx ,
the return value should be zero.

Remarks
An application installs the hook procedure by specifying the WH_CALLWNDPROCRET hook type and a pointer
to the hook procedure in a call to the SetWindowsHookEx function.
Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

See also
CWPRETSTRUCT
CallNextHookEx
CallWndProc
Conceptual
Hooks
Reference
SendMessage
SetWindowsHookEx
InSendMessage function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Determines whether the current window procedure is processing a message that was sent from another thread
(in the same process or a different process) by a call to the SendMessage function.
To obtain additional information about how the message was sent, use the InSendMessageEx function.

Syntax
BOOL InSendMessage();

Parameters
This function has no parameters.

Return value
Type: BOOL
If the window procedure is processing a message sent to it from another thread using the SendMessage
function, the return value is nonzero.
If the window procedure is not processing a message sent to it from another thread using the SendMessage
function, the return value is zero.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
InSendMessageEx
Messages and Message Queues
Reference
SendMessage
InSendMessageEx function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Determines whether the current window procedure is processing a message that was sent from another thread
(in the same process or a different process).

Syntax
DWORD InSendMessageEx(
LPVOID lpReserved
);

Parameters
lpReserved

Type: LPVOID
Reserved; must be NULL .

Return value
Type: DWORD
If the message was not sent, the return value is ISMEX_NOSEND (0x00000000). Otherwise, the return value is
one or more of the following values.

RET URN C O DE/ VA L UE DESC RIP T IO N

The message was sent using the SendMessageCallback


ISMEX_CALLBACK function. The thread that sent the message is not blocked.
0x00000004

The message was sent using the SendNotifyMessage


ISMEX_NOTIFY function. The thread that sent the message is not blocked.
0x00000002

The window procedure has processed the message. The


ISMEX_REPLIED thread that sent the message is no longer blocked.
0x00000008

The message was sent using the SendMessage or


ISMEX_SEND SendMessageTimeout function. If ISMEX_REPLIED is not
0x00000001 set, the thread that sent the message is blocked.

Remarks
To determine if the sender is blocked, use the following test:
fBlocked = ( InSendMessageEx(NULL) & (ISMEX_REPLIED|ISMEX_SEND) ) == ISMEX_SEND;
Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
Messages and Message Queues
Reference
SendMessage
SendMessageCallback
SendMessageTimeout
SendNotifyMessage
InternalGetWindowText function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

[This function is not intended for general use. It may be altered or unavailable in subsequent versions of
Windows.]
Copies the text of the specified window's title bar (if it has one) into a buffer.
This function is similar to the GetWindowText function. However, it obtains the window text directly from the
window structure associated with the specified window's handle and then always provides the text as a Unicode
string. This is unlike GetWindowText which obtains the text by sending the window a WM_GETTEXT message. If
the specified window is a control, the text of the control is obtained.

Syntax
int InternalGetWindowText(
HWND hWnd,
LPWSTR pString,
int cchMaxCount
);

Parameters
hWnd

Type: HWND
A handle to the window or control containing the text.
pString

Type: LPWSTR
The buffer that is to receive the text.

If the
string is as long or longer than the buffer, the string is truncated and
terminated with a null character.

cchMaxCount

Type: int
The maximum number of characters to be copied to the buffer, including the null character. If the text exceeds
this limit, it is truncated.

Return value
Type: int
If the function succeeds, the return value is the length, in characters, of the copied string, not including the
terminating null character. If the window has no title bar or text, if the title bar is empty, or if the window or
control handle is invalid, the return value is zero. To get extended error information, call GetLastError.
Remarks
This function was not included in the SDK headers and libraries until Windows XP with Service Pack 1 (SP1) and
Windows Server 2003. If you do not have a header file and import library for this function, you can call the
function using LoadLibrary and GetProcAddress.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
Conceptual
GetWindowText
GetWindowTextLength
Reference
SetWindowText
Using Messages and Message Queues
WM_GETTEXT
Windows
IsChild function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Determines whether a window is a child window or descendant window of a specified parent window. A child
window is the direct descendant of a specified parent window if that parent window is in the chain of parent
windows; the chain of parent windows leads from the original overlapped or pop-up window to the child
window.

Syntax
BOOL IsChild(
HWND hWndParent,
HWND hWnd
);

Parameters
hWndParent

Type: HWND
A handle to the parent window.
hWnd

Type: HWND
A handle to the window to be tested.

Return value
Type: BOOL
If the window is a child or descendant window of the specified parent window, the return value is nonzero.
If the window is not a child or descendant window of the specified parent window, the return value is zero.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib
DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
IsWindow
Reference
SetParent
Windows
IsGUIThread function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Determines whether the calling thread is already a GUI thread. It can also optionally convert the thread to a GUI
thread.

Syntax
BOOL IsGUIThread(
BOOL bConvert
);

Parameters
bConvert

Type: BOOL
If TRUE and the thread is not a GUI thread, convert the thread to a GUI thread.

Return value
Type: BOOL
The function returns a nonzero value in the following situations:
If the calling thread is already a GUI thread.
If bConvert is TRUE and the function successfully converts the thread to a GUI thread.
Otherwise, the function returns zero.
If bConvert is TRUE and the function cannot successfully convert the thread to a GUI thread, IsGUIThread
returns ERROR_NOT_ENOUGH_MEMORY .

Requirements

Minimum suppor ted client Windows XP [desktop apps only]

Minimum suppor ted ser ver Windows Server 2003 [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll
See also
Windows Overview
IsHungAppWindow function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

[This function is not intended for general use. It may be altered or unavailable in subsequent versions of
Windows.]
Determines whether the system considers that a specified application is not responding. An application is
considered to be not responding if it is not waiting for input, is not in startup processing, and has not called
PeekMessage within the internal timeout period of 5 seconds.

Syntax
BOOL IsHungAppWindow(
HWND hwnd
);

Parameters
hwnd

Type: HWND
A handle to the window to be tested.

Return value
Type: BOOL
The return value is TRUE if the window stops responding; otherwise, it is FALSE . Ghost windows always return
TRUE .

Remarks
The Windows timeout criteria of 5 seconds is subject to change.
This function was not included in the SDK headers and libraries until Windows XP Service Pack 1 (SP1) and
Windows Server 2003. If you do not have a header file and import library for this function, you can call the
function using LoadLibrary and GetProcAddress.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)


Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-3 (introduced in Windows


10, version 10.0.10240)

See also
Conceptual
IsWindow
Reference
Windows
IsIconic function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Determines whether the specified window is minimized (iconic).

Syntax
BOOL IsIconic(
HWND hWnd
);

Parameters
hWnd

Type: HWND
A handle to the window to be tested.

Return value
Type: BOOL
If the window is iconic, the return value is nonzero.
If the window is not iconic, the return value is zero.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
IsZoomed
Reference
Windows
IsProcessDPIAware function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

[IsProcessDPIAware is available for use in the operating systems specified in the Requirements section. It may be
altered or unavailable in subsequent versions. Instead, use GetProcessDPIAwareness.]
Determines whether the current process is dots per inch (dpi) aware such that it adjusts the sizes of UI elements
to compensate for the dpi setting.

Syntax
BOOL IsProcessDPIAware();

Parameters
This function has no parameters.

Return value
Type: BOOL
TRUE if the process is dpi aware; otherwise, FALSE .

Requirements

Minimum suppor ted client Windows Vista [desktop apps only]

Minimum suppor ted ser ver Windows Server 2008 [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll
IsWindow function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Determines whether the specified window handle identifies an existing window.

Syntax
BOOL IsWindow(
HWND hWnd
);

Parameters
hWnd

Type: HWND
A handle to the window to be tested.

Return value
Type: BOOL
If the window handle identifies an existing window, the return value is nonzero.
If the window handle does not identify an existing window, the return value is zero.

Remarks
A thread should not use IsWindow for a window that it did not create because the window could be destroyed
after this function was called. Further, because window handles are recycled the handle could even point to a
different window.
Examples
For an example, see Creating a Modeless Dialog Box.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib
DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
IsWindowEnabled
IsWindowVisible
Reference
Windows
IsWindowUnicode function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Determines whether the specified window is a native Unicode window.

Syntax
BOOL IsWindowUnicode(
HWND hWnd
);

Parameters
hWnd

Type: HWND
A handle to the window to be tested.

Return value
Type: BOOL
If the window is a native Unicode window, the return value is nonzero.
If the window is not a native Unicode window, the return value is zero. The window is a native ANSI window.

Remarks
The character set of a window is determined by the use of the RegisterClass function. If the window class was
registered with the ANSI version of RegisterClass (RegisterClassA ), the character set of the window is ANSI. If
the window class was registered with the Unicode version of RegisterClass (RegisterClassW ), the character
set of the window is Unicode.
The system does automatic two-way translation (Unicode to ANSI) for window messages. For example, if an
ANSI window message is sent to a window that uses the Unicode character set, the system translates that
message into a Unicode message before calling the window procedure. The system calls IsWindowUnicode to
determine whether to translate the message.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)


Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows


8.1)

See also
Windows Overview
IsWindowVisible function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Determines the visibility state of the specified window.

Syntax
BOOL IsWindowVisible(
HWND hWnd
);

Parameters
hWnd

Type: HWND
A handle to the window to be tested.

Return value
Type: BOOL
If the specified window, its parent window, its parent's parent window, and so forth, have the WS_VISIBLE style,
the return value is nonzero. Otherwise, the return value is zero.
Because the return value specifies whether the window has the WS_VISIBLE style, it may be nonzero even if the
window is totally obscured by other windows.

Remarks
The visibility state of a window is indicated by the WS_VISIBLE style bit. When WS_VISIBLE is set, the window
is displayed and subsequent drawing into it is displayed as long as the window has the WS_VISIBLE style.
Any drawing to a window with the WS_VISIBLE style will not be displayed if the window is obscured by other
windows or is clipped by its parent window.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib
DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows


8.1)

See also
Conceptual
Reference
ShowWindow
Windows
IsZoomed function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Determines whether a window is maximized.

Syntax
BOOL IsZoomed(
HWND hWnd
);

Parameters
hWnd

Type: HWND
A handle to the window to be tested.

Return value
Type: BOOL
If the window is zoomed, the return value is nonzero.
If the window is not zoomed, the return value is zero.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-3 (introduced in Windows


10, version 10.0.10240)

See also
Conceptual
IsIconic
Reference
Windows
KBDLLHOOKSTRUCT structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains information about a low-level keyboard input event.

Syntax
typedef struct tagKBDLLHOOKSTRUCT {
DWORD vkCode;
DWORD scanCode;
DWORD flags;
DWORD time;
ULONG_PTR dwExtraInfo;
} KBDLLHOOKSTRUCT, *LPKBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT;

Members
vkCode

Type: DWORD
A virtual-key code. The code must be a value in the range 1 to 254.
scanCode

Type: DWORD
A hardware scan code for the key.
flags

Type: DWORD
The extended-key flag, event-injected flags, context code, and transition-state flag. This member is specified as
follows. An application can use the following values to test the keystroke flags. Testing LLKHF_INJECTED (bit 4)
will tell you whether the event was injected. If it was, then testing LLKHF_LOWER_IL_INJECTED (bit 1) will tell you
whether or not the event was injected from a process running at lower integrity level.

VA L UE M EA N IN G

Test the extended-key flag.


LLKHF_EXTENDED
(KF_EXTENDED >> 8)

Test the event-injected (from a process running at lower


LLKHF_LOWER_IL_INJECTED integrity level) flag.
0x00000002

Test the event-injected (from any process) flag.


LLKHF_INJECTED
0x00000010
Test the context code.
LLKHF_ALTDOWN
(KF_ALTDOWN >> 8)

Test the transition-state flag.


LLKHF_UP
(KF_UP >> 8)

The following table describes the layout of this value.

B IT S DESC RIP T IO N

0 Specifies whether the key is an extended key, such as a


function key or a key on the numeric keypad. The value is 1
if the key is an extended key; otherwise, it is 0.

1 Specifies whether the event was injected from a process


running at lower integrity level. The value is 1 if that is the
case; otherwise, it is 0. Note that bit 4 is also set whenever
bit 1 is set.

2-3 Reserved.

4 Specifies whether the event was injected. The value is 1 if


that is the case; otherwise, it is 0. Note that bit 1 is not
necessarily set when bit 4 is set.

5 The context code. The value is 1 if the ALT key is pressed;


otherwise, it is 0.

6 Reserved.

7 The transition state. The value is 0 if the key is pressed and 1


if it is being released.

time

Type: DWORD
The time stamp for this message, equivalent to what GetMessageTime would return for this message.
dwExtraInfo

Type: ULONG_PTR
Additional information associated with the message.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]
Header winuser.h (include Windows.h)

See also
Conceptual
Hooks
LowLevelKeyboardProc
Reference
SetWindowsHookEx
KillTimer function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Destroys the specified timer.

Syntax
BOOL KillTimer(
HWND hWnd,
UINT_PTR uIDEvent
);

Parameters
hWnd

Type: HWND
A handle to the window associated with the specified timer. This value must be the same as the hWnd value
passed to the SetTimer function that created the timer.
uIDEvent

Type: UINT_PTR
The timer to be destroyed. If the window handle passed to SetTimer is valid, this parameter must be the same as
the nIDEvent
value passed to SetTimer . If the application calls SetTimer with hWnd set to NULL , this parameter must be the
timer identifier returned by SetTimer .

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
The KillTimer function does not remove WM_TIMER messages already posted to the message queue.
Examples
For an example, see Destroying a Timer.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]
Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-2 (introduced in Windows


10, version 10.0.10240)

See also
Conceptual
Reference
SetTimer
Timers
WM_TIMER
LockSetForegroundWindow function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

The foreground process can call the LockSetForegroundWindow function to disable calls to the
SetForegroundWindow function.

Syntax
BOOL LockSetForegroundWindow(
UINT uLockCode
);

Parameters
uLockCode

Type: UINT
Specifies whether to enable or disable calls to SetForegroundWindow. This parameter can be one of the
following values.

VA L UE M EA N IN G

Disables calls to SetForegroundWindow.


LSFW_LOCK
1

Enables calls to SetForegroundWindow.


LSFW_UNLOCK
2

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
The system automatically enables calls to SetForegroundWindow if the user presses the ALT key or takes some
action that causes the system itself to change the foreground window (for example, clicking a background
window).
This function is provided so applications can prevent other applications from making a foreground change that
can interrupt its interaction with the user.

Requirements
Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-3 (introduced in Windows


10, version 10.0.10240)

See also
AllowSetForegroundWindow
Conceptual
Reference
SetForegroundWindow
Windows
LogicalToPhysicalPoint function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Converts the logical coordinates of a point in a window to physical coordinates.

Syntax
BOOL LogicalToPhysicalPoint(
HWND hWnd,
LPPOINT lpPoint
);

Parameters
hWnd

Type: HWND
A handle to the window whose transform is used for the conversion. Top level windows are fully supported. In
the case of child windows, only the area of overlap between the parent and the child window is converted.
lpPoint

Type: LPPOINT
A pointer to a POINT structure that specifies the logical coordinates to be converted. The new physical
coordinates are copied into this structure if the function succeeds.

Return value
None

Remarks
Windows Vista introduces the concept of physical coordinates. Desktop Window Manager (DWM) scales non-
dots per inch (dpi) aware windows when the display is high dpi. The window seen on the screen corresponds to
the physical coordinates. The application continues to work in logical space. Therefore, the application's view of
the window is different from that which appears on the screen. For scaled windows, logical and physical
coordinates are different.
LogicalToPhysicalPoint is a transformation API that can be called by a process that declares itself as dpi
aware. The function uses the window identified by the hWnd parameter and the logical coordinates given in the
POINT structure to compute the physical coordinates.
The LogicalToPhysicalPoint function replaces the logical coordinates in the POINT structure with the physical
coordinates. The physical coordinates are relative to the upper-left corner of the screen. The coordinates have to
be inside the client area of hWnd.
On all platforms, LogicalToPhysicalPoint will fail on a window that has either 0 width or height; an application
must first establish a non-0 width and height by calling, for example, MoveWindow. On some versions of
Windows (including Windows 7), LogicalToPhysicalPoint will still fail if MoveWindow has been called after a
call to ShowWindow with SH_HIDE has hidden the window.
In Windows 8, system–DPI aware applications translate between physical and logical space using
PhysicalToLogicalPoint and LogicalToPhysicalPoint. In Windows 8.1, the additional virtualization of the system
and inter-process communications means that for the majority of applications, you do not need these APIs. As a
result, in Windows 8.1, PhysicalToLogicalPoint and LogicalToPhysicalPoint no longer transform points. The
system returns all points to an application in its own coordinate space. This behavior preserves functionality for
the majority of applications, but there are some exceptions in which you must make changes to ensure that the
application works as expected. In those cases, use PhysicalToLogicalPointForPerMonitorDPI and
LogicalToPhysicalPointForPerMonitorDPI.

Requirements

Minimum suppor ted client Windows Vista [desktop apps only]

Minimum suppor ted ser ver Windows Server 2008 [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows


8.1)
MAKELPARAM macro (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Creates a value for use as an lParam parameter in a message. The macro concatenates the specified values.

Syntax
void MAKELPARAM(
l,
h
);

Parameters
l

The low-order word of the new value.


h

The high-order word of the new value.

Return value
None

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

See also
Conceptual
MAKELONG
MAKELRESULT
MAKEWPARAM
Reference
Windows Data Types
MAKELRESULT macro (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Creates a value for use as a return value from a window procedure. The macro concatenates the specified
values.

Syntax
void MAKELRESULT(
l,
h
);

Parameters
l

The low-order word of the new value.


h

The high-order word of the new value.

Return value
None

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

See also
Conceptual
MAKELONG
MAKELPARAM
MAKEWPARAM
Reference
Windows Data Types
MAKEWPARAM macro (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Creates a value for use as a wParam parameter in a message. The macro concatenates the specified values.

Syntax
void MAKEWPARAM(
l,
h
);

Parameters
l

The low-order word of the new value.


h

The high-order word of the new value.

Return value
None

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

See also
Conceptual
MAKELONG
MAKELPARAM
MAKELRESULT
Reference
Windows Data Types
MDICREATESTRUCTA structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains information about the class, title, owner, location, and size of a multiple-document interface (MDI) child
window.

Syntax
typedef struct tagMDICREATESTRUCTA {
LPCSTR szClass;
LPCSTR szTitle;
HANDLE hOwner;
int x;
int y;
int cx;
int cy;
DWORD style;
LPARAM lParam;
} MDICREATESTRUCTA, *LPMDICREATESTRUCTA;

Members
szClass

Type: LPCTSTR
The name of the window class of the MDI child window. The class name must have been registered by a
previous call to the RegisterClass function.
szTitle

Type: LPCTSTR
The title of the MDI child window. The system displays the title in the child window's title bar.
hOwner

Type: HANDLE
A handle to the instance of the application creating the MDI client window.
x

Type: int
The initial horizontal position, in client coordinates, of the MDI child window. If this member is
CW_USEDEFAULT , the MDI child window is assigned the default horizontal position.
y

Type: int
The initial vertical position, in client coordinates, of the MDI child window. If this member is CW_USEDEFAULT ,
the MDI child window is assigned the default vertical position.
cx
Type: int
The initial width, in device units, of the MDI child window. If this member is CW_USEDEFAULT , the MDI child
window is assigned the default width.
cy

Type: int
The initial height, in device units, of the MDI child window. If this member is set to CW_USEDEFAULT , the MDI
child window is assigned the default height.
style

Type: DWORD
The style of the MDI child window. If the MDI client window was created with the MDIS_ALLCHILDSTYLES
window style, this member can be any combination of the window styles listed in the Window Styles page.
Otherwise, this member can be one or more of the following values.

VA L UE M EA N IN G

Creates an MDI child window that is initially minimized.


WS_MINIMIZE
0x20000000L

Creates an MDI child window that is initially maximized.


WS_MAXIMIZE
0x01000000L

Creates an MDI child window that has a horizontal scroll bar.


WS_HSCROLL
0x00100000L

Creates an MDI child window that has a vertical scroll bar.


WS_VSCROLL
0x00200000L

lParam

Type: LPARAM
An application-defined value.

Remarks
When the MDI client window creates an MDI child window by calling CreateWindow, the system sends a
WM_CREATE message to the created window. The lParam member 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.

NOTE
The winuser.h header defines MDICREATESTRUCT as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.
Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
CLIENTCREATESTRUCT
CREATESTRUCT
Conceptual
Multiple Document Interface
Reference
WM_CREATE
MDICREATESTRUCTW structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains information about the class, title, owner, location, and size of a multiple-document interface (MDI) child
window.

Syntax
typedef struct tagMDICREATESTRUCTW {
LPCWSTR szClass;
LPCWSTR szTitle;
HANDLE hOwner;
int x;
int y;
int cx;
int cy;
DWORD style;
LPARAM lParam;
} MDICREATESTRUCTW, *LPMDICREATESTRUCTW;

Members
szClass

Type: LPCTSTR
The name of the window class of the MDI child window. The class name must have been registered by a
previous call to the RegisterClass function.
szTitle

Type: LPCTSTR
The title of the MDI child window. The system displays the title in the child window's title bar.
hOwner

Type: HANDLE
A handle to the instance of the application creating the MDI client window.
x

Type: int
The initial horizontal position, in client coordinates, of the MDI child window. If this member is
CW_USEDEFAULT , the MDI child window is assigned the default horizontal position.
y

Type: int
The initial vertical position, in client coordinates, of the MDI child window. If this member is CW_USEDEFAULT ,
the MDI child window is assigned the default vertical position.
cx
Type: int
The initial width, in device units, of the MDI child window. If this member is CW_USEDEFAULT , the MDI child
window is assigned the default width.
cy

Type: int
The initial height, in device units, of the MDI child window. If this member is set to CW_USEDEFAULT , the MDI
child window is assigned the default height.
style

Type: DWORD
The style of the MDI child window. If the MDI client window was created with the MDIS_ALLCHILDSTYLES
window style, this member can be any combination of the window styles listed in the Window Styles page.
Otherwise, this member can be one or more of the following values.

VA L UE M EA N IN G

Creates an MDI child window that is initially minimized.


WS_MINIMIZE
0x20000000L

Creates an MDI child window that is initially maximized.


WS_MAXIMIZE
0x01000000L

Creates an MDI child window that has a horizontal scroll bar.


WS_HSCROLL
0x00100000L

Creates an MDI child window that has a vertical scroll bar.


WS_VSCROLL
0x00200000L

lParam

Type: LPARAM
An application-defined value.

Remarks
When the MDI client window creates an MDI child window by calling CreateWindow, the system sends a
WM_CREATE message to the created window. The lParam member 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.

NOTE
The winuser.h header defines MDICREATESTRUCT as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.
Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
CLIENTCREATESTRUCT
CREATESTRUCT
Conceptual
Multiple Document Interface
Reference
WM_CREATE
MINIMIZEDMETRICS structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains the scalable metrics associated with minimized windows. This structure is used with the
SystemParametersInfo function when the SPI_GETMINIMIZEDMETRICS or SPI_SETMINIMIZEDMETRICS action
value is specified.

Syntax
typedef struct tagMINIMIZEDMETRICS {
UINT cbSize;
int iWidth;
int iHorzGap;
int iVertGap;
int iArrange;
} MINIMIZEDMETRICS, *PMINIMIZEDMETRICS, *LPMINIMIZEDMETRICS;

Members
cbSize

The size of the structure, in bytes. The caller must set this to sizeof(MINIMIZEDMETRICS) .
iWidth

The width of minimized windows, in pixels.


iHorzGap

The horizontal space between arranged minimized windows, in pixels.


iVertGap

The vertical space between arranged minimized windows, in pixels.


iArrange

The starting position and direction used when arranging minimized windows. The starting position must be one
of the following values.

VA L UE M EA N IN G

Start at the lower-left corner of the work area.


ARW_BOTTOMLEFT
0x0000L

Start at the lower-right corner of the work area.


ARW_BOTTOMRIGHT
0x0001L

Start at the upper-left corner of the work area.


ARW_TOPLEFT
0x0002L
Start at the upper-right corner of the work area.
ARW_TOPRIGHT
0x0003L

The direction must be one of the following values.

VA L UE M EA N IN G

Arrange left (valid with ARW_BOTTOMRIGHT and


ARW_LEFT ARW_TOPRIGHT only).
0x0000L

Arrange right (valid with ARW_BOTTOMLEFT and


ARW_RIGHT ARW_TOPLEFT only).
0x0000L

Arrange up (valid with ARW_BOTTOMLEFT and


ARW_UP ARW_BOTTOMRIGHT only).
0x0004L

Arrange down (valid with ARW_TOPLEFT and


ARW_DOWN ARW_TOPRIGHT only).
0x0004L

Hide minimized windows by moving them off the visible area


ARW_HIDE of the screen.
0x0008L

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
SystemParametersInfo
MINMAXINFO structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains information about a window's maximized size and position and its minimum and maximum tracking
size.

Syntax
typedef struct tagMINMAXINFO {
POINT ptReserved;
POINT ptMaxSize;
POINT ptMaxPosition;
POINT ptMinTrackSize;
POINT ptMaxTrackSize;
} MINMAXINFO, *PMINMAXINFO, *LPMINMAXINFO;

Members
ptReserved

Type: POINT
Reserved; do not use.
ptMaxSize

Type: POINT
The maximized width (x member) and the maximized height (y member) of the window. For top-level windows,
this value is based on the width of the primary monitor.
ptMaxPosition

Type: POINT
The position of the left side of the maximized window (x member) and the position of the top of the maximized
window (y member). For top-level windows, this value is based on the position of the primary monitor.
ptMinTrackSize

Type: POINT
The minimum tracking width (x member) and the minimum tracking height (y member) of the window. This
value can be obtained programmatically from the system metrics SM_CXMINTRACK and SM_CYMINTRACK
(see the GetSystemMetrics function).
ptMaxTrackSize

Type: POINT
The maximum tracking width (x member) and the maximum tracking height (y member) of the window. This
value is based on the size of the virtual screen and can be obtained programmatically from the system metrics
SM_CXMAXTRACK and SM_CYMAXTRACK (see the GetSystemMetrics function).
Remarks
For systems with multiple monitors, the ptMaxSize and ptMaxPosition members describe the maximized size
and position of the window on the primary monitor, even if the window ultimately maximizes onto a secondary
monitor. In that case, the window manager adjusts these values to compensate for differences between the
primary monitor and the monitor that displays the window. Thus, if the user leaves ptMaxSize untouched, a
window on a monitor larger than the primary monitor maximizes to the size of the larger monitor.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
Conceptual
POINT
Reference
WM_GETMINMAXINFO
Windows
MOUSEHOOKSTRUCT structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains information about a mouse event passed to a WH_MOUSE hook procedure, MouseProc.

Syntax
typedef struct tagMOUSEHOOKSTRUCT {
POINT pt;
HWND hwnd;
UINT wHitTestCode;
ULONG_PTR dwExtraInfo;
} MOUSEHOOKSTRUCT, *LPMOUSEHOOKSTRUCT, *PMOUSEHOOKSTRUCT;

Members
pt

Type: POINT
The x- and y-coordinates of the cursor, in screen coordinates.
hwnd

Type: HWND
A handle to the window that will receive the mouse message corresponding to the mouse event.
wHitTestCode

Type: UINT
The hit-test value. For a list of hit-test values, see the description of the WM_NCHITTEST message.
dwExtraInfo

Type: ULONG_PTR
Additional information associated with the message.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
Conceptual
Hooks
MouseProc
Reference
SetWindowsHookEx
WM_NCHITTEST
MOUSEHOOKSTRUCTEX structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains information about a mouse event passed to a WH_MOUSE hook procedure, MouseProc.
This is an extension of the MOUSEHOOKSTRUCT structure that includes information about wheel movement or
the use of the X button.

Syntax
typedef struct tagMOUSEHOOKSTRUCTEX : tagMOUSEHOOKSTRUCT {
DWORD mouseData;
} MOUSEHOOKSTRUCTEX, *LPMOUSEHOOKSTRUCTEX, *PMOUSEHOOKSTRUCTEX;

Inheritance
The MOUSEHOOKSTRUCTEX structure implements tagMOUSEHOOKSTRUCT.

Members
mouseData

Type: DWORD
If the message is WM_MOUSEWHEEL, the HIWORD of this member is the wheel delta. The LOWORD is
undefined and reserved. 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. One wheel click is defined as
WHEEL_DELTA, which is 120.
If the message is WM_XBUTTONDOWN, WM_XBUTTONUP, WM_XBUTTONDBLCLK, WM_NCXBUTTONDOWN,
WM_NCXBUTTONUP, or WM_NCXBUTTONDBLCLK, the HIWORD of mouseData specifies which X button was
pressed or released, and the LOWORD is undefined and reserved. This member can be one or more of the
following values. Otherwise, mouseData is not used.

VA L UE M EA N IN G

The first X button was pressed or released.


XBUTTON1
0x0001

The second X button was pressed or released.


XBUTTON2
0x0002

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]
Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
Conceptual
Hooks
MOUSEHOOKSTRUCT
MouseProc
Reference
WM_MOUSEWHEEL
WM_NCXBUTTONDBLCLK
WM_NCXBUTTONDOWN
WM_NCXBUTTONUP
WM_XBUTTONDBLCLK
WM_XBUTTONDOWN
WM_XBUTTONUP
MoveWindow function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Changes the position and dimensions of the specified window. For a top-level window, the position and
dimensions are relative to the upper-left corner of the screen. For a child window, they are relative to the upper-
left corner of the parent window's client area.

Syntax
BOOL MoveWindow(
HWND hWnd,
int X,
int Y,
int nWidth,
int nHeight,
BOOL bRepaint
);

Parameters
hWnd

Type: HWND
A handle to the window.
X

Type: int
The new position of the left side of the window.
Y

Type: int
The new position of the top of the window.
nWidth

Type: int
The new width of the window.
nHeight

Type: int
The new height of the window.
bRepaint

Type: BOOL
Indicates whether the window is to be repainted. If this parameter is TRUE , the window receives a message. If
the parameter is FALSE , no repainting of any kind occurs. This applies to the client area, the nonclient area
(including the title bar and scroll bars), and any part of the parent window uncovered as a result of moving a
child window.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
If the bRepaint parameter is TRUE , the system sends the WM_PAINT message to the window procedure
immediately after moving the window (that is, the MoveWindow function calls the UpdateWindow function). If
bRepaint is FALSE , the application must explicitly invalidate or redraw any parts of the window and parent
window that need redrawing.
MoveWindow sends the WM_WINDOWPOSCHANGING, WM_WINDOWPOSCHANGED, WM_MOVE, WM_SIZE,
and WM_NCCALCSIZE messages to the window.
Examples
For an example, see Creating, Enumerating, and Sizing Child Windows.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows


8.1)

See also
Conceptual
Other Resources
Reference
SetWindowPos
UpdateWindow
WM_GETMINMAXINFO
WM_PAINT
Windows
MSG structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains message information from a thread's message queue.

Syntax
typedef struct tagMSG {
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
DWORD lPrivate;
} MSG, *PMSG, *NPMSG, *LPMSG;

Members
hwnd

Type: HWND
A handle to the window whose window procedure receives the message. This member is NULL when the
message is a thread message.
message

Type: UINT
The message identifier. Applications can only use the low word; the high word is reserved by the system.
wParam

Type: WPARAM
Additional information about the message. The exact meaning depends on the value of the message member.
lParam

Type: LPARAM
Additional information about the message. The exact meaning depends on the value of the message member.
time

Type: DWORD
The time at which the message was posted.
pt

Type: POINT
The cursor position, in screen coordinates, when the message was posted.
lPrivate
Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps | UWP apps]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps | UWP apps]

Header winuser.h (include Windows.h)

See also
Conceptual
GetMessage
Messages and Message Queues
PeekMessage
PostThreadMessage
Reference
MSLLHOOKSTRUCT structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains information about a low-level mouse input event.

Syntax
typedef struct tagMSLLHOOKSTRUCT {
POINT pt;
DWORD mouseData;
DWORD flags;
DWORD time;
ULONG_PTR dwExtraInfo;
} MSLLHOOKSTRUCT, *LPMSLLHOOKSTRUCT, *PMSLLHOOKSTRUCT;

Members
pt

Type: POINT
The x- and y-coordinates of the cursor, in per-monitor-aware screen coordinates.
mouseData

Type: DWORD
If the message is WM_MOUSEWHEEL, the high-order word of this member is the wheel delta. The low-order
word is reserved. 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. One wheel click is defined as
WHEEL_DELTA , which is 120.
If the message is WM_XBUTTONDOWN, WM_XBUTTONUP, WM_XBUTTONDBLCLK, WM_NCXBUTTONDOWN,
WM_NCXBUTTONUP, or WM_NCXBUTTONDBLCLK, the high-order word specifies which X button was pressed
or released, and the low-order word is reserved. This value can be one or more of the following values.
Otherwise, mouseData is not used.

VA L UE M EA N IN G

The first X button was pressed or released.


XBUTTON1
0x0001

The second X button was pressed or released.


XBUTTON2
0x0002

flags

Type: DWORD
The event-injected flags. An application can use the following values to test the flags. Testing LLMHF_INJECTED
(bit 0) will tell you whether the event was injected. If it was, then testing LLMHF_LOWER_IL_INJECTED (bit 1) will
tell you whether or not the event was injected from a process running at lower integrity level.

VA L UE M EA N IN G

Test the event-injected (from any process) flag.


LLMHF_INJECTED
0x00000001

Test the event-injected (from a process running at lower


LLMHF_LOWER_IL_INJECTED integrity level) flag.
0x00000002

time

Type: DWORD
The time stamp for this message.
dwExtraInfo

Type: ULONG_PTR
Additional information associated with the message.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
Conceptual
Hooks
LowLevelMouseProc
Other Resources
POINT
Reference
SetWindowsHookEx
WM_MOUSEWHEEL
WM_NCXBUTTONDBLCLK
WM_NCXBUTTONDOWN
WM_NCXBUTTONUP
WM_XBUTTONDBLCLK
WM_XBUTTONDOWN
WM_XBUTTONUP
NCCALCSIZE_PARAMS structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains information that an application can use while processing the WM_NCCALCSIZE message to calculate
the size, position, and valid contents of the client area of a window.

Syntax
typedef struct tagNCCALCSIZE_PARAMS {
RECT rgrc[3];
PWINDOWPOS lppos;
} NCCALCSIZE_PARAMS, *LPNCCALCSIZE_PARAMS;

Members
rgrc

Type: RECT [3]


An array of rectangles. The meaning of the array of rectangles changes during the processing of the
WM_NCCALCSIZE message.
When the window procedure receives the WM_NCCALCSIZE message, the first rectangle contains the new
coordinates of a window that has been moved or resized, that is, it is the proposed new window coordinates.
The second contains the coordinates of the window before it was moved or resized. The third contains the
coordinates of the window's client area before the window was moved or resized. If the window is a child
window, the coordinates are relative to the client area of the parent window. If the window is a top-level window,
the coordinates are relative to the screen origin.
When the window procedure returns, the first rectangle contains the coordinates of the new client rectangle
resulting from the move or resize. The second rectangle contains the valid destination rectangle, and the third
rectangle contains the valid source rectangle. The last two rectangles are used in conjunction with the return
value of the WM_NCCALCSIZE message to determine the area of the window to be preserved.
lppos

Type: PWINDOWPOS
A pointer to a WINDOWPOS structure that contains the size and position values specified in the operation that
moved or resized the window.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)


See also
Conceptual
MoveWindow
Other Resources
RECT
Reference
SetWindowPos
WINDOWPOS
WM_NCCALCSIZE
Windows
NONCLIENTMETRICSA structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains the scalable metrics associated with the nonclient area of a nonminimized window. This structure is
used by the SPI_GETNONCLIENTMETRICS and SPI_SETNONCLIENTMETRICS actions of the
SystemParametersInfo function.

Syntax
typedef struct tagNONCLIENTMETRICSA {
UINT cbSize;
int iBorderWidth;
int iScrollWidth;
int iScrollHeight;
int iCaptionWidth;
int iCaptionHeight;
LOGFONTA lfCaptionFont;
int iSmCaptionWidth;
int iSmCaptionHeight;
LOGFONTA lfSmCaptionFont;
int iMenuWidth;
int iMenuHeight;
LOGFONTA lfMenuFont;
LOGFONTA lfStatusFont;
LOGFONTA lfMessageFont;
int iPaddedBorderWidth;
} NONCLIENTMETRICSA, *PNONCLIENTMETRICSA, *LPNONCLIENTMETRICSA;

Members
cbSize

The size of the structure, in bytes. The caller must set this to sizeof(NONCLIENTMETRICS) . For information about
application compatibility, see Remarks.
iBorderWidth

The thickness of the sizing border, in pixels. The default is 1 pixel.


iScrollWidth

The width of a standard vertical scroll bar, in pixels.


iScrollHeight

The height of a standard horizontal scroll bar, in pixels.


iCaptionWidth

The width of caption buttons, in pixels.


iCaptionHeight

The height of caption buttons, in pixels.


lfCaptionFont
A LOGFONT structure that contains information about the caption font.
iSmCaptionWidth

The width of small caption buttons, in pixels.


iSmCaptionHeight

The height of small captions, in pixels.


lfSmCaptionFont

A LOGFONT structure that contains information about the small caption font.
iMenuWidth

The width of menu-bar buttons, in pixels.


iMenuHeight

The height of a menu bar, in pixels.


lfMenuFont

A LOGFONT structure that contains information about the font used in menu bars.
lfStatusFont

A LOGFONT structure that contains information about the font used in status bars and tooltips.
lfMessageFont

A LOGFONT structure that contains information about the font used in message boxes.
iPaddedBorderWidth

The thickness of the padded border, in pixels. The default value is 4 pixels. The iPaddedBorderWidth and
iBorderWidth members are combined for both resizable and nonresizable windows in the Windows Aero
desktop experience. To compile an application that uses this member, define _WIN32_WINNT as 0x0600 or
later. For more information, see Remarks.
Windows Ser ver 2003 and Windows XP/2000: This member is not supported.

Remarks
If the iPaddedBorderWidth member of the NONCLIENTMETRICS structure is present, this structure is 4 bytes
larger than for an application that is compiled with _WIN32_WINNT less than or equal to 0x0502. For more
information about conditional compilation, see Using the Windows Headers.
Windows Ser ver 2003 and Windows XP/2000: If an application that is compiled for Windows
Server 2008 or Windows Vista must also run on Windows Server 2003 or Windows XP/2000, use the
GetVersionEx function to check the operating system version at run time and, if the application is running on
Windows Server 2003 or Windows XP/2000, subtract the size of the iPaddedBorderWidth member from the
cbSize member of the NONCLIENTMETRICS structure before calling the SystemParametersInfo function.
NOTE
The winuser.h header defines NONCLIENTMETRICS as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
LOGFONT
SystemParametersInfo
NONCLIENTMETRICSW structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains the scalable metrics associated with the nonclient area of a nonminimized window. This structure is
used by the SPI_GETNONCLIENTMETRICS and SPI_SETNONCLIENTMETRICS actions of the
SystemParametersInfo function.

Syntax
typedef struct tagNONCLIENTMETRICSW {
UINT cbSize;
int iBorderWidth;
int iScrollWidth;
int iScrollHeight;
int iCaptionWidth;
int iCaptionHeight;
LOGFONTW lfCaptionFont;
int iSmCaptionWidth;
int iSmCaptionHeight;
LOGFONTW lfSmCaptionFont;
int iMenuWidth;
int iMenuHeight;
LOGFONTW lfMenuFont;
LOGFONTW lfStatusFont;
LOGFONTW lfMessageFont;
int iPaddedBorderWidth;
} NONCLIENTMETRICSW, *PNONCLIENTMETRICSW, *LPNONCLIENTMETRICSW;

Members
cbSize

The size of the structure, in bytes. The caller must set this to sizeof(NONCLIENTMETRICS) . For information about
application compatibility, see Remarks.
iBorderWidth

The thickness of the sizing border, in pixels. The default is 1 pixel.


iScrollWidth

The width of a standard vertical scroll bar, in pixels.


iScrollHeight

The height of a standard horizontal scroll bar, in pixels.


iCaptionWidth

The width of caption buttons, in pixels.


iCaptionHeight

The height of caption buttons, in pixels.


lfCaptionFont
A LOGFONT structure that contains information about the caption font.
iSmCaptionWidth

The width of small caption buttons, in pixels.


iSmCaptionHeight

The height of small captions, in pixels.


lfSmCaptionFont

A LOGFONT structure that contains information about the small caption font.
iMenuWidth

The width of menu-bar buttons, in pixels.


iMenuHeight

The height of a menu bar, in pixels.


lfMenuFont

A LOGFONT structure that contains information about the font used in menu bars.
lfStatusFont

A LOGFONT structure that contains information about the font used in status bars and tooltips.
lfMessageFont

A LOGFONT structure that contains information about the font used in message boxes.
iPaddedBorderWidth

The thickness of the padded border, in pixels. The default value is 4 pixels. The iPaddedBorderWidth and
iBorderWidth members are combined for both resizable and nonresizable windows in the Windows Aero
desktop experience. To compile an application that uses this member, define _WIN32_WINNT as 0x0600 or
later. For more information, see Remarks.
Windows Ser ver 2003 and Windows XP/2000: This member is not supported.

Remarks
If the iPaddedBorderWidth member of the NONCLIENTMETRICS structure is present, this structure is 4 bytes
larger than for an application that is compiled with _WIN32_WINNT less than or equal to 0x0502. For more
information about conditional compilation, see Using the Windows Headers.
Windows Ser ver 2003 and Windows XP/2000: If an application that is compiled for Windows
Server 2008 or Windows Vista must also run on Windows Server 2003 or Windows XP/2000, use the
GetVersionEx function to check the operating system version at run time and, if the application is running on
Windows Server 2003 or Windows XP/2000, subtract the size of the iPaddedBorderWidth member from the
cbSize member of the NONCLIENTMETRICS structure before calling the SystemParametersInfo function.
NOTE
The winuser.h header defines NONCLIENTMETRICS as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
LOGFONT
SystemParametersInfo
OpenIcon function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Restores a minimized (iconic) window to its previous size and position; it then activates the window.

Syntax
BOOL OpenIcon(
HWND hWnd
);

Parameters
hWnd

Type: HWND
A handle to the window to be restored and activated.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
OpenIcon sends a WM_QUERYOPEN message to the given window.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
CloseWindow
Conceptual
IsIconic
Reference
ShowWindow
Windows
PeekMessageA function (winuser.h)
2/1/2021 • 4 minutes to read • Edit Online

Dispatches incoming sent messages, checks the thread message queue for a posted message, and retrieves the
message (if any exist).

Syntax
BOOL PeekMessageA(
LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax,
UINT wRemoveMsg
);

Parameters
lpMsg

Type: LPMSG
A pointer to an MSG structure that receives message information.
hWnd

Type: HWND
A handle to the window whose messages are to be retrieved. The window must belong to the current thread.
If hWnd is NULL , PeekMessage retrieves messages for any window that belongs to the current thread, and any
messages on the current thread's message queue whose hwnd value is NULL (see the MSG structure).
Therefore if hWnd is NULL , both window messages and thread messages are processed.
If hWnd is -1, PeekMessage retrieves only messages on the current thread's message queue whose hwnd
value is NULL , that is, thread messages as posted by PostMessage (when the hWnd parameter is NULL ) or
PostThreadMessage.
wMsgFilterMin

Type: UINT
The value of the first message in the range of messages to be examined. Use WM_KEYFIRST (0x0100) to
specify the first keyboard message or WM_MOUSEFIRST (0x0200) to specify the first mouse message.
If wMsgFilterMin and wMsgFilterMax are both zero, PeekMessage returns all available messages (that is, no
range filtering is performed).
wMsgFilterMax

Type: UINT
The value of the last message in the range of messages to be examined. Use WM_KEYL AST to specify the last
keyboard message or WM_MOUSEL AST to specify the last mouse message.
If wMsgFilterMin and wMsgFilterMax are both zero, PeekMessage returns all available messages (that is, no
range filtering is performed).
wRemoveMsg

Type: UINT
Specifies how messages are to be handled. This parameter can be one or more of the following values.

VA L UE M EA N IN G

Messages are not removed from the queue after processing


PM_NOREMOVE by PeekMessage .
0x0000

Messages are removed from the queue after processing by


PM_REMOVE PeekMessage .
0x0001

Prevents the system from releasing any thread that is


PM_NOYIELD waiting for the caller to go idle (see WaitForInputIdle).
0x0002
Combine this value with either PM_NOREMOVE or
PM_REMOVE .

By default, all message types are processed. To specify that only certain message should be processed, specify
one or more of the following values.

VA L UE M EA N IN G

Process mouse and keyboard messages.


PM_QS_INPUT
(QS_INPUT << 16)

Process paint messages.


PM_QS_PAINT
(QS_PAINT << 16)

Process all posted messages, including timers and hotkeys.


PM_QS_POSTMESSAGE
((QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER) << 16)

Process all sent messages.


PM_QS_SENDMESSAGE
(QS_SENDMESSAGE << 16)

Return value
Type: BOOL
If a message is available, the return value is nonzero.
If no messages are available, the return value is zero.

Remarks
PeekMessage retrieves messages associated with the window identified by the hWnd parameter or any of its
children as specified by the IsChild function, and within the range of message values given by the
wMsgFilterMin and wMsgFilterMax parameters. Note that an application can only use the low word in the
wMsgFilterMin and wMsgFilterMax parameters; the high word is reserved for the system.
Note that PeekMessage always retrieves WM_QUIT messages, no matter which values you specify for
wMsgFilterMin and wMsgFilterMax.
During this call, the system delivers pending, nonqueued messages, that is, messages sent to windows owned
by the calling thread using the SendMessage, SendMessageCallback, SendMessageTimeout, or
SendNotifyMessage function. Then the first queued message that matches the specified filter is retrieved. The
system may also process internal events. If no filter is specified, messages are processed in the following order:
Sent messages
Posted messages
Input (hardware) messages and system internal events
Sent messages (again)
WM_PAINT messages
WM_TIMER messages
To retrieve input messages before posted messages, use the wMsgFilterMin and wMsgFilterMax parameters.
The PeekMessage function normally does not remove WM_PAINT messages from the queue. WM_PAINT
messages remain in the queue until they are processed. However, if a WM_PAINT message has a NULL update
region, PeekMessage does remove it from the queue.
If a top-level window stops responding to messages for more than several seconds, the system considers the
window to be not responding and replaces it with a ghost window that has the same z-order, location, size, and
visual attributes. This allows the user to move it, resize it, or even close the application. However, these are the
only actions available because the application is actually not responding. When an application is being
debugged, the system does not generate a ghost window.
DPI Virtualization
This API does not participate in DPI virtualization. The output is in the mode of the window that the message is
targeting. The calling thread is not taken into consideration.
Examples
For an example, see Examining a Message Queue.

NOTE
The winuser.h header defines PeekMessage as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows


Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetMessage
IsChild
MSG
Messages and Message Queues
Other Resources
Reference
WaitForInputIdle
WaitMessage
PeekMessageW function (winuser.h)
2/1/2021 • 4 minutes to read • Edit Online

Dispatches incoming sent messages, checks the thread message queue for a posted message, and retrieves the
message (if any exist).

Syntax
BOOL PeekMessageW(
LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax,
UINT wRemoveMsg
);

Parameters
lpMsg

Type: LPMSG
A pointer to an MSG structure that receives message information.
hWnd

Type: HWND
A handle to the window whose messages are to be retrieved. The window must belong to the current thread.
If hWnd is NULL , PeekMessage retrieves messages for any window that belongs to the current thread, and any
messages on the current thread's message queue whose hwnd value is NULL (see the MSG structure).
Therefore if hWnd is NULL , both window messages and thread messages are processed.
If hWnd is -1, PeekMessage retrieves only messages on the current thread's message queue whose hwnd
value is NULL , that is, thread messages as posted by PostMessage (when the hWnd parameter is NULL ) or
PostThreadMessage.
wMsgFilterMin

Type: UINT
The value of the first message in the range of messages to be examined. Use WM_KEYFIRST (0x0100) to
specify the first keyboard message or WM_MOUSEFIRST (0x0200) to specify the first mouse message.
If wMsgFilterMin and wMsgFilterMax are both zero, PeekMessage returns all available messages (that is, no
range filtering is performed).
wMsgFilterMax

Type: UINT
The value of the last message in the range of messages to be examined. Use WM_KEYL AST to specify the last
keyboard message or WM_MOUSEL AST to specify the last mouse message.
If wMsgFilterMin and wMsgFilterMax are both zero, PeekMessage returns all available messages (that is, no
range filtering is performed).
wRemoveMsg

Type: UINT
Specifies how messages are to be handled. This parameter can be one or more of the following values.

VA L UE M EA N IN G

Messages are not removed from the queue after processing


PM_NOREMOVE by PeekMessage .
0x0000

Messages are removed from the queue after processing by


PM_REMOVE PeekMessage .
0x0001

Prevents the system from releasing any thread that is


PM_NOYIELD waiting for the caller to go idle (see WaitForInputIdle).
0x0002
Combine this value with either PM_NOREMOVE or
PM_REMOVE .

By default, all message types are processed. To specify that only certain message should be processed, specify
one or more of the following values.

VA L UE M EA N IN G

Process mouse and keyboard messages.


PM_QS_INPUT
(QS_INPUT << 16)

Process paint messages.


PM_QS_PAINT
(QS_PAINT << 16)

Process all posted messages, including timers and hotkeys.


PM_QS_POSTMESSAGE
((QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER) << 16)

Process all sent messages.


PM_QS_SENDMESSAGE
(QS_SENDMESSAGE << 16)

Return value
Type: BOOL
If a message is available, the return value is nonzero.
If no messages are available, the return value is zero.

Remarks
PeekMessage retrieves messages associated with the window identified by the hWnd parameter or any of its
children as specified by the IsChild function, and within the range of message values given by the
wMsgFilterMin and wMsgFilterMax parameters. Note that an application can only use the low word in the
wMsgFilterMin and wMsgFilterMax parameters; the high word is reserved for the system.
Note that PeekMessage always retrieves WM_QUIT messages, no matter which values you specify for
wMsgFilterMin and wMsgFilterMax.
During this call, the system delivers pending, nonqueued messages, that is, messages sent to windows owned
by the calling thread using the SendMessage, SendMessageCallback, SendMessageTimeout, or
SendNotifyMessage function. Then the first queued message that matches the specified filter is retrieved. The
system may also process internal events. If no filter is specified, messages are processed in the following order:
Sent messages
Posted messages
Input (hardware) messages and system internal events
Sent messages (again)
WM_PAINT messages
WM_TIMER messages
To retrieve input messages before posted messages, use the wMsgFilterMin and wMsgFilterMax parameters.
The PeekMessage function normally does not remove WM_PAINT messages from the queue. WM_PAINT
messages remain in the queue until they are processed. However, if a WM_PAINT message has a NULL update
region, PeekMessage does remove it from the queue.
If a top-level window stops responding to messages for more than several seconds, the system considers the
window to be not responding and replaces it with a ghost window that has the same z-order, location, size, and
visual attributes. This allows the user to move it, resize it, or even close the application. However, these are the
only actions available because the application is actually not responding. When an application is being
debugged, the system does not generate a ghost window.
DPI Virtualization
This API does not participate in DPI virtualization. The output is in the mode of the window that the message is
targeting. The calling thread is not taken into consideration.
Examples
For an example, see Examining a Message Queue.

NOTE
The winuser.h header defines PeekMessage as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows


Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetMessage
IsChild
MSG
Messages and Message Queues
Other Resources
Reference
WaitForInputIdle
WaitMessage
PhysicalToLogicalPoint function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Converts the physical coordinates of a point in a window to logical coordinates.

Syntax
BOOL PhysicalToLogicalPoint(
HWND hWnd,
LPPOINT lpPoint
);

Parameters
hWnd

Type: HWND
A handle to the window whose transform is used for the conversion. Top level windows are fully supported. In
the case of child windows, only the area of overlap between the parent and the child window is converted.
lpPoint

Type: LPPOINT
A pointer to a POINT structure that specifies the physical/screen coordinates to be converted. The new logical
coordinates are copied into this structure if the function succeeds.

Return value
None

Remarks
Windows Vista introduces the concept of physical coordinates. Desktop Window Manager (DWM) scales non-
dots per inch (dpi) aware windows when the display is high dpi. The window seen on the screen corresponds to
the physical coordinates. The application continues to work in logical space. Therefore, the application's view of
the window is different from that which appears on the screen. For scaled windows, logical and physical
coordinates are different.
The function uses the window identified by the hWnd parameter and the physical coordinates given in the
POINT structure to compute the logical coordinates. The logical coordinates are the unscaled coordinates that
appear to the application in a programmatic way. In other words, the logical coordinates are the coordinates the
application recognizes, which can be different from the physical coordinates. The API then replaces the physical
coordinates with the logical coordinates. The new coordinates are in the world coordinates whose origin is (0, 0)
on the desktop. The coordinates passed to the API have to be on the hWnd.
The source coordinates are in device units.
On all platforms, PhysicalToLogicalPoint will fail on a window that has either 0 width or height; an application
must first establish a non-0 width and height by calling, for example, MoveWindow. On some versions of
Windows (including Windows 7), PhysicalToLogicalPoint will still fail if MoveWindow has been called after a
call to ShowWindow with SH_HIDE has hidden the window.
In Windows 8, system–DPI aware applications translate between physical and logical space using
PhysicalToLogicalPoint and LogicalToPhysicalPoint. In Windows 8.1, the additional virtualization of the system
and inter-process communications means that for the majority of applications, you do not need these APIs. As a
result, in Windows 8.1, PhysicalToLogicalPoint and LogicalToPhysicalPoint no longer transform points. The
system returns all points to an application in its own coordinate space. This behavior preserves functionality for
the majority of applications, but there are some exceptions in which you must make changes to ensure that the
application works as expected. In those cases, use PhysicalToLogicalPointForPerMonitorDPI and
LogicalToPhysicalPointForPerMonitorDPI.

Requirements

Minimum suppor ted client Windows Vista [desktop apps only]

Minimum suppor ted ser ver Windows Server 2008 [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows


8.1)
PostMessageA function (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Places (posts) a message in the message queue associated with the thread that created the specified window
and returns without waiting for the thread to process the message.
To post a message in the message queue associated with a thread, use the PostThreadMessage function.

Syntax
BOOL PostMessageA(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);

Parameters
hWnd

Type: HWND
A handle to the window whose window procedure is to receive the message. The following values have special
meanings.

VA L UE M EA N IN G

The message is posted to all top-level windows in the


HWND_BROADCAST system, including disabled or invisible unowned windows,
((HWND)0xffff) overlapped windows, and pop-up windows. The message is
not posted to child windows.

The function behaves like a call to PostThreadMessage with


NULL the dwThreadId parameter set to the identifier of the current
thread.

Starting with Windows Vista, message posting is subject to UIPI. The thread of a process can post messages only
to message queues of threads in processes of lesser or equal integrity level.
Msg

Type: UINT
The message to be posted.
For lists of the system-provided messages, see System-Defined Messages.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError. GetLastError
returns ERROR_NOT_ENOUGH_QUOTA when the limit is hit.

Remarks
When a message is blocked by UIPI the last error, retrieved with GetLastError, is set to 5 (access denied).
Messages in a message queue are retrieved by calls to the GetMessage or PeekMessage function.
Applications that need to communicate using HWND_BROADCAST should use the RegisterWindowMessage
function to obtain a unique message for inter-application communication.
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other
messages (those >= WM_USER ) to another process, you must do custom marshalling.
If you send a message in the range below WM_USER to the asynchronous message functions (PostMessage ,
SendNotifyMessage, and SendMessageCallback), its message parameters cannot include pointers. Otherwise,
the operation will fail. The functions will return before the receiving thread has had a chance to process the
message and the sender will free the memory before it is used.
Do not post the WM_QUIT message using PostMessage ; use the PostQuitMessage function.
An accessibility application can use PostMessage to post WM_APPCOMMAND messages to the shell to launch
applications. This functionality is not guaranteed to work for other types of applications.
A message queue can contain at most 10,000 messages. This limit should be sufficiently large. If your
application exceeds the limit, it should be redesigned to avoid consuming so many system resources. To adjust
this limit, modify the following registry key.

HKEY_LOCAL_MACHINE
SOFTWARE
Microsoft
Windows NT
CurrentVersion
Windows
USERPostMessageLimit

The minimum acceptable value is 4000.


Examples
The following example shows how to post a private window message using the PostMessage function. Assume
you defined a private window message called WM_COMPLETE :

#define WM_COMPLETE (WM_USER + 0)


You can post a message to the message queue associated with the thread that created the specified window as
shown below:

WaitForSingleObject (pparams->hEvent, INFINITE) ;


lTime = GetCurrentTime () ;
PostMessage (pparams->hwnd, WM_COMPLETE, 0, lTime);

For more examples, see Initiating a Data Link.

NOTE
The winuser.h header defines PostMessage as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetMessage
Messages and Message Queues
PeekMessage
PostQuitMessage
PostThreadMessage
Reference
RegisterWindowMessage
SendMessageCallback
SendNotifyMessage
PostMessageW function (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Places (posts) a message in the message queue associated with the thread that created the specified window
and returns without waiting for the thread to process the message.
To post a message in the message queue associated with a thread, use the PostThreadMessage function.

Syntax
BOOL PostMessageW(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);

Parameters
hWnd

Type: HWND
A handle to the window whose window procedure is to receive the message. The following values have special
meanings.

VA L UE M EA N IN G

The message is posted to all top-level windows in the


HWND_BROADCAST system, including disabled or invisible unowned windows,
((HWND)0xffff) overlapped windows, and pop-up windows. The message is
not posted to child windows.

The function behaves like a call to PostThreadMessage with


NULL the dwThreadId parameter set to the identifier of the current
thread.

Starting with Windows Vista, message posting is subject to UIPI. The thread of a process can post messages only
to message queues of threads in processes of lesser or equal integrity level.
Msg

Type: UINT
The message to be posted.
For lists of the system-provided messages, see System-Defined Messages.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError. GetLastError
returns ERROR_NOT_ENOUGH_QUOTA when the limit is hit.

Remarks
When a message is blocked by UIPI the last error, retrieved with GetLastError, is set to 5 (access denied).
Messages in a message queue are retrieved by calls to the GetMessage or PeekMessage function.
Applications that need to communicate using HWND_BROADCAST should use the RegisterWindowMessage
function to obtain a unique message for inter-application communication.
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other
messages (those >= WM_USER ) to another process, you must do custom marshalling.
If you send a message in the range below WM_USER to the asynchronous message functions (PostMessage ,
SendNotifyMessage, and SendMessageCallback), its message parameters cannot include pointers. Otherwise,
the operation will fail. The functions will return before the receiving thread has had a chance to process the
message and the sender will free the memory before it is used.
Do not post the WM_QUIT message using PostMessage ; use the PostQuitMessage function.
An accessibility application can use PostMessage to post WM_APPCOMMAND messages to the shell to launch
applications. This functionality is not guaranteed to work for other types of applications.
There is a limit of 10,000 posted messages per message queue. This limit should be sufficiently large. If your
application exceeds the limit, it should be redesigned to avoid consuming so many system resources. To adjust
this limit, modify the following registry key.

HKEY_LOCAL_MACHINE
SOFTWARE
Microsoft
Windows NT
CurrentVersion
Windows
USERPostMessageLimit

The minimum acceptable value is 4000.


Examples
The following example shows how to post a private window message using the PostMessage function. Assume
you defined a private window message called WM_COMPLETE :

#define WM_COMPLETE (WM_USER + 0)


You can post a message to the message queue associated with the thread that created the specified window as
shown below:

WaitForSingleObject (pparams->hEvent, INFINITE) ;


lTime = GetCurrentTime () ;
PostMessage (pparams->hwnd, WM_COMPLETE, 0, lTime);

For more examples, see Initiating a Data Link.

NOTE
The winuser.h header defines PostMessage as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetMessage
Messages and Message Queues
PeekMessage
PostQuitMessage
PostThreadMessage
Reference
RegisterWindowMessage
SendMessageCallback
SendNotifyMessage
PostQuitMessage function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Indicates to the system that a thread has made a request to terminate (quit). It is typically used in response to a
WM_DESTROY message.

Syntax
void PostQuitMessage(
int nExitCode
);

Parameters
nExitCode

Type: int
The application exit code. This value is used as the wParam parameter of the WM_QUIT message.

Return value
None

Remarks
The PostQuitMessage function posts a WM_QUIT message to the thread's message queue and returns
immediately; the function simply indicates to the system that the thread is requesting to quit at some time in the
future.
When the thread retrieves the WM_QUIT message from its message queue, it should exit its message loop and
return control to the system. The exit value returned to the system must be the wParam parameter of the
WM_QUIT message.
Examples
For an example, see Posting a Message.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib
DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetMessage
Messages and Message Queues
PeekMessage
PostMessage
Reference
WM_DESTROY
WM_QUIT
PostThreadMessageA function (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Posts a message to the message queue of the specified thread. It returns without waiting for the thread to
process the message.

Syntax
BOOL PostThreadMessageA(
DWORD idThread,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);

Parameters
idThread

Type: DWORD
The identifier of the thread to which the message is to be posted.
The function fails if the specified thread does not have a message queue. The system creates a thread's message
queue when the thread makes its first call to one of the User or GDI functions. For more information, see the
Remarks section.
Message posting is subject to UIPI. The thread of a process can post messages only to posted-message queues
of threads in processes of lesser or equal integrity level.
This thread must have the SE_TCB_NAME privilege to post a message to a thread that belongs to a process
with the same locally unique identifier (LUID) but is in a different desktop. Otherwise, the function fails and
returns ERROR_INVALID_THREAD_ID .
This thread must either belong to the same desktop as the calling thread or to a process with the same LUID.
Otherwise, the function fails and returns ERROR_INVALID_THREAD_ID .
Msg

Type: UINT
The type of message to be posted.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.
Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError. GetLastError
returns ERROR_INVALID_THREAD_ID if idThread is not a valid thread identifier, or if the thread specified by
idThread does not have a message queue. GetLastError returns ERROR_NOT_ENOUGH_QUOTA when the
message limit is hit.

Remarks
When a message is blocked by UIPI the last error, retrieved with GetLastError, is set to 5 (access denied).
The thread to which the message is posted must have created a message queue, or else the call to
PostThreadMessage fails. Use the following method to handle this situation.
Create an event object, then create the thread.
Use the WaitForSingleObject function to wait for the event to be set to the signaled state before calling
PostThreadMessage .
In the thread to which the message will be posted, call PeekMessage as shown here to force the system to
create the message queue.
PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE)

Set the event, to indicate that the thread is ready to receive posted messages.
The thread to which the message is posted retrieves the message by calling the GetMessage or PeekMessage
function. The hwnd member of the returned MSG structure is NULL .
Messages sent by PostThreadMessage are not associated with a window. As a general rule, messages that are
not associated with a window cannot be dispatched by the DispatchMessage function. Therefore, if the recipient
thread is in a modal loop (as used by MessageBox or DialogBox), the messages will be lost. To intercept thread
messages while in a modal loop, use a thread-specific hook.
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other
messages (those >= WM_USER ) to another process, you must do custom marshalling.
There is a limit of 10,000 posted messages per message queue. This limit should be sufficiently large. If your
application exceeds the limit, it should be redesigned to avoid consuming so many system resources. To adjust
this limit, modify the following registry key.

HKEY_LOCAL_MACHINE
SOFTWARE
Microsoft
Windows NT
CurrentVersion
Windows
USERPostMessageLimit

The minimum acceptable value is 4000.


NOTE
The winuser.h header defines PostThreadMessage as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetCurrentThreadId
GetMessage
GetWindowThreadProcessId
MSG
Messages and Message Queues
Other Resources
PeekMessage
PostMessage
Reference
Sleep
WaitForSingleObject
PostThreadMessageW function (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Posts a message to the message queue of the specified thread. It returns without waiting for the thread to
process the message.

Syntax
BOOL PostThreadMessageW(
DWORD idThread,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);

Parameters
idThread

Type: DWORD
The identifier of the thread to which the message is to be posted.
The function fails if the specified thread does not have a message queue. The system creates a thread's message
queue when the thread makes its first call to one of the User or GDI functions. For more information, see the
Remarks section.
Message posting is subject to UIPI. The thread of a process can post messages only to posted-message queues
of threads in processes of lesser or equal integrity level.
This thread must have the SE_TCB_NAME privilege to post a message to a thread that belongs to a process
with the same locally unique identifier (LUID) but is in a different desktop. Otherwise, the function fails and
returns ERROR_INVALID_THREAD_ID .
This thread must either belong to the same desktop as the calling thread or to a process with the same LUID.
Otherwise, the function fails and returns ERROR_INVALID_THREAD_ID .
Msg

Type: UINT
The type of message to be posted.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.
Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError. GetLastError
returns ERROR_INVALID_THREAD_ID if idThread is not a valid thread identifier, or if the thread specified by
idThread does not have a message queue. GetLastError returns ERROR_NOT_ENOUGH_QUOTA when the
message limit is hit.

Remarks
When a message is blocked by UIPI the last error, retrieved with GetLastError, is set to 5 (access denied).
The thread to which the message is posted must have created a message queue, or else the call to
PostThreadMessage fails. Use the following method to handle this situation.
Create an event object, then create the thread.
Use the WaitForSingleObject function to wait for the event to be set to the signaled state before calling
PostThreadMessage .
In the thread to which the message will be posted, call PeekMessage as shown here to force the system to
create the message queue.
PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE)

Set the event, to indicate that the thread is ready to receive posted messages.
The thread to which the message is posted retrieves the message by calling the GetMessage or PeekMessage
function. The hwnd member of the returned MSG structure is NULL .
Messages sent by PostThreadMessage are not associated with a window. As a general rule, messages that are
not associated with a window cannot be dispatched by the DispatchMessage function. Therefore, if the recipient
thread is in a modal loop (as used by MessageBox or DialogBox), the messages will be lost. To intercept thread
messages while in a modal loop, use a thread-specific hook.
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other
messages (those >= WM_USER ) to another process, you must do custom marshalling.
There is a limit of 10,000 posted messages per message queue. This limit should be sufficiently large. If your
application exceeds the limit, it should be redesigned to avoid consuming so many system resources. To adjust
this limit, modify the following registry key.

HKEY_LOCAL_MACHINE
SOFTWARE
Microsoft
Windows NT
CurrentVersion
Windows
USERPostMessageLimit

The minimum acceptable value is 4000.


NOTE
The winuser.h header defines PostThreadMessage as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetCurrentThreadId
GetMessage
GetWindowThreadProcessId
MSG
Messages and Message Queues
Other Resources
PeekMessage
PostMessage
Reference
Sleep
WaitForSingleObject
PROPENUMPROCA callback function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

An application-defined callback function used with the EnumProps function. The function receives property
entries from a window's property list. The PROPENUMPROC type defines a pointer to this callback function.
PropEnumProc is a placeholder for the application-defined function name.

Syntax
PROPENUMPROCA Propenumproca;

BOOL Propenumproca(
HWND Arg1,
LPCSTR Arg2,
HANDLE Arg3
)
{...}

Parameters
Arg1

Type: HWND
A handle to the window whose property list is being enumerated.
Arg2

Type: LPCTSTR
The string component of a property list entry. This is the string that was specified, along with a data handle,
when the property was added to the window's property list via a call to the SetProp function.
Arg3

Type: HANDLE
A handle to the data. This handle is the data component of a property list entry.

Return value
Type: BOOL
Return TRUE to continue the property list enumeration.
Return FALSE to stop the property list enumeration.

Remarks
The following restrictions apply to this callback function:
The callback function can call the RemoveProp function. However, RemoveProp can remove only the
property passed to the callback function through the callback function's parameters.
The callback function should not attempt to add properties.
NOTE
The winuser.h header defines PROPENUMPROC as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

See also
Conceptual
EnumProps
Reference
RemoveProp
SetProp
Window Properties
PROPENUMPROCEXA callback function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Application-defined callback function used with the EnumPropsEx function. The function receives property
entries from a window's property list. The PROPENUMPROCEX type defines a pointer to this callback function.
PropEnumProcEx is a placeholder for the application-defined function name.

Syntax
PROPENUMPROCEXA Propenumprocexa;

BOOL Propenumprocexa(
HWND Arg1,
LPSTR Arg2,
HANDLE Arg3,
ULONG_PTR Arg4
)
{...}

Parameters
Arg1

Type: HWND
A handle to the window whose property list is being enumerated.
Arg2

Type: LPTSTR
The string component of a property list entry. This is the string that was specified, along with a data handle,
when the property was added to the window's property list via a call to the SetProp function.
Arg3

Type: HANDLE
A handle to the data. This handle is the data component of a property list entry.
Arg4

Type: ULONG_PTR
Application-defined data. This is the value that was specified as the lParam parameter of the call to
EnumPropsEx that initiated the enumeration.

Return value
Type: BOOL
Return TRUE to continue the property list enumeration.
Return FALSE to stop the property list enumeration.
Remarks
The following restrictions apply to this callback function:
The callback function can call the RemoveProp function. However, RemoveProp can remove only the
property passed to the callback function through the callback function's parameters.
The callback function should not attempt to add properties.

NOTE
The winuser.h header defines PROPENUMPROCEX as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

See also
Conceptual
EnumPropsEx
Reference
RemoveProp
SetProp
Window Properties
PROPENUMPROCEXW callback function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Application-defined callback function used with the EnumPropsEx function. The function receives property
entries from a window's property list. The PROPENUMPROCEX type defines a pointer to this callback function.
PropEnumProcEx is a placeholder for the application-defined function name.

Syntax
PROPENUMPROCEXW Propenumprocexw;

BOOL Propenumprocexw(
HWND Arg1,
LPWSTR Arg2,
HANDLE Arg3,
ULONG_PTR Arg4
)
{...}

Parameters
Arg1

Type: HWND
A handle to the window whose property list is being enumerated.
Arg2

Type: LPTSTR
The string component of a property list entry. This is the string that was specified, along with a data handle,
when the property was added to the window's property list via a call to the SetProp function.
Arg3

Type: HANDLE
A handle to the data. This handle is the data component of a property list entry.
Arg4

Type: ULONG_PTR
Application-defined data. This is the value that was specified as the lParam parameter of the call to
EnumPropsEx that initiated the enumeration.

Return value
Type: BOOL
Return TRUE to continue the property list enumeration.
Return FALSE to stop the property list enumeration.
Remarks
The following restrictions apply to this callback function:
The callback function can call the RemoveProp function. However, RemoveProp can remove only the
property passed to the callback function through the callback function's parameters.
The callback function should not attempt to add properties.

NOTE
The winuser.h header defines PROPENUMPROCEX as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

See also
Conceptual
EnumPropsEx
Reference
RemoveProp
SetProp
Window Properties
PROPENUMPROCW callback function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

An application-defined callback function used with the EnumProps function. The function receives property
entries from a window's property list. The PROPENUMPROC type defines a pointer to this callback function.
PropEnumProc is a placeholder for the application-defined function name.

Syntax
PROPENUMPROCW Propenumprocw;

BOOL Propenumprocw(
HWND Arg1,
LPCWSTR Arg2,
HANDLE Arg3
)
{...}

Parameters
Arg1

Type: HWND
A handle to the window whose property list is being enumerated.
Arg2

Type: LPCTSTR
The string component of a property list entry. This is the string that was specified, along with a data handle,
when the property was added to the window's property list via a call to the SetProp function.
Arg3

Type: HANDLE
A handle to the data. This handle is the data component of a property list entry.

Return value
Type: BOOL
Return TRUE to continue the property list enumeration.
Return FALSE to stop the property list enumeration.

Remarks
The following restrictions apply to this callback function:
The callback function can call the RemoveProp function. However, RemoveProp can remove only the
property passed to the callback function through the callback function's parameters.
The callback function should not attempt to add properties.
NOTE
The winuser.h header defines PROPENUMPROC as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

See also
Conceptual
EnumProps
Reference
RemoveProp
SetProp
Window Properties
RealChildWindowFromPoint function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves a handle to the child window at the specified point. The search is restricted to immediate child
windows; grandchildren and deeper descendant windows are not searched.

Syntax
HWND RealChildWindowFromPoint(
HWND hwndParent,
POINT ptParentClientCoords
);

Parameters
hwndParent

Type: HWND
A handle to the window whose child is to be retrieved.
ptParentClientCoords

Type: POINT
A POINT structure that defines the client coordinates of the point to be checked.

Return value
Type: HWND
The return value is a handle to the child window that contains the specified point.

Remarks
RealChildWindowFromPoint treats HTTRANSPARENT areas of a standard control differently from other
areas of the control; it returns the child window behind a transparent part of a control. In contrast,
ChildWindowFromPoint treats HTTRANSPARENT areas of a control the same as other areas. For example, if the
point is in a transparent area of a groupbox, RealChildWindowFromPoint returns the child window behind a
groupbox, whereas ChildWindowFromPoint returns the groupbox. However, both APIs return a static field,
even though it, too, returns HTTRANSPARENT .

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows


Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows


10, version 10.0.14393)

See also
ChildWindowFromPoint
Conceptual
Other Resources
POINT
Reference
Windows
RealGetWindowClassW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves a string that specifies the window type.

Syntax
UINT RealGetWindowClassW(
HWND hwnd,
LPWSTR ptszClassName,
UINT cchClassNameMax
);

Parameters
hwnd

Type: HWND
A handle to the window whose type will be retrieved.
ptszClassName

Type: LPTSTR
A pointer to a string that receives the window type.
cchClassNameMax

Type: UINT
The length, in characters, of the buffer pointed to by the pszType parameter.

Return value
Type: UINT
If the function succeeds, the return value is the number of characters copied to the specified buffer.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)


Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-1 (introduced in


Windows 8.1)

See also
Windows Overview
RegisterClassA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Registers a window class for subsequent use in calls to the CreateWindow or CreateWindowEx function.

Note The RegisterClass function has been superseded by the RegisterClassEx function. You can still use RegisterClass ,
however, if you do not need to set the class small icon.

Syntax
ATOM RegisterClassA(
const WNDCLASSA *lpWndClass
);

Parameters
lpWndClass

Type: const WNDCL ASS*


A pointer to a WNDCLASS structure. You must fill the structure with the appropriate class attributes before
passing it to the function.

Return value
Type: ATOM
If the function succeeds, the return value is a class atom that uniquely identifies the class being registered. This
atom can only be used by the CreateWindow, CreateWindowEx, GetClassInfo, GetClassInfoEx, FindWindow,
FindWindowEx, and UnregisterClass functions and the IActiveIMMap::FilterClientWindows method.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
If you register the window class by using RegisterClassA , the application tells the system that the windows of
the created class expect messages with text or character parameters to use the ANSI character set; if you register
it by using RegisterClassW , the application requests that the system pass text parameters of messages as
Unicode. The IsWindowUnicode function enables applications to query the nature of each window. For more
information on ANSI and Unicode functions, see Conventions for Function Prototypes.
All window classes that an application registers are unregistered when it terminates.
No window classes registered by a DLL are unregistered when the DLL is unloaded. A DLL must explicitly
unregister its classes when it is unloaded.
Examples
For an example, see Associating a Window Procedure with a Window Class.
NOTE
The winuser.h header defines RegisterClass as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)

See also
Conceptual
CreateWindow
CreateWindowEx
FindWindow
FindWindowEx
GetClassInfo
GetClassInfoEx
GetClassName
Reference
RegisterClassEx
UnregisterClass
WNDCLASS
Window Classes
WindowProc
RegisterClassExA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Registers a window class for subsequent use in calls to the CreateWindow or CreateWindowEx function.

Syntax
ATOM RegisterClassExA(
const WNDCLASSEXA *Arg1
);

Parameters
Arg1

Type: const WNDCL ASSEX*


A pointer to a WNDCLASSEX structure. You must fill the structure with the appropriate class attributes before
passing it to the function.

Return value
Type: ATOM
If the function succeeds, the return value is a class atom that uniquely identifies the class being registered. This
atom can only be used by the CreateWindow, CreateWindowEx, GetClassInfo, GetClassInfoEx, FindWindow,
FindWindowEx, and UnregisterClass functions and the IActiveIMMap::FilterClientWindows method.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
If you register the window class by using RegisterClassExA , the application tells the system that the windows
of the created class expect messages with text or character parameters to use the ANSI character set; if you
register it by using RegisterClassExW , the application requests that the system pass text parameters of
messages as Unicode. The IsWindowUnicode function enables applications to query the nature of each window.
For more information on ANSI and Unicode functions, see Conventions for Function Prototypes.
All window classes that an application registers are unregistered when it terminates.
No window classes registered by a DLL are unregistered when the DLL is unloaded. A DLL must explicitly
unregister its classes when it is unloaded.
Examples
For an example, see Using Window Classes.
NOTE
The winuser.h header defines RegisterClassEx as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)

See also
Conceptual
CreateWindow
CreateWindowEx
FindWindow
FindWindowEx
GetClassInfo
GetClassInfoEx
GetClassName
Reference
RegisterClass
UnregisterClass
WNDCLASSEX
Window Classes
WindowProc
RegisterClassExW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Registers a window class for subsequent use in calls to the CreateWindow or CreateWindowEx function.

Syntax
ATOM RegisterClassExW(
const WNDCLASSEXW *Arg1
);

Parameters
Arg1

Type: const WNDCL ASSEX*


A pointer to a WNDCLASSEX structure. You must fill the structure with the appropriate class attributes before
passing it to the function.

Return value
Type: ATOM
If the function succeeds, the return value is a class atom that uniquely identifies the class being registered. This
atom can only be used by the CreateWindow, CreateWindowEx, GetClassInfo, GetClassInfoEx, FindWindow,
FindWindowEx, and UnregisterClass functions and the IActiveIMMap::FilterClientWindows method.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
If you register the window class by using RegisterClassExA , the application tells the system that the windows
of the created class expect messages with text or character parameters to use the ANSI character set; if you
register it by using RegisterClassExW , the application requests that the system pass text parameters of
messages as Unicode. The IsWindowUnicode function enables applications to query the nature of each window.
For more information on ANSI and Unicode functions, see Conventions for Function Prototypes.
All window classes that an application registers are unregistered when it terminates.
No window classes registered by a DLL are unregistered when the DLL is unloaded. A DLL must explicitly
unregister its classes when it is unloaded.
Examples
For an example, see Using Window Classes.
NOTE
The winuser.h header defines RegisterClassEx as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)

See also
Conceptual
CreateWindow
CreateWindowEx
FindWindow
FindWindowEx
GetClassInfo
GetClassInfoEx
GetClassName
Reference
RegisterClass
UnregisterClass
WNDCLASSEX
Window Classes
WindowProc
RegisterClassW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Registers a window class for subsequent use in calls to the CreateWindow or CreateWindowEx function.

Note The RegisterClass function has been superseded by the RegisterClassEx function. You can still use RegisterClass ,
however, if you do not need to set the class small icon.

Syntax
ATOM RegisterClassW(
const WNDCLASSW *lpWndClass
);

Parameters
lpWndClass

Type: const WNDCL ASS*


A pointer to a WNDCLASS structure. You must fill the structure with the appropriate class attributes before
passing it to the function.

Return value
Type: ATOM
If the function succeeds, the return value is a class atom that uniquely identifies the class being registered. This
atom can only be used by the CreateWindow, CreateWindowEx, GetClassInfo, GetClassInfoEx, FindWindow,
FindWindowEx, and UnregisterClass functions and the IActiveIMMap::FilterClientWindows method.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
If you register the window class by using RegisterClassA , the application tells the system that the windows of
the created class expect messages with text or character parameters to use the ANSI character set; if you register
it by using RegisterClassW , the application requests that the system pass text parameters of messages as
Unicode. The IsWindowUnicode function enables applications to query the nature of each window. For more
information on ANSI and Unicode functions, see Conventions for Function Prototypes.
All window classes that an application registers are unregistered when it terminates.
No window classes registered by a DLL are unregistered when the DLL is unloaded. A DLL must explicitly
unregister its classes when it is unloaded.
Examples
For an example, see Associating a Window Procedure with a Window Class.
NOTE
The winuser.h header defines RegisterClass as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)

See also
Conceptual
CreateWindow
CreateWindowEx
FindWindow
FindWindowEx
GetClassInfo
GetClassInfoEx
GetClassName
Reference
RegisterClassEx
UnregisterClass
WNDCLASS
Window Classes
WindowProc
RegisterShellHookWindow function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

[This function is not intended for general use. It may be altered or unavailable in subsequent versions of
Windows.]
Registers a specified Shell window to receive certain messages for events or notifications that are useful to Shell
applications.
The event messages received are only those sent to the Shell window associated with the specified window's
desktop. Many of the messages are the same as those that can be received after calling the SetWindowsHookEx
function and specifying WH_SHELL for the hook type. The difference with RegisterShellHookWindow is that
the messages are received through the specified window's WindowProc and not through a call back procedure.

Syntax
BOOL RegisterShellHookWindow(
HWND hwnd
);

Parameters
hwnd

Type: HWND
A handle to the window to register for Shell hook messages.

Return value
Type: BOOL
TRUE if the function succeeds; otherwise, FALSE .

Remarks
As with normal window messages, the second parameter of the window procedure identifies the message as a
WM_SHELLHOOKMESSAGE . However, for these Shell hook messages, the message value is not a pre-defined
constant like other message IDs such as WM_COMMAND. The value must be obtained dynamically using a call
to RegisterWindowMessage as shown here:
RegisterWindowMessage(TEXT("SHELLHOOK"));

This precludes handling these messages using a traditional switch statement which requires ID values that are
known at compile time. For handling Shell hook messages, the normal practice is to code an If statement in the
default section of your switch statement and then handle the message if the value of the message ID is the same
as the value obtained from the RegisterWindowMessage call.
The following table describes the wParam and lParam parameter values passed to the window procedure for the
Shell hook messages.

W PA RA M L PA RA M
HSHELL_GETMINRECT A pointer to a SHELLHOOKINFO structure.

HSHELL_WINDOWACTIVATED A handle to the activated window.

HSHELL_RUDEAPPACTIVATED A handle to the activated window.

HSHELL_WINDOWREPL ACING A handle to the window replacing the top-level window.

HSHELL_WINDOWREPL ACED A handle to the window being replaced.

HSHELL_WINDOWCREATED A handle to the window being created.

HSHELL_WINDOWDESTROYED A handle to the top-level window being destroyed.

HSHELL_ACTIVATESHELLWINDOW Not used.

HSHELL_TASKMAN Can be ignored.

HSHELL_REDRAW A handle to the window that needs to be redrawn.

HSHELL_FL ASH A handle to the window that needs to be flashed.

HSHELL_ENDTASK A handle to the window that should be forced to exit.

HSHELL_APPCOMMAND The APPCOMMAND which has been unhandled by the


application or other hooks. See WM_APPCOMMAND and
use the GET_APPCOMMAND_LPARAM macro to retrieve
this parameter.

HSHELL_MONITORCHANGED A handle to the window that moved to a different monitor.

This function was not included in the SDK headers and libraries until Windows XP with Service Pack 1 (SP1) and
Windows Server 2003. If you do not have a header file and import library for this function, you can call the
function using LoadLibrary and GetProcAddress.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll
See also
Conceptual
DeregisterShellHookWindow
Other Resources
Reference
SetWindowsHookEx
ShellProc
Using Messages and Message Queues
WinEvents
WindowProc
Windows
RegisterWindowMessageA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Defines a new window message that is guaranteed to be unique throughout the system. The message value can
be used when sending or posting messages.

Syntax
UINT RegisterWindowMessageA(
LPCSTR lpString
);

Parameters
lpString

Type: LPCTSTR
The message to be registered.

Return value
Type: UINT
If the message is successfully registered, the return value is a message identifier in the range 0xC000 through
0xFFFF.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
The RegisterWindowMessage function is typically used to register messages for communicating between two
cooperating applications.
If two different applications register the same message string, the applications return the same message value.
The message remains registered until the session ends.
Only use RegisterWindowMessage when more than one application must process the same message. For
sending private messages within a window class, an application can use any integer in the range WM_USER
through 0x7FFF. (Messages in this range are private to a window class, not to an application. For example,
predefined control classes such as BUTTON , EDIT , LISTBOX , and COMBOBOX may use values in this range.)
Examples
For an example, see Finding Text.

NOTE
The winuser.h header defines RegisterWindowMessage as an alias which automatically selects the ANSI or Unicode version
of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral
alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.
Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
Messages and Message Queues
PostMessage
Reference
SendMessage
RegisterWindowMessageW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Defines a new window message that is guaranteed to be unique throughout the system. The message value can
be used when sending or posting messages.

Syntax
UINT RegisterWindowMessageW(
LPCWSTR lpString
);

Parameters
lpString

Type: LPCTSTR
The message to be registered.

Return value
Type: UINT
If the message is successfully registered, the return value is a message identifier in the range 0xC000 through
0xFFFF.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
The RegisterWindowMessage function is typically used to register messages for communicating between two
cooperating applications.
If two different applications register the same message string, the applications return the same message value.
The message remains registered until the session ends.
Only use RegisterWindowMessage when more than one application must process the same message. For
sending private messages within a window class, an application can use any integer in the range WM_USER
through 0x7FFF. (Messages in this range are private to a window class, not to an application. For example,
predefined control classes such as BUTTON , EDIT , LISTBOX , and COMBOBOX may use values in this range.)
Examples
For an example, see Finding Text.

NOTE
The winuser.h header defines RegisterWindowMessage as an alias which automatically selects the ANSI or Unicode version
of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral
alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.
Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
Messages and Message Queues
PostMessage
Reference
SendMessage
RemovePropA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Removes an entry from the property list of the specified window. The specified character string identifies the
entry to be removed.

Syntax
HANDLE RemovePropA(
HWND hWnd,
LPCSTR lpString
);

Parameters
hWnd

Type: HWND
A handle to the window whose property list is to be changed.
lpString

Type: LPCTSTR
A null-terminated character string or an atom that identifies a string. If this parameter is an atom, it must have
been created using the GlobalAddAtom function. The atom, a 16-bit value, must be placed in the low-order word
of lpString; the high-order word must be zero.

Return value
Type: HANDLE
The return value identifies the specified data. If the data cannot be found in the specified property list, the return
value is NULL .

Remarks
The return value is the hData value that was passed to SetProp; it is an application-defined value. Note, this
function only destroys the association between the data and the window. If appropriate, the application must
free the data handles associated with entries removed from a property list. The application can remove only
those properties it has added. It must not remove properties added by other applications or by the system itself.
The RemoveProp function returns the data handle associated with the string so that the application can free
the data associated with the handle.
Starting with Windows Vista, RemoveProp is subject to the restrictions of User Interface Privilege Isolation
(UIPI). A process can only call this function on a window belonging to a process of lesser or equal integrity level.
When UIPI blocks property changes, GetLastError will return 5 .
Examples
For an example, see Deleting a Window Property.
NOTE
The winuser.h header defines RemoveProp as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
AddAtom
Conceptual
GetProp
Reference
SetProp
Window Properties
RemovePropW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Removes an entry from the property list of the specified window. The specified character string identifies the
entry to be removed.

Syntax
HANDLE RemovePropW(
HWND hWnd,
LPCWSTR lpString
);

Parameters
hWnd

Type: HWND
A handle to the window whose property list is to be changed.
lpString

Type: LPCTSTR
A null-terminated character string or an atom that identifies a string. If this parameter is an atom, it must have
been created using the GlobalAddAtom function. The atom, a 16-bit value, must be placed in the low-order word
of lpString; the high-order word must be zero.

Return value
Type: HANDLE
The return value identifies the specified data. If the data cannot be found in the specified property list, the return
value is NULL .

Remarks
The return value is the hData value that was passed to SetProp; it is an application-defined value. Note, this
function only destroys the association between the data and the window. If appropriate, the application must
free the data handles associated with entries removed from a property list. The application can remove only
those properties it has added. It must not remove properties added by other applications or by the system itself.
The RemoveProp function returns the data handle associated with the string so that the application can free
the data associated with the handle.
Starting with Windows Vista, RemoveProp is subject to the restrictions of User Interface Privilege Isolation
(UIPI). A process can only call this function on a window belonging to a process of lesser or equal integrity level.
When UIPI blocks property changes, GetLastError will return 5 .
Examples
For an example, see Deleting a Window Property.
NOTE
The winuser.h header defines RemoveProp as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
AddAtom
Conceptual
GetProp
Reference
SetProp
Window Properties
ReplyMessage function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Replies to a message sent from another thread by the SendMessage function.

Syntax
BOOL ReplyMessage(
LRESULT lResult
);

Parameters
lResult

Type: LRESULT
The result of the message processing. The possible values are based on the message sent.

Return value
Type: BOOL
If the calling thread was processing a message sent from another thread or process, the return value is nonzero.
If the calling thread was not processing a message sent from another thread or process, the return value is zero.

Remarks
By calling this function, the window procedure that receives the message allows the thread that called
SendMessage to continue to run as though the thread receiving the message had returned control. The thread
that calls the ReplyMessage function also continues to run.
If the message was not sent through SendMessage or if the message was sent by the same thread,
ReplyMessage has no effect.
Examples
For an example, see Sending a Message.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)


Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-2 (introduced in Windows


10, version 10.0.10240)

See also
Conceptual
InSendMessage
Messages and Message Queues
Reference
SendMessage
SENDASYNCPROC callback function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

An application-defined callback function used with the SendMessageCallback function. The system passes the
message to the callback function after passing the message to the destination window procedure. The
SENDASYNCPROC type defines a pointer to this callback function. SendAsyncProc is a placeholder for the
application-defined function name.

Syntax
SENDASYNCPROC Sendasyncproc;

void Sendasyncproc(
HWND Arg1,
UINT Arg2,
ULONG_PTR Arg3,
LRESULT Arg4
)
{...}

Parameters
Arg1

Type: HWND
A handle to the window whose window procedure received the message.
If the SendMessageCallback function was called with its hwnd parameter set to HWND_BROADCAST , the
system calls the SendAsyncProc function once for each top-level window.
Arg2

Type: UINT
The message.
Arg3

Type: ULONG_PTR
An application-defined value sent from the SendMessageCallback function.
Arg4

Type: LRESULT
The result of the message processing. This value depends on the message.

Return value
None

Remarks
You install a SendAsyncProc application-defined callback function by passing a SENDASYNCPROC pointer to
the SendMessageCallback function.
The callback function is only called when the thread that called SendMessageCallback calls GetMessage,
PeekMessage, or WaitMessage.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

See also
Conceptual
GetMessage
Messages and Message Queues
PeekMessage
Reference
SendMessageCallback
WaitMessage
SendMessage function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Sends the specified message to a window or windows. The SendMessage function calls the window procedure
for the specified window and does not return until the window procedure has processed the message.
To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage function. To
post a message to a thread's message queue and return immediately, use the PostMessage or
PostThreadMessage function.

Syntax
LRESULT SendMessage(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);

Parameters
hWnd

Type: HWND
A handle to the window whose window procedure will receive the message. If this parameter is
HWND_BROADCAST ((HWND)0xffff), the message is sent to all top-level windows in the system, including
disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent
to child windows.
Message sending is subject to UIPI. The thread of a process can send messages only to message queues of
threads in processes of lesser or equal integrity level.
Msg

Type: UINT
The message to be sent.
For lists of the system-provided messages, see System-Defined Messages.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.

Return value
Type: LRESULT
The return value specifies the result of the message processing; it depends on the message sent.

Remarks
When a message is blocked by UIPI the last error, retrieved with GetLastError, is set to 5 (access denied).
Applications that need to communicate using HWND_BROADCAST should use the RegisterWindowMessage
function to obtain a unique message for inter-application communication.
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other
messages (those >= WM_USER ) to another process, you must do custom marshalling.
If the specified window was created by the calling thread, the window procedure is called immediately as a
subroutine. If the specified window was created by a different thread, the system switches to that thread and
calls the appropriate window procedure. Messages sent between threads are processed only when the receiving
thread executes message retrieval code. The sending thread is blocked until the receiving thread processes the
message. However, the sending thread will process incoming nonqueued messages while waiting for its
message to be processed. To prevent this, use SendMessageTimeout with SMTO_BLOCK set. For more
information on nonqueued messages, see Nonqueued Messages.
An accessibility application can use SendMessage to send WM_APPCOMMAND messages to the shell to
launch applications. This functionality is not guaranteed to work for other types of applications.
Examples
For an example, see Displaying Keyboard Input.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
InSendMessage
Messages and Message Queues
PostMessage
PostThreadMessage
Reference
RegisterWindowMessage
SendDlgItemMessage
SendMessageCallback
SendMessageTimeout
SendNotifyMessage
SendMessageA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Sends the specified message to a window or windows. The SendMessage function calls the window procedure
for the specified window and does not return until the window procedure has processed the message.
To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage function. To
post a message to a thread's message queue and return immediately, use the PostMessage or
PostThreadMessage function.

Syntax
LRESULT SendMessageA(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);

Parameters
hWnd

Type: HWND
A handle to the window whose window procedure will receive the message. If this parameter is
HWND_BROADCAST ((HWND)0xffff), the message is sent to all top-level windows in the system, including
disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent
to child windows.
Message sending is subject to UIPI. The thread of a process can send messages only to message queues of
threads in processes of lesser or equal integrity level.
Msg

Type: UINT
The message to be sent.
For lists of the system-provided messages, see System-Defined Messages.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.

Return value
Type: LRESULT
The return value specifies the result of the message processing; it depends on the message sent.

Remarks
When a message is blocked by UIPI the last error, retrieved with GetLastError, is set to 5 (access denied).
Applications that need to communicate using HWND_BROADCAST should use the RegisterWindowMessage
function to obtain a unique message for inter-application communication.
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other
messages (those >= WM_USER ) to another process, you must do custom marshalling.
If the specified window was created by the calling thread, the window procedure is called immediately as a
subroutine. If the specified window was created by a different thread, the system switches to that thread and
calls the appropriate window procedure. Messages sent between threads are processed only when the receiving
thread executes message retrieval code. The sending thread is blocked until the receiving thread processes the
message. However, the sending thread will process incoming nonqueued messages while waiting for its
message to be processed. To prevent this, use SendMessageTimeout with SMTO_BLOCK set. For more
information on nonqueued messages, see Nonqueued Messages.
An accessibility application can use SendMessage to send WM_APPCOMMAND messages to the shell to
launch applications. This functionality is not guaranteed to work for other types of applications.
Examples
For an example, see Displaying Keyboard Input.

NOTE
The winuser.h header defines SendMessage as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)
See also
Conceptual
InSendMessage
Messages and Message Queues
PostMessage
PostThreadMessage
Reference
RegisterWindowMessage
SendDlgItemMessage
SendMessageCallback
SendMessageTimeout
SendNotifyMessage
SendMessageCallbackA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Sends the specified message to a window or windows. It calls the window procedure for the specified window
and returns immediately if the window belongs to another thread. After the window procedure processes the
message, the system calls the specified callback function, passing the result of the message processing and an
application-defined value to the callback function.

Syntax
BOOL SendMessageCallbackA(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam,
SENDASYNCPROC lpResultCallBack,
ULONG_PTR dwData
);

Parameters
hWnd

Type: HWND
A handle to the window whose window procedure will receive the message. If this parameter is
HWND_BROADCAST ((HWND)0xffff), the message is sent to all top-level windows in the system, including
disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent
to child windows.
Msg

Type: UINT
The message to be sent.
For lists of the system-provided messages, see System-Defined Messages.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.
lpResultCallBack

Type: SENDASYNCPROC
A pointer to a callback function that the system calls after the window procedure processes the message. For
more information, see SendAsyncProc.
If hWnd is HWND_BROADCAST ((HWND)0xffff), the system calls the SendAsyncProc callback function once
for each top-level window.
dwData

Type: ULONG_PTR
An application-defined value to be sent to the callback function pointed to by the lpCallBack parameter.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
If the target window belongs to the same thread as the caller, then the window procedure is called
synchronously, and the callback function is called immediately after the window procedure returns. If the target
window belongs to a different thread from the caller, then the callback function is called only when the thread
that called SendMessageCallback also calls GetMessage, PeekMessage, or WaitMessage.
If you send a message in the range below WM_USER to the asynchronous message functions (PostMessage,
SendNotifyMessage, and SendMessageCallback ), its message parameters cannot include pointers. Otherwise,
the operation will fail. The functions will return before the receiving thread has had a chance to process the
message and the sender will free the memory before it is used.
Applications that need to communicate using HWND_BROADCAST should use the RegisterWindowMessage
function to obtain a unique message for inter-application communication.
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other
messages (those >= WM_USER ) to another process, you must do custom marshalling.

NOTE
The winuser.h header defines SendMessageCallback as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)


Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
Messages and Message Queues
PostMessage
Reference
RegisterWindowMessage
SendAsyncProc
SendMessageCallback
SendNotifyMessage
SendMessageCallbackW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Sends the specified message to a window or windows. It calls the window procedure for the specified window
and returns immediately if the window belongs to another thread. After the window procedure processes the
message, the system calls the specified callback function, passing the result of the message processing and an
application-defined value to the callback function.

Syntax
BOOL SendMessageCallbackW(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam,
SENDASYNCPROC lpResultCallBack,
ULONG_PTR dwData
);

Parameters
hWnd

Type: HWND
A handle to the window whose window procedure will receive the message. If this parameter is
HWND_BROADCAST ((HWND)0xffff), the message is sent to all top-level windows in the system, including
disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent
to child windows.
Msg

Type: UINT
The message to be sent.
For lists of the system-provided messages, see System-Defined Messages.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.
lpResultCallBack

Type: SENDASYNCPROC
A pointer to a callback function that the system calls after the window procedure processes the message. For
more information, see SendAsyncProc.
If hWnd is HWND_BROADCAST ((HWND)0xffff), the system calls the SendAsyncProc callback function once
for each top-level window.
dwData

Type: ULONG_PTR
An application-defined value to be sent to the callback function pointed to by the lpCallBack parameter.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
If the target window belongs to the same thread as the caller, then the window procedure is called
synchronously, and the callback function is called immediately after the window procedure returns. If the target
window belongs to a different thread from the caller, then the callback function is called only when the thread
that called SendMessageCallback also calls GetMessage, PeekMessage, or WaitMessage.
If you send a message in the range below WM_USER to the asynchronous message functions (PostMessage,
SendNotifyMessage, and SendMessageCallback ), its message parameters cannot include pointers. Otherwise,
the operation will fail. The functions will return before the receiving thread has had a chance to process the
message and the sender will free the memory before it is used.
Applications that need to communicate using HWND_BROADCAST should use the RegisterWindowMessage
function to obtain a unique message for inter-application communication.
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other
messages (those >= WM_USER ) to another process, you must do custom marshalling.

NOTE
The winuser.h header defines SendMessageCallback as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)


Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
Messages and Message Queues
PostMessage
Reference
RegisterWindowMessage
SendAsyncProc
SendMessageCallback
SendNotifyMessage
SendMessageTimeoutA function (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Sends the specified message to one or more windows.

Syntax
LRESULT SendMessageTimeoutA(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam,
UINT fuFlags,
UINT uTimeout,
PDWORD_PTR lpdwResult
);

Parameters
hWnd

Type: HWND
A handle to the window whose window procedure will receive the message.
If this parameter is HWND_BROADCAST ((HWND)0xffff), the message is sent to all top-level windows in the
system, including disabled or invisible unowned windows. The function does not return until each window has
timed out. Therefore, the total wait time can be up to the value of uTimeout multiplied by the number of top-
level windows.
Msg

Type: UINT
The message to be sent.
For lists of the system-provided messages, see System-Defined Messages.
wParam

Type: WPARAM
Any additional message-specific information.
lParam

Type: LPARAM
Any additional message-specific information.
fuFlags

Type: UINT
The behavior of this function. This parameter can be one or more of the following values.
VA L UE M EA N IN G

The function returns without waiting for the time-out period


SMTO_ABORTIFHUNG to elapse if the receiving thread appears to not respond or
0x0002 "hangs."

Prevents the calling thread from processing any other


SMTO_BLOCK requests until the function returns.
0x0001

The calling thread is not prevented from processing other


SMTO_NORMAL requests while waiting for the function to return.
0x0000

The function does not enforce the time-out period as long


SMTO_NOTIMEOUTIFNOTHUNG as the receiving thread is processing messages.
0x0008

The function should return 0 if the receiving window is


SMTO_ERRORONEXIT destroyed or its owning thread dies while the message is
0x0020 being processed.

uTimeout

Type: UINT
The duration of the time-out period, in milliseconds. If the message is a broadcast message, each window can
use the full time-out period. For example, if you specify a five second time-out period and there are three top-
level windows that fail to process the message, you could have up to a 15 second delay.
lpdwResult

Type: PDWORD_PTR
The result of the message processing. The value of this parameter depends on the message that is specified.

Return value
Type: LRESULT
If the function succeeds, the return value is nonzero. SendMessageTimeout does not provide information
about individual windows timing out if HWND_BROADCAST is used.
If the function fails or times out, the return value is 0. To get extended error information, call GetLastError. If
GetLastError returns ERROR_TIMEOUT , then the function timed out.
Windows 2000: If GetLastError returns 0, then the function timed out.

Remarks
The function calls the window procedure for the specified window and, if the specified window belongs to a
different thread, does not return until the window procedure has processed the message or the specified time-
out period has elapsed. If the window receiving the message belongs to the same queue as the current thread,
the window procedure is called directly—the time-out value is ignored.
This function considers that a thread is not responding if it has not called GetMessage or a similar function
within five seconds.
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other
messages (those >= WM_USER ) to another process, you must do custom marshalling.

NOTE
The winuser.h header defines SendMessageTimeout as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetMessage
InSendMessage
Messages and Message Queues
PostMessage
Reference
SendDlgItemMessage
SendMessage
SendMessageCallback
SendNotifyMessage
SendMessageTimeoutW function (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Sends the specified message to one or more windows.

Syntax
LRESULT SendMessageTimeoutW(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam,
UINT fuFlags,
UINT uTimeout,
PDWORD_PTR lpdwResult
);

Parameters
hWnd

Type: HWND
A handle to the window whose window procedure will receive the message.
If this parameter is HWND_BROADCAST ((HWND)0xffff), the message is sent to all top-level windows in the
system, including disabled or invisible unowned windows. The function does not return until each window has
timed out. Therefore, the total wait time can be up to the value of uTimeout multiplied by the number of top-
level windows.
Msg

Type: UINT
The message to be sent.
For lists of the system-provided messages, see System-Defined Messages.
wParam

Type: WPARAM
Any additional message-specific information.
lParam

Type: LPARAM
Any additional message-specific information.
fuFlags

Type: UINT
The behavior of this function. This parameter can be one or more of the following values.
VA L UE M EA N IN G

The function returns without waiting for the time-out period


SMTO_ABORTIFHUNG to elapse if the receiving thread appears to not respond or
0x0002 "hangs."

Prevents the calling thread from processing any other


SMTO_BLOCK requests until the function returns.
0x0001

The calling thread is not prevented from processing other


SMTO_NORMAL requests while waiting for the function to return.
0x0000

The function does not enforce the time-out period as long


SMTO_NOTIMEOUTIFNOTHUNG as the receiving thread is processing messages.
0x0008

The function should return 0 if the receiving window is


SMTO_ERRORONEXIT destroyed or its owning thread dies while the message is
0x0020 being processed.

uTimeout

Type: UINT
The duration of the time-out period, in milliseconds. If the message is a broadcast message, each window can
use the full time-out period. For example, if you specify a five second time-out period and there are three top-
level windows that fail to process the message, you could have up to a 15 second delay.
lpdwResult

Type: PDWORD_PTR
The result of the message processing. The value of this parameter depends on the message that is specified.

Return value
Type: LRESULT
If the function succeeds, the return value is nonzero. SendMessageTimeout does not provide information
about individual windows timing out if HWND_BROADCAST is used.
If the function fails or times out, the return value is 0. To get extended error information, call GetLastError. If
GetLastError returns ERROR_TIMEOUT , then the function timed out.
Windows 2000: If GetLastError returns 0, then the function timed out.

Remarks
The function calls the window procedure for the specified window and, if the specified window belongs to a
different thread, does not return until the window procedure has processed the message or the specified time-
out period has elapsed. If the window receiving the message belongs to the same queue as the current thread,
the window procedure is called directly—the time-out value is ignored.
This function considers that a thread is not responding if it has not called GetMessage or a similar function
within five seconds.
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other
messages (those >= WM_USER ) to another process, you must do custom marshalling.

NOTE
The winuser.h header defines SendMessageTimeout as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetMessage
InSendMessage
Messages and Message Queues
PostMessage
Reference
SendDlgItemMessage
SendMessage
SendMessageCallback
SendNotifyMessage
SendMessageW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Sends the specified message to a window or windows. The SendMessage function calls the window procedure
for the specified window and does not return until the window procedure has processed the message.
To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage function. To
post a message to a thread's message queue and return immediately, use the PostMessage or
PostThreadMessage function.

Syntax
LRESULT SendMessageW(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);

Parameters
hWnd

Type: HWND
A handle to the window whose window procedure will receive the message. If this parameter is
HWND_BROADCAST ((HWND)0xffff), the message is sent to all top-level windows in the system, including
disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent
to child windows.
Message sending is subject to UIPI. The thread of a process can send messages only to message queues of
threads in processes of lesser or equal integrity level.
Msg

Type: UINT
The message to be sent.
For lists of the system-provided messages, see System-Defined Messages.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.

Return value
Type: LRESULT
The return value specifies the result of the message processing; it depends on the message sent.

Remarks
When a message is blocked by UIPI the last error, retrieved with GetLastError, is set to 5 (access denied).
Applications that need to communicate using HWND_BROADCAST should use the RegisterWindowMessage
function to obtain a unique message for inter-application communication.
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other
messages (those >= WM_USER ) to another process, you must do custom marshalling.
If the specified window was created by the calling thread, the window procedure is called immediately as a
subroutine. If the specified window was created by a different thread, the system switches to that thread and
calls the appropriate window procedure. Messages sent between threads are processed only when the receiving
thread executes message retrieval code. The sending thread is blocked until the receiving thread processes the
message. However, the sending thread will process incoming nonqueued messages while waiting for its
message to be processed. To prevent this, use SendMessageTimeout with SMTO_BLOCK set. For more
information on nonqueued messages, see Nonqueued Messages.
An accessibility application can use SendMessage to send WM_APPCOMMAND messages to the shell to
launch applications. This functionality is not guaranteed to work for other types of applications.
Examples
For an example, see Displaying Keyboard Input.

NOTE
The winuser.h header defines SendMessage as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)
See also
Conceptual
InSendMessage
Messages and Message Queues
PostMessage
PostThreadMessage
Reference
RegisterWindowMessage
SendDlgItemMessage
SendMessageCallback
SendMessageTimeout
SendNotifyMessage
SendNotifyMessageA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Sends the specified message to a window or windows. If the window was created by the calling thread,
SendNotifyMessage calls the window procedure for the window and does not return until the window
procedure has processed the message. If the window was created by a different thread, SendNotifyMessage
passes the message to the window procedure and returns immediately; it does not wait for the window
procedure to finish processing the message.

Syntax
BOOL SendNotifyMessageA(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);

Parameters
hWnd

Type: HWND
A handle to the window whose window procedure will receive the message. If this parameter is
HWND_BROADCAST ((HWND)0xffff), the message is sent to all top-level windows in the system, including
disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent
to child windows.
Msg

Type: UINT
The message to be sent.
For lists of the system-provided messages, see System-Defined Messages.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
If you send a message in the range below WM_USER to the asynchronous message functions (PostMessage,
SendNotifyMessage , and SendMessageCallback), its message parameters cannot include pointers. Otherwise,
the operation will fail. The functions will return before the receiving thread has had a chance to process the
message and the sender will free the memory before it is used.
Applications that need to communicate using HWND_BROADCAST should use the RegisterWindowMessage
function to obtain a unique message for inter-application communication.
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other
messages (those >= WM_USER ) to another process, you must do custom marshalling.

NOTE
The winuser.h header defines SendNotifyMessage as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-3 (introduced in Windows


10, version 10.0.14393)

See also
Conceptual
Messages and Message Queues
PostMessage
PostThreadMessage
Reference
RegisterWindowMessage
SendMessage
SendMessageCallback
SendNotifyMessage
SendNotifyMessageW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Sends the specified message to a window or windows. If the window was created by the calling thread,
SendNotifyMessage calls the window procedure for the window and does not return until the window
procedure has processed the message. If the window was created by a different thread, SendNotifyMessage
passes the message to the window procedure and returns immediately; it does not wait for the window
procedure to finish processing the message.

Syntax
BOOL SendNotifyMessageW(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);

Parameters
hWnd

Type: HWND
A handle to the window whose window procedure will receive the message. If this parameter is
HWND_BROADCAST ((HWND)0xffff), the message is sent to all top-level windows in the system, including
disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent
to child windows.
Msg

Type: UINT
The message to be sent.
For lists of the system-provided messages, see System-Defined Messages.
wParam

Type: WPARAM
Additional message-specific information.
lParam

Type: LPARAM
Additional message-specific information.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
If you send a message in the range below WM_USER to the asynchronous message functions (PostMessage,
SendNotifyMessage , and SendMessageCallback), its message parameters cannot include pointers. Otherwise,
the operation will fail. The functions will return before the receiving thread has had a chance to process the
message and the sender will free the memory before it is used.
Applications that need to communicate using HWND_BROADCAST should use the RegisterWindowMessage
function to obtain a unique message for inter-application communication.
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other
messages (those >= WM_USER ) to another process, you must do custom marshalling.

NOTE
The winuser.h header defines SendNotifyMessage as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-3 (introduced in Windows


10, version 10.0.14393)

See also
Conceptual
Messages and Message Queues
PostMessage
PostThreadMessage
Reference
RegisterWindowMessage
SendMessage
SendMessageCallback
SendNotifyMessage
SetClassLongA function (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Replaces the specified 32-bit (long ) value at the specified offset into the extra class memory or the
WNDCLASSEX structure for the class to which the specified window belongs.

Note This function has been superseded by the SetClassLongPtr function. To write code that is compatible with both 32-bit
and 64-bit versions of Windows, use SetClassLongPtr .

Syntax
DWORD SetClassLongA(
HWND hWnd,
int nIndex,
LONG dwNewLong
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
nIndex

Type: int
The value to be replaced. To set a 32-bit value in the extra class memory, specify the positive, zero-based byte
offset of the value to be set. Valid values are in the range zero through the number of bytes of extra class
memory, minus four; for example, if you specified 12 or more bytes of extra class memory, a value of 8 would
be an index to the third 32-bit integer. To set any other value from the WNDCLASSEX structure, specify one of
the following values.

VA L UE M EA N IN G

Sets the size, in bytes, of the extra memory associated with


GCL_CBCLSEXTRA the class. Setting this value does not change the number of
-20 extra bytes already allocated.

Sets the size, in bytes, of the extra window memory


GCL_CBWNDEXTRA associated with each window in the class. Setting this value
-18 does not change the number of extra bytes already
allocated. For information on how to access this memory,
see SetWindowLong.
Replaces a handle to the background brush associated with
GCL_HBRBACKGROUND the class.
-10

Replaces a handle to the cursor associated with the class.


GCL_HCURSOR
-12

Replaces a handle to the icon associated with the class.


GCL_HICON
-14

Replace a handle to the small icon associated with the class.


GCL_HICONSM
-34

Replaces a handle to the module that registered the class.


GCL_HMODULE
-16

Replaces the address of the menu name string. The string


GCL_MENUNAME identifies the menu resource associated with the class.
-8

Replaces the window-class style bits.


GCL_STYLE
-26

Replaces the address of the window procedure associated


GCL_WNDPROC with the class.
-24

dwNewLong

Type: LONG
The replacement value.

Return value
Type: DWORD
If the function succeeds, the return value is the previous value of the specified 32-bit integer. If the value was not
previously set, the return value is zero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
If you use the SetClassLong function and the GCL_WNDPROC index to replace the window procedure, the
window procedure must conform to the guidelines specified in the description of the WindowProc callback
function.
Calling SetClassLong with the GCL_WNDPROC index creates a subclass of the window class that affects all
windows subsequently created with the class. An application can subclass a system class, but should not
subclass a window class created by another process.
Reserve extra class memory by specifying a nonzero value in the cbClsExtra member of the WNDCLASSEX
structure used with the RegisterClassEx function.
Use the SetClassLong function with care. For example, it is possible to change the background color for a class
by using SetClassLong , but this change does not immediately repaint all windows belonging to the class.
Examples
For an example, see Displaying an Icon.

NOTE
The winuser.h header defines SetClassLong as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-2 (introduced in


Windows 10, version 10.0.10240)

See also
Conceptual
GetClassLong
Reference
RegisterClassEx
SetClassLongPtr
SetWindowLong
WNDCLASSEX
Window Classes
WindowProc
SetClassLongPtrA function (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Replaces the specified value at the specified offset in the extra class memory or the WNDCLASSEX structure for
the class to which the specified window belongs.

Note To write code that is compatible with both 32-bit and 64-bit Windows, use SetClassLongPtr . When compiling for 32-
bit Windows, SetClassLongPtr is defined as a call to the SetClassLong function

Syntax
ULONG_PTR SetClassLongPtrA(
HWND hWnd,
int nIndex,
LONG_PTR dwNewLong
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
nIndex

Type: int
The value to be replaced. To set a value in the extra class memory, specify the positive, zero-based byte offset of
the value to be set. Valid values are in the range zero through the number of bytes of extra class memory, minus
eight; for example, if you specified 24 or more bytes of extra class memory, a value of 16 would be an index to
the third integer. To set a value other than the WNDCLASSEX structure, specify one of the following values.

VA L UE M EA N IN G

Sets the size, in bytes, of the extra memory associated with


GCL_CBCLSEXTRA the class. Setting this value does not change the number of
-20 extra bytes already allocated.

Sets the size, in bytes, of the extra window memory


GCL_CBWNDEXTRA associated with each window in the class. Setting this value
-18 does not change the number of extra bytes already
allocated. For information on how to access this memory,
see SetWindowLongPtr.

Replaces a handle to the background brush associated with


GCLP_ HBRBACKGROUND the class.
-10
Replaces a handle to the cursor associated with the class.
GCLP_HCURSOR
-12

Replaces a handle to the icon associated with the class.


GCLP_HICON
-14

Retrieves a handle to the small icon associated with the class.


GCLP_HICONSM
-34

Replaces a handle to the module that registered the class.


GCLP_HMODULE
-16

Replaces the pointer to the menu name string. The string


GCLP_MENUNAME identifies the menu resource associated with the class.
-8

Replaces the window-class style bits.


GCL_STYLE
-26

Replaces the pointer to the window procedure associated


GCLP_WNDPROC with the class.
-24

dwNewLong

Type: LONG_PTR
The replacement value.

Return value
Type: ULONG_PTR
If the function succeeds, the return value is the previous value of the specified offset. If this was not previously
set, the return value is zero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
If you use the SetClassLongPtr function and the GCLP_WNDPROC index to replace the window procedure,
the window procedure must conform to the guidelines specified in the description of the WindowProc callback
function.
Calling SetClassLongPtr with the GCLP_WNDPROC index creates a subclass of the window class that affects
all windows subsequently created with the class. An application can subclass a system class, but should not
subclass a window class created by another process.
Reserve extra class memory by specifying a nonzero value in the cbClsExtra member of the WNDCLASSEX
structure used with the RegisterClassEx function.
Use the SetClassLongPtr function with care. For example, it is possible to change the background color for a
class by using SetClassLongPtr , but this change does not immediately repaint all windows belonging to the
class.

NOTE
The winuser.h header defines SetClassLongPtr as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-2 (introduced in


Windows 10, version 10.0.10240)

See also
Conceptual
GetClassLongPtr
Reference
RegisterClassEx
SetWindowLongPtr
WNDCLASSEX
Window Classes
WindowProc
SetClassLongPtrW function (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Replaces the specified value at the specified offset in the extra class memory or the WNDCLASSEX structure for
the class to which the specified window belongs.

Note To write code that is compatible with both 32-bit and 64-bit Windows, use SetClassLongPtr . When compiling for 32-
bit Windows, SetClassLongPtr is defined as a call to the SetClassLong function

Syntax
ULONG_PTR SetClassLongPtrW(
HWND hWnd,
int nIndex,
LONG_PTR dwNewLong
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
nIndex

Type: int
The value to be replaced. To set a value in the extra class memory, specify the positive, zero-based byte offset of
the value to be set. Valid values are in the range zero through the number of bytes of extra class memory, minus
eight; for example, if you specified 24 or more bytes of extra class memory, a value of 16 would be an index to
the third integer. To set a value other than the WNDCLASSEX structure, specify one of the following values.

VA L UE M EA N IN G

Sets the size, in bytes, of the extra memory associated with


GCL_CBCLSEXTRA the class. Setting this value does not change the number of
-20 extra bytes already allocated.

Sets the size, in bytes, of the extra window memory


GCL_CBWNDEXTRA associated with each window in the class. Setting this value
-18 does not change the number of extra bytes already
allocated. For information on how to access this memory,
see SetWindowLongPtr.

Replaces a handle to the background brush associated with


GCLP_ HBRBACKGROUND the class.
-10
Replaces a handle to the cursor associated with the class.
GCLP_HCURSOR
-12

Replaces a handle to the icon associated with the class.


GCLP_HICON
-14

Retrieves a handle to the small icon associated with the class.


GCLP_HICONSM
-34

Replaces a handle to the module that registered the class.


GCLP_HMODULE
-16

Replaces the pointer to the menu name string. The string


GCLP_MENUNAME identifies the menu resource associated with the class.
-8

Replaces the window-class style bits.


GCL_STYLE
-26

Replaces the pointer to the window procedure associated


GCLP_WNDPROC with the class.
-24

dwNewLong

Type: LONG_PTR
The replacement value.

Return value
Type: ULONG_PTR
If the function succeeds, the return value is the previous value of the specified offset. If this was not previously
set, the return value is zero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
If you use the SetClassLongPtr function and the GCLP_WNDPROC index to replace the window procedure,
the window procedure must conform to the guidelines specified in the description of the WindowProc callback
function.
Calling SetClassLongPtr with the GCLP_WNDPROC index creates a subclass of the window class that affects
all windows subsequently created with the class. An application can subclass a system class, but should not
subclass a window class created by another process.
Reserve extra class memory by specifying a nonzero value in the cbClsExtra member of the WNDCLASSEX
structure used with the RegisterClassEx function.
Use the SetClassLongPtr function with care. For example, it is possible to change the background color for a
class by using SetClassLongPtr , but this change does not immediately repaint all windows belonging to the
class.

NOTE
The winuser.h header defines SetClassLongPtr as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-2 (introduced in


Windows 10, version 10.0.10240)

See also
Conceptual
GetClassLongPtr
Reference
RegisterClassEx
SetWindowLongPtr
WNDCLASSEX
Window Classes
WindowProc
SetClassLongW function (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Replaces the specified 32-bit (long ) value at the specified offset into the extra class memory or the
WNDCLASSEX structure for the class to which the specified window belongs.

Note This function has been superseded by the SetClassLongPtr function. To write code that is compatible with both 32-bit
and 64-bit versions of Windows, use SetClassLongPtr .

Syntax
DWORD SetClassLongW(
HWND hWnd,
int nIndex,
LONG dwNewLong
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
nIndex

Type: int
The value to be replaced. To set a 32-bit value in the extra class memory, specify the positive, zero-based byte
offset of the value to be set. Valid values are in the range zero through the number of bytes of extra class
memory, minus four; for example, if you specified 12 or more bytes of extra class memory, a value of 8 would
be an index to the third 32-bit integer. To set any other value from the WNDCLASSEX structure, specify one of
the following values.

VA L UE M EA N IN G

Sets the size, in bytes, of the extra memory associated with


GCL_CBCLSEXTRA the class. Setting this value does not change the number of
-20 extra bytes already allocated.

Sets the size, in bytes, of the extra window memory


GCL_CBWNDEXTRA associated with each window in the class. Setting this value
-18 does not change the number of extra bytes already
allocated. For information on how to access this memory,
see SetWindowLong.
Replaces a handle to the background brush associated with
GCL_HBRBACKGROUND the class.
-10

Replaces a handle to the cursor associated with the class.


GCL_HCURSOR
-12

Replaces a handle to the icon associated with the class.


GCL_HICON
-14

Replace a handle to the small icon associated with the class.


GCL_HICONSM
-34

Replaces a handle to the module that registered the class.


GCL_HMODULE
-16

Replaces the address of the menu name string. The string


GCL_MENUNAME identifies the menu resource associated with the class.
-8

Replaces the window-class style bits.


GCL_STYLE
-26

Replaces the address of the window procedure associated


GCL_WNDPROC with the class.
-24

dwNewLong

Type: LONG
The replacement value.

Return value
Type: DWORD
If the function succeeds, the return value is the previous value of the specified 32-bit integer. If the value was not
previously set, the return value is zero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
If you use the SetClassLong function and the GCL_WNDPROC index to replace the window procedure, the
window procedure must conform to the guidelines specified in the description of the WindowProc callback
function.
Calling SetClassLong with the GCL_WNDPROC index creates a subclass of the window class that affects all
windows subsequently created with the class. An application can subclass a system class, but should not
subclass a window class created by another process.
Reserve extra class memory by specifying a nonzero value in the cbClsExtra member of the WNDCLASSEX
structure used with the RegisterClassEx function.
Use the SetClassLong function with care. For example, it is possible to change the background color for a class
by using SetClassLong , but this change does not immediately repaint all windows belonging to the class.
Examples
For an example, see Displaying an Icon.

NOTE
The winuser.h header defines SetClassLong as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-2 (introduced in


Windows 10, version 10.0.10240)

See also
Conceptual
GetClassLong
Reference
RegisterClassEx
SetClassLongPtr
SetWindowLong
WNDCLASSEX
Window Classes
WindowProc
SetClassWord function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Replaces the 16-bit (WORD ) value at the specified offset into the extra class memory for the window class to
which the specified window belongs.

Note This function is provided only for compatibility with 16-bit versions of Windows. Applications should use the
SetClassLong function.

Syntax
WORD SetClassWord(
HWND hWnd,
int nIndex,
WORD wNewWord
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
nIndex

Type: int
The zero-based byte offset of the value to be replaced. Valid values are in the range zero through the number of
bytes of class memory minus two; for example, if you specified 10 or more bytes of extra class memory, a value
of 8 would be an index to the fifth 16-bit integer.
wNewWord

Type: WORD
The replacement value.

Return value
Type: WORD
If the function succeeds, the return value is the previous value of the specified 16-bit integer. If the value was not
previously set, the return value is zero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
Reserve extra class memory by specifying a nonzero value in the cbClsExtra member of the WNDCLASS
structure used with the RegisterClass function.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
Conceptual
GetClassWord
Reference
RegisterClass
SetClassLong
WNDCLASS
Window Classes
SetCoalescableTimer function (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Creates a timer with the specified time-out value and coalescing tolerance delay.

Syntax
UINT_PTR SetCoalescableTimer(
HWND hWnd,
UINT_PTR nIDEvent,
UINT uElapse,
TIMERPROC lpTimerFunc,
ULONG uToleranceDelay
);

Parameters
hWnd

Type: HWND
A handle to the window to be associated with the timer. This window must be owned by the calling thread. If a
NULL value for hWnd is passed in along with an nIDEvent of an existing timer, that timer will be replaced in the
same way that an existing non-NULL hWnd timer will be.
nIDEvent

Type: UINT_PTR
A timer identifier. If the hWnd parameter is NULL , and the nIDEvent does not match an existing timer, then the
nIDEvent is ignored and a new timer ID is generated. If the hWnd parameter is not NULL and the window
specified by hWnd already has a timer with the value nIDEvent, then the existing timer is replaced by the new
timer. When SetCoalescableTimer replaces a timer, the timer is reset. Therefore, a message will be sent after
the current time-out value elapses, but the previously set time-out value is ignored. If the call is not intended to
replace an existing timer, nIDEvent should be 0 if the hWnd is NULL .
uElapse

Type: UINT
The time-out value, in milliseconds.
If uElapse is less than USER_TIMER_MINIMUM (0x0000000A), the timeout is set to
USER_TIMER_MINIMUM . If uElapse is greater than USER_TIMER_MAXIMUM (0x7FFFFFFF), the timeout is
set to USER_TIMER_MAXIMUM .
If the sum of uElapse and uToleranceDelay exceeds USER_TIMER_MAXIMUM , an
ERROR_INVALID_PARAMETER exception occurs.
lpTimerFunc

Type: TIMERPROC
A pointer to the function to be notified when the time-out value elapses. For more information about the
function, see TimerProc. If lpTimerFunc is NULL , the system posts a WM_TIMER message to the application
queue. The hwnd member of the message's MSG structure contains the value of the hWnd parameter.
uToleranceDelay

Type: ULONG
It can be one of the following values:

VA L UE M EA N IN G

Uses the system default timer coalescing.


TIMERV_DEFAULT_COALESCING
0x00000000

Uses no timer coalescing. When this value is used, the


TIMERV_NO_COALESCING created timer is not coalesced, no matter what the system
0xFFFFFFFF default timer coalescing is or the application compatiblity
flags are.

Note Do not use this value unless you are certain that the
timer requires no coalescing.

Specifies the coalescing tolerance delay, in milliseconds.


0x1 - 0x7FFFFFF5
Applications should set this value to the system default
(TIMERV_DEFAULT_COALESCING ) or the largest
value possible.
If the sum of uElapse and uToleranceDelay exceeds
USER_TIMER_MAXIMUM (0x7FFFFFFF), an
ERROR_INVALID_PARAMETER exception occurs.
See Windows Timer Coalescing for more details and best
practices.

An invalid value. If uToleranceDelay is set to an invalid value,


Any other value the function fails and returns zero.

Return value
Type: UINT_PTR
If the function succeeds and the hWnd parameter is NULL , the return value is an integer identifying the new
timer. An application can pass this value to the KillTimer function to destroy the timer.
If the function succeeds and the hWnd parameter is not NULL , then the return value is a nonzero integer. An
application can pass the value of the nIDEvent parameter to the KillTimer function to destroy the timer.
If the function fails to create a timer, the return value is zero. To get extended error information, call GetLastError.

Remarks
An application can process WM_TIMER messages by including a WM_TIMER case statement in the window
procedure or by specifying a TimerProc callback function when creating the timer. When you specify a
TimerProc callback function, the default window procedure calls the callback function when it processes
WM_TIMER . Therefore, you need to dispatch messages in the calling thread, even when you use TimerProc
instead of processing WM_TIMER .
The wParam parameter of the WM_TIMER message contains the value of the nIDEvent parameter.
The timer identifier, nIDEvent, is specific to the associated window. Another window can have its own timer
which has the same identifier as a timer owned by another window. The timers are distinct.
SetTimer can reuse timer IDs in the case where hWnd is NULL .
When uToleranceDelay is set to 0, the system default timer coalescing is used and SetCoalescableTimer
behaves the same as SetTimer.

Requirements

Minimum suppor ted client Windows 8 [desktop apps only]

Minimum suppor ted ser ver Windows Server 2012 [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-2 (introduced in Windows


10, version 10.0.10240)

See also
Coalescing timers sample
Conceptual
KeSetCoalescableTimer
KeSetTimer
KillTimer
MSG
Reference
Sample
SetTimer
TimerProc
Timers
Using Timers
WM_TIMER
SetForegroundWindow function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Brings the thread that created the specified window into the foreground and activates the window. Keyboard
input is directed to the window, and various visual cues are changed for the user. The system assigns a slightly
higher priority to the thread that created the foreground window than it does to other threads.

Syntax
BOOL SetForegroundWindow(
HWND hWnd
);

Parameters
hWnd

Type: HWND
A handle to the window that should be activated and brought to the foreground.

Return value
Type: BOOL
If the window was brought to the foreground, the return value is nonzero.
If the window was not brought to the foreground, the return value is zero.

Remarks
The system restricts which processes can set the foreground window. A process can set the foreground window
only if one of the following conditions is true:
The process is the foreground process.
The process was started by the foreground process.
The process received the last input event.
There is no foreground process.
The process is being debugged.
The foreground process is not a Modern Application or the Start Screen.
The foreground is not locked (see LockSetForegroundWindow).
The foreground lock time-out has expired (see SPI_GETFOREGROUNDLOCKTIMEOUT in
SystemParametersInfo).
No menus are active.
An application cannot force a window to the foreground while the user is working with another window. Instead,
Windows flashes the taskbar button of the window to notify the user.
A process that can set the foreground window can enable another process to set the foreground window by
calling the AllowSetForegroundWindow function. The process specified by dwProcessId loses the ability to set
the foreground window the next time the user generates input, unless the input is directed at that process, or the
next time a process calls AllowSetForegroundWindow , unless that process is specified.
The foreground process can disable calls to SetForegroundWindow by calling the
LockSetForegroundWindow function.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
AllowSetForegroundWindow
Conceptual
FlashWindowEx
GetForegroundWindow
LockSetForegroundWindow
Other Resources
Reference
SetActiveWindow
Windows
SetLayeredWindowAttributes function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Sets the opacity and transparency color key of a layered window.

Syntax
BOOL SetLayeredWindowAttributes(
HWND hwnd,
COLORREF crKey,
BYTE bAlpha,
DWORD dwFlags
);

Parameters
hwnd

Type: HWND
A handle to the layered window. A layered window is created by specifying WS_EX_L AYERED when creating
the window with the CreateWindowEx function or by setting WS_EX_L AYERED via SetWindowLong after the
window has been created.
Windows 8: The WS_EX_L AYERED style is supported for top-level windows and child windows. Previous
Windows versions support WS_EX_L AYERED only for top-level windows.
crKey

Type: COLORREF
A COLORREF structure that specifies the transparency color key to be used when composing the layered
window. All pixels painted by the window in this color will be transparent. To generate a COLORREF , use the
RGB macro.
bAlpha

Type: BYTE
Alpha value used to describe the opacity of the layered window. Similar to the SourceConstantAlpha member
of the BLENDFUNCTION structure. When bAlpha is 0, the window is completely transparent. When bAlpha is
255, the window is opaque.
dwFlags

Type: DWORD
An action to be taken. This parameter can be one or more of the following values.

VA L UE M EA N IN G

Use bAlpha to determine the opacity of the layered window.


LWA_ALPHA
0x00000002
Use crKey as the transparency color.
LWA_COLORKEY
0x00000001

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
Note that once SetLayeredWindowAttributes has been called for a layered window, subsequent
UpdateLayeredWindow calls will fail until the layering style bit is cleared and set again.
For more information, see Using Layered Windows.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows


8.1)

See also
AlphaBlend
COLORREF
Conceptual
CreateWindowEx
Other Resources
RGB
Reference
SetWindowLong
TransparentBlt
UpdateLayeredWindow
Using Windows
Windows
SetMessageExtraInfo function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Sets the extra message information for the current thread. Extra message information is an application- or
driver-defined value associated with the current thread's message queue. An application can use the
GetMessageExtraInfo function to retrieve a thread's extra message information.

Syntax
LPARAM SetMessageExtraInfo(
LPARAM lParam
);

Parameters
lParam

Type: LPARAM
The value to be associated with the current thread.

Return value
Type: LPARAM
The return value is the previous value associated with the current thread.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetMessageExtraInfo
Messages and Message Queues
Reference
SetParent function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Changes the parent window of the specified child window.

Syntax
HWND SetParent(
HWND hWndChild,
HWND hWndNewParent
);

Parameters
hWndChild

Type: HWND
A handle to the child window.
hWndNewParent

Type: HWND
A handle to the new parent window. If this parameter is NULL , the desktop window becomes the new parent
window. If this parameter is HWND_MESSAGE , the child window becomes a message-only window.

Return value
Type: HWND
If the function succeeds, the return value is a handle to the previous parent window.
If the function fails, the return value is NULL . To get extended error information, call GetLastError.

Remarks
An application can use the SetParent function to set the parent window of a pop-up, overlapped, or child
window.
If the window identified by the hWndChild parameter is visible, the system performs the appropriate redrawing
and repainting.
For compatibility reasons, SetParent does not modify the WS_CHILD or WS_POPUP window styles of the
window whose parent is being changed. Therefore, if hWndNewParent is NULL , you should also clear the
WS_CHILD bit and set the WS_POPUP style after calling SetParent . Conversely, if hWndNewParent is not
NULL and the window was previously a child of the desktop, you should clear the WS_POPUP style and set the
WS_CHILD style before calling SetParent .
When you change the parent of a window, you should synchronize the UISTATE of both windows. For more
information, see WM_CHANGEUISTATE and WM_UPDATEUISTATE.
Unexpected behavior or errors may occur if hWndNewParent and hWndChild are running in different DPI
awareness modes. The table below outlines this behavior:

O P ERAT IO N W IN DO W S 8. 1 W IN DO W S 10 ( 1607 A N D W IN DO W S 10 ( 1703 A N D


EA RL IER) L AT ER)

SetParent (In-Proc) N/A Forced reset (of current Fail


process) (ERROR_INVALID_STATE)

SetParent (Cross-Proc) Forced reset (of child Forced reset (of child Forced reset (of child
window's process) window's process) window's process)

For more information on DPI awareness, see the Windows High DPI documentation.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetParent
Reference
Windows
SetProcessDefaultLayout function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Changes the default layout when windows are created with no parent or owner only for the currently running
process.

Syntax
BOOL SetProcessDefaultLayout(
DWORD dwDefaultLayout
);

Parameters
dwDefaultLayout

Type: DWORD
The default process layout. This parameter can be 0 or the following value.

VA L UE M EA N IN G

Sets the default horizontal layout to be right to left.


L AYOUT_RTL
0x00000001

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
The layout specifies how text and graphics are laid out; the default is left to right. The
SetProcessDefaultLayout function changes layout to be right to left, which is the standard in Arabic and
Hebrew cultures.
After the L AYOUT_RTL flag is selected, flags normally specifying right or left are reversed. To avoid confusion,
consider defining alternate words for standard flags, such as those in the following table.

STA N DA RD F L A G SUGGEST ED A LT ERN AT E N A M E

WS_EX_RIGHT WS_EX_TRAILING

WS_EX_RTLREADING WS_EX_REVERSEREADING

WS_EX_LEFTSCROLLBAR WS_EX_LEADSCROLLBAR
ES_LEFT ES_LEAD

ES_RIGHT ES_TRAIL

EC_LEFTMARGIN EC_LEADMARGIN

EC_RIGHTMARGIN EC_TRAILMARGIN

If using this function with a mirrored window, note that the SetProcessDefaultLayout function does not
mirror the whole process and all the device contexts (DCs) created in it. It mirrors only the mirrored window's
DCs. To mirror any DC, use the SetLayout function.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-3 (introduced in Windows


10, version 10.0.10240)

See also
Conceptual
GetProcessDefaultLayout
Other Resources
Reference
SetLayout
Windows
SetProcessDPIAware function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Note It is recommended that you set the process-default DPI awareness via application manifest, not an API call. See Setting
the default DPI awareness for a process for more information. Setting the process-default DPI awareness via API call can lead
to unexpected application behavior.

Sets the process-default DPI awareness to system-DPI awareness. This is equivalent to calling
SetProcessDpiAwarenessContext with a DPI_AWARENESS_CONTEXT value of
DPI_AWARENESS_CONTEXT_SYSTEM_AWARE.

Syntax
BOOL SetProcessDPIAware();

Parameters
This function has no parameters.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero. Otherwise, the return value is zero.

Remarks
For more information, see Setting the default DPI awareness for a process.

Requirements

Minimum suppor ted client Windows Vista [desktop apps only]

Minimum suppor ted ser ver Windows Server 2008 [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
Setting the default DPI awareness for a process
SetPropA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Adds a new entry or changes an existing entry in the property list of the specified window. The function adds a
new entry to the list if the specified character string does not exist already in the list. The new entry contains the
string and the handle. Otherwise, the function replaces the string's current handle with the specified handle.

Syntax
BOOL SetPropA(
HWND hWnd,
LPCSTR lpString,
HANDLE hData
);

Parameters
hWnd

Type: HWND
A handle to the window whose property list receives the new entry.
lpString

Type: LPCTSTR
A null-terminated string or an atom that identifies a string. If this parameter is an atom, it must be a global atom
created by a previous call to the GlobalAddAtom function. The atom must be placed in the low-order word of
lpString; the high-order word must be zero.
hData

Type: HANDLE
A handle to the data to be copied to the property list. The data handle can identify any value useful to the
application.

Return value
Type: BOOL
If the data handle and string are added to the property list, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
Before a window is destroyed (that is, before it returns from processing the WM_NCDESTROY message), an
application must remove all entries it has added to the property list. The application must use the RemoveProp
function to remove the entries.
SetProp is subject to the restrictions of User Interface Privilege Isolation (UIPI). A process can only call this
function on a window belonging to a process of lesser or equal integrity level. When UIPI blocks property
changes, GetLastError will return 5.
Examples
For an example, see Adding a Window Property.

NOTE
The winuser.h header defines SetProp as an alias which automatically selects the ANSI or Unicode version of this function
based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that
not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see
Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows


10, version 10.0.14393)

See also
Conceptual
GlobalAddAtom
Reference
RemoveProp
WM_NCDESTROY
Window Properties
ITaskbarList2::MarkFullscreenWindow
SetPropW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Adds a new entry or changes an existing entry in the property list of the specified window. The function adds a
new entry to the list if the specified character string does not exist already in the list. The new entry contains the
string and the handle. Otherwise, the function replaces the string's current handle with the specified handle.

Syntax
BOOL SetPropW(
HWND hWnd,
LPCWSTR lpString,
HANDLE hData
);

Parameters
hWnd

Type: HWND
A handle to the window whose property list receives the new entry.
lpString

Type: LPCTSTR
A null-terminated string or an atom that identifies a string. If this parameter is an atom, it must be a global atom
created by a previous call to the GlobalAddAtom function. The atom must be placed in the low-order word of
lpString; the high-order word must be zero.
hData

Type: HANDLE
A handle to the data to be copied to the property list. The data handle can identify any value useful to the
application.

Return value
Type: BOOL
If the data handle and string are added to the property list, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
Before a window is destroyed (that is, before it returns from processing the WM_NCDESTROY message), an
application must remove all entries it has added to the property list. The application must use the RemoveProp
function to remove the entries.
SetProp is subject to the restrictions of User Interface Privilege Isolation (UIPI). A process can only call this
function on a window belonging to a process of lesser or equal integrity level. When UIPI blocks property
changes, GetLastError will return 5.
Examples
For an example, see Adding a Window Property.

NOTE
The winuser.h header defines SetProp as an alias which automatically selects the ANSI or Unicode version of this function
based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that
not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see
Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows


10, version 10.0.14393)

See also
Conceptual
GlobalAddAtom
Reference
RemoveProp
WM_NCDESTROY
Window Properties
ITaskbarList2::MarkFullscreenWindow
SetSysColors function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Sets the colors for the specified display elements. Display elements are the various parts of a window and the
display that appear on the system display screen.

Syntax
BOOL SetSysColors(
int cElements,
const INT *lpaElements,
const COLORREF *lpaRgbValues
);

Parameters
cElements

Type: int
The number of display elements in the lpaElements array.
lpaElements

Type: const INT*


An array of integers that specify the display elements to be changed. For a list of display elements, see
GetSysColor.
lpaRgbValues

Type: const COLORREF*


An array of COLORREF values that contain the new red, green, blue (RGB) color values for the display elements
in the array pointed to by the lpaElements parameter.
To generate a COLORREF, use the RGB macro.

Return value
Type: BOOL
If the function succeeds, the return value is a nonzero value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
The SetSysColors function sends a WM_SYSCOLORCHANGE message to all windows to inform them of the
change in color. It also directs the system to repaint the affected portions of all currently visible windows.
It is best to respect the color settings specified by the user. If you are writing an application to enable the user to
change the colors, then it is appropriate to use this function. However, this function affects only the current
session. The new colors are not saved when the system terminates.
Examples
The following example demonstrates the use of the GetSysColor and SetSysColors functions. First, the
example uses GetSysColor to retrieve the colors of the window background and active caption and displays
the red, green, blue (RGB) values in hexadecimal notation. Next, example uses SetSysColors to change the
color of the window background to light gray and the active title bars to dark purple. After a 10-second delay,
the example restores the previous colors for these elements using SetSysColors.

#include <windows.h>
#include <stdio.h>
#pragma comment(lib, "user32.lib")

void main()
{
int aElements[2] = {COLOR_WINDOW, COLOR_ACTIVECAPTION};
DWORD aOldColors[2];
DWORD aNewColors[2];

// Get the current color of the window background.

aOldColors[0] = GetSysColor(aElements[0]);

printf("Current window color: {0x%x, 0x%x, 0x%x}\n",


GetRValue(aOldColors[0]),
GetGValue(aOldColors[0]),
GetBValue(aOldColors[0]));

// Get the current color of the active caption.

aOldColors[1] = GetSysColor(aElements[1]);

printf("Current active caption color: {0x%x, 0x%x, 0x%x}\n",


GetRValue(aOldColors[1]),
GetGValue(aOldColors[1]),
GetBValue(aOldColors[1]));

// Define new colors for the elements

aNewColors[0] = RGB(0x80, 0x80, 0x80); // light gray


aNewColors[1] = RGB(0x80, 0x00, 0x80); // dark purple

printf("\nNew window color: {0x%x, 0x%x, 0x%x}\n",


GetRValue(aNewColors[0]),
GetGValue(aNewColors[0]),
GetBValue(aNewColors[0]));

printf("New active caption color: {0x%x, 0x%x, 0x%x}\n",


GetRValue(aNewColors[1]),
GetGValue(aNewColors[1]),
GetBValue(aNewColors[1]));

// Set the elements defined in aElements to the colors defined


// in aNewColors

SetSysColors(2, aElements, aNewColors);

printf("\nWindow background and active border have been changed.\n");


printf("Reverting to previous colors in 10 seconds...\n");

Sleep(10000);

// Restore the elements to their original colors

SetSysColors(2, aElements, aOldColors);


}
Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
COLORREF
GetSysColor
RGB
SetTimer function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Creates a timer with the specified time-out value.

Syntax
UINT_PTR SetTimer(
HWND hWnd,
UINT_PTR nIDEvent,
UINT uElapse,
TIMERPROC lpTimerFunc
);

Parameters
hWnd

Type: HWND
A handle to the window to be associated with the timer. This window must be owned by the calling thread. If a
NULL value for hWnd is passed in along with an nIDEvent of an existing timer, that timer will be replaced in the
same way that an existing non-NULL hWnd timer will be.
nIDEvent

Type: UINT_PTR
A nonzero timer identifier. If the hWnd parameter is NULL , and the nIDEvent does not match an existing timer
then it is ignored and a new timer ID is generated. If the hWnd parameter is not NULL and the window specified
by hWnd already has a timer with the value nIDEvent, then the existing timer is replaced by the new timer. When
SetTimer replaces a timer, the timer is reset. Therefore, a message will be sent after the current time-out value
elapses, but the previously set time-out value is ignored. If the call is not intended to replace an existing timer,
nIDEvent should be 0 if the hWnd is NULL .
uElapse

Type: UINT
The time-out value, in milliseconds.
If uElapse is less than USER_TIMER_MINIMUM (0x0000000A), the timeout is set to
USER_TIMER_MINIMUM . If uElapse is greater than USER_TIMER_MAXIMUM (0x7FFFFFFF), the timeout is
set to USER_TIMER_MAXIMUM .
lpTimerFunc

Type: TIMERPROC
A pointer to the function to be notified when the time-out value elapses. For more information about the
function, see TimerProc. If lpTimerFunc is NULL , the system posts a WM_TIMER message to the application
queue. The hwnd member of the message's MSG structure contains the value of the hWnd parameter.
Return value
Type: UINT_PTR
If the function succeeds and the hWnd parameter is NULL , the return value is an integer identifying the new
timer. An application can pass this value to the KillTimer function to destroy the timer.
If the function succeeds and the hWnd parameter is not NULL , then the return value is a nonzero integer. An
application can pass the value of the nIDEvent parameter to the KillTimer function to destroy the timer.
If the function fails to create a timer, the return value is zero. To get extended error information, call GetLastError.

Remarks
An application can process WM_TIMER messages by including a WM_TIMER case statement in the window
procedure or by specifying a TimerProc callback function when creating the timer. When you specify a
TimerProc callback function, the default window procedure calls the callback function when it processes
WM_TIMER . Therefore, you need to dispatch messages in the calling thread, even when you use TimerProc
instead of processing WM_TIMER .
The wParam parameter of the WM_TIMER message contains the value of the nIDEvent parameter.
The timer identifier, nIDEvent, is specific to the associated window. Another window can have its own timer
which has the same identifier as a timer owned by another window. The timers are distinct.
SetTimer can reuse timer IDs in the case where hWnd is NULL .
Examples
For an example, see Creating a Timer.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-2 (introduced in Windows


10, version 10.0.10240)

See also
Conceptual
KillTimer
MSG
Reference
SetWaitableTimer
TimerProc
Timers
WM_TIMER
SetWindowDisplayAffinity function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Specifies where the content of the window can be displayed.

Syntax
BOOL SetWindowDisplayAffinity(
HWND hWnd,
DWORD dwAffinity
);

Parameters
hWnd

Type: HWND
A handle to the top-level window. The window must belong to the current process.
dwAffinity

Type: DWORD
The display affinity setting that specifies where the content of the window can be displayed.
This parameter can be one of the following values.

VA L UE M EA N IN G

Imposes no restrictions on where the window can be


WDA_NONE displayed.
0x00000000

The window content is displayed only on a monitor.


WDA_MONITOR Everywhere else, the window appears with no content.
0x00000001

The window is displayed only on a monitor. Everywhere else,


WDA_EXCLUDEFROMCAPTURE the window does not appear at all.
0x00000011
One use for this affinity is for windows that show video
recording controls, so that the controls are not included
in the capture.
Introduced in Windows 10 Version 2004. See remarks
about compatibility regarding previous versions of
Windows.

Return value
Type: BOOL
If the function succeeds, it returns TRUE ; otherwise, it returns FALSE when, for example, the function call is
made on a non top-level window. To get extended error information, call GetLastError.

Remarks
This function and GetWindowDisplayAffinity are designed to support the window content protection feature
that is new to Windows 7. This feature enables applications to protect their own onscreen window content from
being captured or copied through a specific set of public operating system features and APIs. However, it works
only when the Desktop Window Manager(DWM) is composing the desktop.
It is important to note that unlike a security feature or an implementation of Digital Rights Management (DRM),
there is no guarantee that using SetWindowDisplayAffinity and GetWindowDisplayAffinity, and other
necessary functions such as DwmIsCompositionEnabled, will strictly protect windowed content, for example
where someone takes a photograph of the screen.
Starting in Windows 10 Version 2004, WDA_EXCLUDEFROMCAPTURE is a supported value. Setting the display
affinity to WDA_EXCLUDEFROMCAPTURE on previous version of Windows will behave as if WDA_MONITOR is
applied.

Requirements

Minimum suppor ted client Windows 7 [desktop apps only]

Minimum suppor ted ser ver Windows Server 2008 R2 [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows


8.1)

See also
SetWindowDisplayAffinity, Windows
SetWindowLongA function (winuser.h)
2/1/2021 • 4 minutes to read • Edit Online

Changes an attribute of the specified window. The function also sets the 32-bit (long) value at the specified
offset into the extra window memory.

Note This function has been superseded by the SetWindowLongPtr function. To write code that is compatible with both 32-
bit and 64-bit versions of Windows, use the SetWindowLongPtr function.

Syntax
LONG SetWindowLongA(
HWND hWnd,
int nIndex,
LONG dwNewLong
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
nIndex

Type: int
The zero-based offset to the value to be set. Valid values are in the range zero through the number of bytes of
extra window memory, minus the size of an integer. To set any other value, specify one of the following values.

VA L UE M EA N IN G

Sets a new extended window style.


GWL_EXSTYLE
-20

Sets a new application instance handle.


GWL_HINSTANCE
-6

Sets a new identifier of the child window. The window cannot


GWL_ID be a top-level window.
-12

Sets a new window style.


GWL_STYLE
-16
Sets the user data associated with the window. This data is
GWL_USERDATA intended for use by the application that created the window.
-21 Its value is initially zero.

Sets a new address for the window procedure.


GWL_WNDPROC
You cannot change this attribute if the window does not
-4
belong to the same process as the calling thread.

The following values are also available when the hWnd parameter identifies a dialog box.

VA L UE M EA N IN G

Sets the new address of the dialog box procedure.


DWL_DLGPROC
DWLP_MSGRESULT + sizeof(LRESULT)

Sets the return value of a message processed in the dialog


DWL_MSGRESULT box procedure.
0

Sets new extra information that is private to the application,


DWL_USER such as handles or pointers.
DWLP_DLGPROC + sizeof(DLGPROC)

dwNewLong

Type: LONG
The replacement value.

Return value
Type: LONG
If the function succeeds, the return value is the previous value of the specified 32-bit integer.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If the previous value of the specified 32-bit integer is zero, and the function succeeds, the return value is zero,
but the function does not clear the last error information. This makes it difficult to determine success or failure.
To deal with this, you should clear the last error information by calling SetLastError with 0 before calling
SetWindowLong . Then, function failure will be indicated by a return value of zero and a GetLastError result
that is nonzero.

Remarks
Certain window data is cached, so changes you make using SetWindowLong will not take effect until you call
the SetWindowPos function. Specifically, if you change any of the frame styles, you must call SetWindowPos
with the SWP_FRAMECHANGED flag for the cache to be updated properly.
If you use SetWindowLong with the GWL_WNDPROC index to replace the window procedure, the window
procedure must conform to the guidelines specified in the description of the WindowProc callback function.
If you use SetWindowLong with the DWL_MSGRESULT index to set the return value for a message
processed by a dialog procedure, you should return TRUE directly afterward. Otherwise, if you call any function
that results in your dialog procedure receiving a window message, the nested window message could overwrite
the return value you set using DWL_MSGRESULT .
Calling SetWindowLong with the GWL_WNDPROC index creates a subclass of the window class used to
create the window. An application can subclass a system class, but should not subclass a window class created
by another process. The SetWindowLong function creates the window subclass by changing the window
procedure associated with a particular window class, causing the system to call the new window procedure
instead of the previous one. An application must pass any messages not processed by the new window
procedure to the previous window procedure by calling CallWindowProc. This allows the application to create a
chain of window procedures.
Reserve extra window memory by specifying a nonzero value in the cbWndExtra member of the
WNDCLASSEX structure used with the RegisterClassEx function.
You must not call SetWindowLong with the GWL_HWNDPARENT index to change the parent of a child
window. Instead, use the SetParent function.
If the window has a class style of CS_CL ASSDC or CS_OWNDC , do not set the extended window styles
WS_EX_COMPOSITED or WS_EX_L AYERED .
Calling SetWindowLong to set the style on a progressbar will reset its position.
Examples
For an example, see Subclassing a Window.

NOTE
The winuser.h header defines SetWindowLong as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)
See also
CallWindowProc
Conceptual
GetWindowLong
Reference
RegisterClassEx
SetParent
SetWindowLongPtr
WNDCLASSEX
Window Classes
WindowProc
SetWindowLongPtrA function (winuser.h)
2/1/2021 • 4 minutes to read • Edit Online

Changes an attribute of the specified window. The function also sets a value at the specified offset in the extra
window memory.

Note To write code that is compatible with both 32-bit and 64-bit versions of Windows, use SetWindowLongPtr . When
compiling for 32-bit Windows, SetWindowLongPtr is defined as a call to the SetWindowLong function.

Syntax
LONG_PTR SetWindowLongPtrA(
HWND hWnd,
int nIndex,
LONG_PTR dwNewLong
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs. The SetWindowLongPtr
function fails if the process that owns the window specified by the hWnd parameter is at a higher process
privilege in the UIPI hierarchy than the process the calling thread resides in.
Windows XP/2000: The SetWindowLongPtr function fails if the window specified by the hWnd parameter
does not belong to the same process as the calling thread.
nIndex

Type: int
The zero-based offset to the value to be set. Valid values are in the range zero through the number of bytes of
extra window memory, minus the size of a LONG_PTR . To set any other value, specify one of the following
values.

VA L UE M EA N IN G

Sets a new extended window style.


GWL_EXSTYLE
-20

Sets a new application instance handle.


GWLP_HINSTANCE
-6
Sets a new identifier of the child window. The window cannot
GWLP_ID be a top-level window.
-12

Sets a new window style.


GWL_STYLE
-16

Sets the user data associated with the window. This data is
GWLP_USERDATA intended for use by the application that created the window.
-21 Its value is initially zero.

Sets a new address for the window procedure.


GWLP_WNDPROC
-4

The following values are also available when the hWnd parameter identifies a dialog box.

VA L UE M EA N IN G

Sets the new pointer to the dialog box procedure.


DWLP_DLGPROC
DWLP_MSGRESULT + sizeof(LRESULT)

Sets the return value of a message processed in the dialog


DWLP_MSGRESULT box procedure.
0

Sets new extra information that is private to the application,


DWLP_USER such as handles or pointers.
DWLP_DLGPROC + sizeof(DLGPROC)

dwNewLong

Type: LONG_PTR
The replacement value.

Return value
Type: LONG_PTR
If the function succeeds, the return value is the previous value of the specified offset.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If the previous value is zero and the function succeeds, the return value is zero, but the function does not clear
the last error information. To determine success or failure, clear the last error information by calling SetLastError
with 0, then call SetWindowLongPtr . Function failure will be indicated by a return value of zero and a
GetLastError result that is nonzero.

Remarks
Certain window data is cached, so changes you make using SetWindowLongPtr will not take effect until you
call the SetWindowPos function.
If you use SetWindowLongPtr with the GWLP_WNDPROC index to replace the window procedure, the
window procedure must conform to the guidelines specified in the description of the WindowProc callback
function.
If you use SetWindowLongPtr with the DWLP_MSGRESULT index to set the return value for a message
processed by a dialog box procedure, the dialog box procedure should return TRUE directly afterward.
Otherwise, if you call any function that results in your dialog box procedure receiving a window message, the
nested window message could overwrite the return value you set by using DWLP_MSGRESULT .
Calling SetWindowLongPtr with the GWLP_WNDPROC index creates a subclass of the window class used to
create the window. An application can subclass a system class, but should not subclass a window class created
by another process. The SetWindowLongPtr function creates the window subclass by changing the window
procedure associated with a particular window class, causing the system to call the new window procedure
instead of the previous one. An application must pass any messages not processed by the new window
procedure to the previous window procedure by calling CallWindowProc. This allows the application to create a
chain of window procedures.
Reserve extra window memory by specifying a nonzero value in the cbWndExtra member of the
WNDCLASSEX structure used with the RegisterClassEx function.
Do not call SetWindowLongPtr with the GWLP_HWNDPARENT index to change the parent of a child
window. Instead, use the SetParent function.
If the window has a class style of CS_CL ASSDC or CS_PARENTDC , do not set the extended window styles
WS_EX_COMPOSITED or WS_EX_L AYERED .
Calling SetWindowLongPtr to set the style on a progressbar will reset its position.

NOTE
The winuser.h header defines SetWindowLongPtr as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)
See also
CallWindowProc
Conceptual
GetWindowLongPtr
Reference
RegisterClassEx
SetParent
WNDCLASSEX
Window Classes
WindowProc
SetWindowLongPtrW function (winuser.h)
2/1/2021 • 4 minutes to read • Edit Online

Changes an attribute of the specified window. The function also sets a value at the specified offset in the extra
window memory.

Note To write code that is compatible with both 32-bit and 64-bit versions of Windows, use SetWindowLongPtr . When
compiling for 32-bit Windows, SetWindowLongPtr is defined as a call to the SetWindowLong function.

Syntax
LONG_PTR SetWindowLongPtrW(
HWND hWnd,
int nIndex,
LONG_PTR dwNewLong
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs. The SetWindowLongPtr
function fails if the process that owns the window specified by the hWnd parameter is at a higher process
privilege in the UIPI hierarchy than the process the calling thread resides in.
Windows XP/2000: The SetWindowLongPtr function fails if the window specified by the hWnd parameter
does not belong to the same process as the calling thread.
nIndex

Type: int
The zero-based offset to the value to be set. Valid values are in the range zero through the number of bytes of
extra window memory, minus the size of a LONG_PTR . To set any other value, specify one of the following
values.

VA L UE M EA N IN G

Sets a new extended window style.


GWL_EXSTYLE
-20

Sets a new application instance handle.


GWLP_HINSTANCE
-6
Sets a new identifier of the child window. The window cannot
GWLP_ID be a top-level window.
-12

Sets a new window style.


GWL_STYLE
-16

Sets the user data associated with the window. This data is
GWLP_USERDATA intended for use by the application that created the window.
-21 Its value is initially zero.

Sets a new address for the window procedure.


GWLP_WNDPROC
-4

The following values are also available when the hWnd parameter identifies a dialog box.

VA L UE M EA N IN G

Sets the new pointer to the dialog box procedure.


DWLP_DLGPROC
DWLP_MSGRESULT + sizeof(LRESULT)

Sets the return value of a message processed in the dialog


DWLP_MSGRESULT box procedure.
0

Sets new extra information that is private to the application,


DWLP_USER such as handles or pointers.
DWLP_DLGPROC + sizeof(DLGPROC)

dwNewLong

Type: LONG_PTR
The replacement value.

Return value
Type: LONG_PTR
If the function succeeds, the return value is the previous value of the specified offset.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If the previous value is zero and the function succeeds, the return value is zero, but the function does not clear
the last error information. To determine success or failure, clear the last error information by calling SetLastError
with 0, then call SetWindowLongPtr . Function failure will be indicated by a return value of zero and a
GetLastError result that is nonzero.

Remarks
Certain window data is cached, so changes you make using SetWindowLongPtr will not take effect until you
call the SetWindowPos function.
If you use SetWindowLongPtr with the GWLP_WNDPROC index to replace the window procedure, the
window procedure must conform to the guidelines specified in the description of the WindowProc callback
function.
If you use SetWindowLongPtr with the DWLP_MSGRESULT index to set the return value for a message
processed by a dialog box procedure, the dialog box procedure should return TRUE directly afterward.
Otherwise, if you call any function that results in your dialog box procedure receiving a window message, the
nested window message could overwrite the return value you set by using DWLP_MSGRESULT .
Calling SetWindowLongPtr with the GWLP_WNDPROC index creates a subclass of the window class used to
create the window. An application can subclass a system class, but should not subclass a window class created
by another process. The SetWindowLongPtr function creates the window subclass by changing the window
procedure associated with a particular window class, causing the system to call the new window procedure
instead of the previous one. An application must pass any messages not processed by the new window
procedure to the previous window procedure by calling CallWindowProc. This allows the application to create a
chain of window procedures.
Reserve extra window memory by specifying a nonzero value in the cbWndExtra member of the
WNDCLASSEX structure used with the RegisterClassEx function.
Do not call SetWindowLongPtr with the GWLP_HWNDPARENT index to change the parent of a child
window. Instead, use the SetParent function.
If the window has a class style of CS_CL ASSDC or CS_PARENTDC , do not set the extended window styles
WS_EX_COMPOSITED or WS_EX_L AYERED .
Calling SetWindowLongPtr to set the style on a progressbar will reset its position.

NOTE
The winuser.h header defines SetWindowLongPtr as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)
See also
CallWindowProc
Conceptual
GetWindowLongPtr
Reference
RegisterClassEx
SetParent
WNDCLASSEX
Window Classes
WindowProc
SetWindowLongW function (winuser.h)
2/1/2021 • 4 minutes to read • Edit Online

Changes an attribute of the specified window. The function also sets the 32-bit (long) value at the specified
offset into the extra window memory.

Note This function has been superseded by the SetWindowLongPtr function. To write code that is compatible with both 32-
bit and 64-bit versions of Windows, use the SetWindowLongPtr function.

Syntax
LONG SetWindowLongW(
HWND hWnd,
int nIndex,
LONG dwNewLong
);

Parameters
hWnd

Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
nIndex

Type: int
The zero-based offset to the value to be set. Valid values are in the range zero through the number of bytes of
extra window memory, minus the size of an integer. To set any other value, specify one of the following values.

VA L UE M EA N IN G

Sets a new extended window style.


GWL_EXSTYLE
-20

Sets a new application instance handle.


GWL_HINSTANCE
-6

Sets a new identifier of the child window. The window cannot


GWL_ID be a top-level window.
-12

Sets a new window style.


GWL_STYLE
-16
Sets the user data associated with the window. This data is
GWL_USERDATA intended for use by the application that created the window.
-21 Its value is initially zero.

Sets a new address for the window procedure.


GWL_WNDPROC
You cannot change this attribute if the window does not
-4
belong to the same process as the calling thread.

The following values are also available when the hWnd parameter identifies a dialog box.

VA L UE M EA N IN G

Sets the new address of the dialog box procedure.


DWL_DLGPROC
DWLP_MSGRESULT + sizeof(LRESULT)

Sets the return value of a message processed in the dialog


DWL_MSGRESULT box procedure.
0

Sets new extra information that is private to the application,


DWL_USER such as handles or pointers.
DWLP_DLGPROC + sizeof(DLGPROC)

dwNewLong

Type: LONG
The replacement value.

Return value
Type: LONG
If the function succeeds, the return value is the previous value of the specified 32-bit integer.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If the previous value of the specified 32-bit integer is zero, and the function succeeds, the return value is zero,
but the function does not clear the last error information. This makes it difficult to determine success or failure.
To deal with this, you should clear the last error information by calling SetLastError with 0 before calling
SetWindowLong . Then, function failure will be indicated by a return value of zero and a GetLastError result
that is nonzero.

Remarks
Certain window data is cached, so changes you make using SetWindowLong will not take effect until you call
the SetWindowPos function. Specifically, if you change any of the frame styles, you must call SetWindowPos
with the SWP_FRAMECHANGED flag for the cache to be updated properly.
If you use SetWindowLong with the GWL_WNDPROC index to replace the window procedure, the window
procedure must conform to the guidelines specified in the description of the WindowProc callback function.
If you use SetWindowLong with the DWL_MSGRESULT index to set the return value for a message
processed by a dialog procedure, you should return TRUE directly afterward. Otherwise, if you call any function
that results in your dialog procedure receiving a window message, the nested window message could overwrite
the return value you set using DWL_MSGRESULT .
Calling SetWindowLong with the GWL_WNDPROC index creates a subclass of the window class used to
create the window. An application can subclass a system class, but should not subclass a window class created
by another process. The SetWindowLong function creates the window subclass by changing the window
procedure associated with a particular window class, causing the system to call the new window procedure
instead of the previous one. An application must pass any messages not processed by the new window
procedure to the previous window procedure by calling CallWindowProc. This allows the application to create a
chain of window procedures.
Reserve extra window memory by specifying a nonzero value in the cbWndExtra member of the
WNDCLASSEX structure used with the RegisterClassEx function.
You must not call SetWindowLong with the GWL_HWNDPARENT index to change the parent of a child
window. Instead, use the SetParent function.
If the window has a class style of CS_CL ASSDC or CS_OWNDC , do not set the extended window styles
WS_EX_COMPOSITED or WS_EX_L AYERED .
Calling SetWindowLong to set the style on a progressbar will reset its position.
Examples
For an example, see Subclassing a Window.

NOTE
The winuser.h header defines SetWindowLong as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)
See also
CallWindowProc
Conceptual
GetWindowLong
Reference
RegisterClassEx
SetParent
SetWindowLongPtr
WNDCLASSEX
Window Classes
WindowProc
SetWindowPlacement function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Sets the show state and the restored, minimized, and maximized positions of the specified window.

Syntax
BOOL SetWindowPlacement(
HWND hWnd,
const WINDOWPLACEMENT *lpwndpl
);

Parameters
hWnd

Type: HWND
A handle to the window.
lpwndpl

Type: const WINDOWPL ACEMENT *


A pointer to a WINDOWPLACEMENT structure that specifies the new show state and window positions.
Before calling SetWindowPlacement , set the length member of the WINDOWPLACEMENT structure to
sizeof(WINDOWPL ACEMENT ). SetWindowPlacement fails if the length member is not set correctly.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
If the information specified in WINDOWPLACEMENT would result in a window that is completely off the screen,
the system will automatically adjust the coordinates so that the window is visible, taking into account changes in
screen resolution and multiple monitor configuration.
The length member of WINDOWPLACEMENT must be set to sizeof(WINDOWPLACEMENT) . If this member is not set
correctly, the function returns FALSE . For additional remarks on the proper use of window placement
coordinates, see WINDOWPL ACEMENT .

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]
Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-3 (introduced in Windows


10, version 10.0.10240)

See also
Conceptual
GetWindowPlacement
Reference
WINDOWPLACEMENT
Windows
SetWindowPos function (winuser.h)
2/1/2021 • 5 minutes to read • Edit Online

Changes the size, position, and Z order of a child, pop-up, or top-level window. These windows are ordered
according to their appearance on the screen. The topmost window receives the highest rank and is the first
window in the Z order.

Syntax
BOOL SetWindowPos(
HWND hWnd,
HWND hWndInsertAfter,
int X,
int Y,
int cx,
int cy,
UINT uFlags
);

Parameters
hWnd

Type: HWND
A handle to the window.
hWndInsertAfter

Type: HWND
A handle to the window to precede the positioned window in the Z order. This parameter must be a window
handle or one of the following values.

VA L UE M EA N IN G

Places the window at the bottom of the Z order. If the hWnd


HWND_BOTTOM parameter identifies a topmost window, the window loses its
(HWND)1 topmost status and is placed at the bottom of all other
windows.

Places the window above all non-topmost windows (that is,


HWND_NOTOPMOST behind all topmost windows). This flag has no effect if the
(HWND)-2 window is already a non-topmost window.

Places the window at the top of the Z order.


HWND_TOP
(HWND)0

Places the window above all non-topmost windows. The


HWND_TOPMOST window maintains its topmost position even when it is
(HWND)-1 deactivated.
For more information about how this parameter is used, see the following Remarks section.
X

Type: int
The new position of the left side of the window, in client coordinates.
Y

Type: int
The new position of the top of the window, in client coordinates.
cx

Type: int
The new width of the window, in pixels.
cy

Type: int
The new height of the window, in pixels.
uFlags

Type: UINT
The window sizing and positioning flags. This parameter can be a combination of the following values.

VA L UE M EA N IN G

If the calling thread and the thread that owns the window
SWP_ASYNCWINDOWPOS are attached to different input queues, the system posts the
0x4000 request to the thread that owns the window. This prevents
the calling thread from blocking its execution while other
threads process the request.

Prevents generation of the WM_SYNCPAINT message.


SWP_DEFERERASE
0x2000

Draws a frame (defined in the window's class description)


SWP_DRAWFRAME around the window.
0x0020

Applies new frame styles set using the SetWindowLong


SWP_FRAMECHANGED function. Sends a WM_NCCALCSIZE message to the window,
0x0020 even if the window's size is not being changed. If this flag is
not specified, WM_NCCALCSIZE is sent only when the
window's size is being changed.

Hides the window.


SWP_HIDEWINDOW
0x0080
Does not activate the window. If this flag is not set, the
SWP_NOACTIVATE window is activated and moved to the top of either the
0x0010 topmost or non-topmost group (depending on the setting
of the hWndInsertAfter parameter).

Discards the entire contents of the client area. If this flag is


SWP_NOCOPYBITS not specified, the valid contents of the client area are saved
0x0100 and copied back into the client area after the window is sized
or repositioned.

Retains the current position (ignores X and Y parameters).


SWP_NOMOVE
0x0002

Does not change the owner window's position in the Z order.


SWP_NOOWNERZORDER
0x0200

Does not redraw changes. If this flag is set, no repainting of


SWP_NOREDRAW any kind occurs. This applies to the client area, the nonclient
0x0008 area (including the title bar and scroll bars), and any part of
the parent window uncovered as a result of the window
being moved. When this flag is set, the application must
explicitly invalidate or redraw any parts of the window and
parent window that need redrawing.

Same as the SWP_NOOWNERZORDER flag.


SWP_NOREPOSITION
0x0200

Prevents the window from receiving the


SWP_NOSENDCHANGING WM_WINDOWPOSCHANGING message.
0x0400

Retains the current size (ignores the cx and cy parameters).


SWP_NOSIZE
0x0001

Retains the current Z order (ignores the hWndInsertAfter


SWP_NOZORDER parameter).
0x0004

Displays the window.


SWP_SHOWWINDOW
0x0040

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
As part of the Vista re-architecture, all services were moved off the interactive desktop into Session 0. hwnd and
window manager operations are only effective inside a session and cross-session attempts to manipulate the
hwnd will fail. For more information, see The Windows Vista Developer Story: Application Compatibility
Cookbook.
If you have changed certain window data using SetWindowLong, you must call SetWindowPos for the changes
to take effect. Use the following combination for uFlags:
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED .

A window can be made a topmost window either by setting the hWndInsertAfter parameter to
HWND_TOPMOST and ensuring that the SWP_NOZORDER flag is not set, or by setting a window's position
in the Z order so that it is above any existing topmost windows. When a non-topmost window is made topmost,
its owned windows are also made topmost. Its owners, however, are not changed.
If neither the SWP_NOACTIVATE nor SWP_NOZORDER flag is specified (that is, when the application
requests that a window be simultaneously activated and its position in the Z order changed), the value specified
in hWndInsertAfter is used only in the following circumstances.
Neither the HWND_TOPMOST nor HWND_NOTOPMOST flag is specified in hWndInsertAfter.
The window identified by hWnd is not the active window.
An application cannot activate an inactive window without also bringing it to the top of the Z order. Applications can
change an activated window's position in the Z order without restrictions, or it can activate a window and then
move it to the top of the topmost or non-topmost windows.
If a topmost window is repositioned to the bottom (HWND_BOTTOM ) of the Z order or after any non-topmost
window, it is no longer topmost. When a topmost window is made non-topmost, its owners and its owned
windows are also made non-topmost windows.
A non-topmost window can own a topmost window, but the reverse cannot occur. Any window (for example, a
dialog box) owned by a topmost window is itself made a topmost window, to ensure that all owned windows
stay above their owner.
If an application is not in the foreground, and should be in the foreground, it must call the
SetForegroundWindow function.
To use SetWindowPos to bring a window to the top, the process that owns the window must have
SetForegroundWindow permission.
Examples
For an example, see Initializing a Dialog Box.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib
DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
MoveWindow
Reference
SetActiveWindow
SetForegroundWindow
Windows
SetWindowsHookExA function (winuser.h)
2/1/2021 • 7 minutes to read • Edit Online

Installs an application-defined hook procedure into a hook chain. You would install a hook procedure to monitor
the system for certain types of events. These events are associated either with a specific thread or with all
threads in the same desktop as the calling thread.

Syntax
HHOOK SetWindowsHookExA(
int idHook,
HOOKPROC lpfn,
HINSTANCE hmod,
DWORD dwThreadId
);

Parameters
idHook

Type: int
The type of hook procedure to be installed. This parameter can be one of the following values.

VA L UE M EA N IN G

Installs a hook procedure that monitors messages before the


WH_CALLWNDPROC system sends them to the destination window procedure.
4 For more information, see the CallWndProc hook procedure.

Installs a hook procedure that monitors messages after they


WH_CALLWNDPROCRET have been processed by the destination window procedure.
12 For more information, see the CallWndRetProc hook
procedure.

Installs a hook procedure that receives notifications useful to


WH_CBT a CBT application. For more information, see the CBTProc
5 hook procedure.

Installs a hook procedure useful for debugging other hook


WH_DEBUG procedures. For more information, see the DebugProc hook
9 procedure.

Installs a hook procedure that will be called when the


WH_FOREGROUNDIDLE application's foreground thread is about to become idle. This
11 hook is useful for performing low priority tasks during idle
time. For more information, see the ForegroundIdleProc
hook procedure.
Installs a hook procedure that monitors messages posted to
WH_GETMESSAGE a message queue. For more information, see the
3 GetMsgProc hook procedure.

Installs a hook procedure that posts messages previously


WH_JOURNALPL AYBACK recorded by a WH_JOURNALRECORD hook procedure. For
1 more information, see the JournalPlaybackProc hook
procedure.

Installs a hook procedure that records input messages


WH_JOURNALRECORD posted to the system message queue. This hook is useful for
0 recording macros. For more information, see the
JournalRecordProc hook procedure.

Installs a hook procedure that monitors keystroke messages.


WH_KEYBOARD For more information, see the KeyboardProc hook
2 procedure.

Installs a hook procedure that monitors low-level keyboard


WH_KEYBOARD_LL input events. For more information, see the
13 LowLevelKeyboardProc hook procedure.

Installs a hook procedure that monitors mouse messages.


WH_MOUSE For more information, see the MouseProc hook procedure.
7

Installs a hook procedure that monitors low-level mouse


WH_MOUSE_LL input events. For more information, see the
14 LowLevelMouseProc hook procedure.

Installs a hook procedure that monitors messages generated


WH_MSGFILTER as a result of an input event in a dialog box, message box,
-1 menu, or scroll bar. For more information, see the
MessageProc hook procedure.

Installs a hook procedure that receives notifications useful to


WH_SHELL shell applications. For more information, see the ShellProc
10 hook procedure.

Installs a hook procedure that monitors messages generated


WH_SYSMSGFILTER as a result of an input event in a dialog box, message box,
6 menu, or scroll bar. The hook procedure monitors these
messages for all applications in the same desktop as the
calling thread. For more information, see the SysMsgProc
hook procedure.

lpfn

Type: HOOKPROC
A pointer to the hook procedure. If the dwThreadId parameter is zero or specifies the identifier of a thread
created by a different process, the lpfn parameter must point to a hook procedure in a DLL. Otherwise, lpfn can
point to a hook procedure in the code associated with the current process.
hmod

Type: HINSTANCE
A handle to the DLL containing the hook procedure pointed to by the lpfn parameter. The hMod parameter must
be set to NULL if the dwThreadId parameter specifies a thread created by the current process and if the hook
procedure is within the code associated with the current process.
dwThreadId

Type: DWORD
The identifier of the thread with which the hook procedure is to be associated. For desktop apps, if this
parameter is zero, the hook procedure is associated with all existing threads running in the same desktop as the
calling thread. For Windows Store apps, see the Remarks section.

Return value
Type: HHOOK
If the function succeeds, the return value is the handle to the hook procedure.
If the function fails, the return value is NULL . To get extended error information, call GetLastError.

Remarks
SetWindowsHookEx can be used to inject a DLL into another process. A 32-bit DLL cannot be injected into a
64-bit process, and a 64-bit DLL cannot be injected into a 32-bit process. If an application requires the use of
hooks in other processes, it is required that a 32-bit application call SetWindowsHookEx to inject a 32-bit DLL
into 32-bit processes, and a 64-bit application call SetWindowsHookEx to inject a 64-bit DLL into 64-bit
processes. The 32-bit and 64-bit DLLs must have different names.
Because hooks run in the context of an application, they must match the "bitness" of the application. If a 32-bit
application installs a global hook on 64-bit Windows, the 32-bit hook is injected into each 32-bit process (the
usual security boundaries apply). In a 64-bit process, the threads are still marked as "hooked." However, because
a 32-bit application must run the hook code, the system executes the hook in the hooking app's context;
specifically, on the thread that called SetWindowsHookEx . This means that the hooking application must
continue to pump messages or it might block the normal functioning of the 64-bit processes.
If a 64-bit application installs a global hook on 64-bit Windows, the 64-bit hook is injected into each 64-bit
process, while all 32-bit processes use a callback to the hooking application.
To hook all applications on the desktop of a 64-bit Windows installation, install a 32-bit global hook and a 64-bit
global hook, each from appropriate processes, and be sure to keep pumping messages in the hooking
application to avoid blocking normal functioning. If you already have a 32-bit global hooking application and it
doesn't need to run in each application's context, you may not need to create a 64-bit version.
An error may occur if the hMod parameter is NULL and the dwThreadId parameter is zero or specifies the
identifier of a thread created by another process.
Calling the CallNextHookEx function to chain to the next hook procedure is optional, but it is highly
recommended; otherwise, other applications that have installed hooks will not receive hook notifications and
may behave incorrectly as a result. You should call CallNextHookEx unless you absolutely need to prevent the
notification from being seen by other applications.
Before terminating, an application must call the UnhookWindowsHookEx function to free system resources
associated with the hook.
The scope of a hook depends on the hook type. Some hooks can be set only with global scope; others can also
be set for only a specific thread, as shown in the following table.
H OOK SC O P E

WH_CALLWNDPROC Thread or global

WH_CALLWNDPROCRET Thread or global

WH_CBT Thread or global

WH_DEBUG Thread or global

WH_FOREGROUNDIDLE Thread or global

WH_GETMESSAGE Thread or global

WH_JOURNALPL AYBACK Global only

WH_JOURNALRECORD Global only

WH_KEYBOARD Thread or global

WH_KEYBOARD_LL Global only

WH_MOUSE Thread or global

WH_MOUSE_LL Global only

WH_MSGFILTER Thread or global

WH_SHELL Thread or global

WH_SYSMSGFILTER Global only

For a specified hook type, thread hooks are called first, then global hooks. Be aware that the WH_MOUSE,
WH_KEYBOARD, WH_JOURNAL*, WH_SHELL, and low-level hooks can be called on the thread that installed the
hook rather than the thread processing the hook. For these hooks, it is possible that both the 32-bit and 64-bit
hooks will be called if a 32-bit hook is ahead of a 64-bit hook in the hook chain.
The global hooks are a shared resource, and installing one affects all applications in the same desktop as the
calling thread. All global hook functions must be in libraries. Global hooks should be restricted to special-
purpose applications or to use as a development aid during application debugging. Libraries that no longer
need a hook should remove its hook procedure.
Windows Store app development If dwThreadId is zero, then window hook DLLs are not loaded in-process
for the Windows Store app processes and the Windows Runtime broker process unless they are installed by
either UIAccess processes (accessibility tools). The notification is delivered on the installer's thread for these
hooks:
WH_JOURNALPLAYBACK
WH_JOURNALRECORD
WH_KEYBOARD
WH_KEYBOARD_LL
WH_MOUSE
WH_MOUSE_LL
This behavior is similar to what happens when there is an architecture mismatch between the hook DLL and the
target application process, for example, when the hook DLL is 32-bit and the application process 64-bit.
Examples
For an example, see Installing and Releasing Hook Procedures.

NOTE
The winuser.h header defines SetWindowsHookEx as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
CBTProc
CallNextHookEx
CallWndProc
CallWndRetProc
Conceptual
DebugProc
ForegroundIdleProc
GetMsgProc
Hooks
JournalPlaybackProc
JournalRecordProc
KeyboardProc
LowLevelKeyboardProc
LowLevelMouseProc
MessageProc
MouseProc
Reference
ShellProc
SysMsgProc
UnhookWindowsHookEx
SetWindowsHookExW function (winuser.h)
2/1/2021 • 7 minutes to read • Edit Online

Installs an application-defined hook procedure into a hook chain. You would install a hook procedure to monitor
the system for certain types of events. These events are associated either with a specific thread or with all
threads in the same desktop as the calling thread.

Syntax
HHOOK SetWindowsHookExW(
int idHook,
HOOKPROC lpfn,
HINSTANCE hmod,
DWORD dwThreadId
);

Parameters
idHook

Type: int
The type of hook procedure to be installed. This parameter can be one of the following values.

VA L UE M EA N IN G

Installs a hook procedure that monitors messages before the


WH_CALLWNDPROC system sends them to the destination window procedure.
4 For more information, see the CallWndProc hook procedure.

Installs a hook procedure that monitors messages after they


WH_CALLWNDPROCRET have been processed by the destination window procedure.
12 For more information, see the CallWndRetProc hook
procedure.

Installs a hook procedure that receives notifications useful to


WH_CBT a CBT application. For more information, see the CBTProc
5 hook procedure.

Installs a hook procedure useful for debugging other hook


WH_DEBUG procedures. For more information, see the DebugProc hook
9 procedure.

Installs a hook procedure that will be called when the


WH_FOREGROUNDIDLE application's foreground thread is about to become idle. This
11 hook is useful for performing low priority tasks during idle
time. For more information, see the ForegroundIdleProc
hook procedure.
Installs a hook procedure that monitors messages posted to
WH_GETMESSAGE a message queue. For more information, see the
3 GetMsgProc hook procedure.

Installs a hook procedure that posts messages previously


WH_JOURNALPL AYBACK recorded by a WH_JOURNALRECORD hook procedure. For
1 more information, see the JournalPlaybackProc hook
procedure.

Installs a hook procedure that records input messages


WH_JOURNALRECORD posted to the system message queue. This hook is useful for
0 recording macros. For more information, see the
JournalRecordProc hook procedure.

Installs a hook procedure that monitors keystroke messages.


WH_KEYBOARD For more information, see the KeyboardProc hook
2 procedure.

Installs a hook procedure that monitors low-level keyboard


WH_KEYBOARD_LL input events. For more information, see the
13 LowLevelKeyboardProc hook procedure.

Installs a hook procedure that monitors mouse messages.


WH_MOUSE For more information, see the MouseProc hook procedure.
7

Installs a hook procedure that monitors low-level mouse


WH_MOUSE_LL input events. For more information, see the
14 LowLevelMouseProc hook procedure.

Installs a hook procedure that monitors messages generated


WH_MSGFILTER as a result of an input event in a dialog box, message box,
-1 menu, or scroll bar. For more information, see the
MessageProc hook procedure.

Installs a hook procedure that receives notifications useful to


WH_SHELL shell applications. For more information, see the ShellProc
10 hook procedure.

Installs a hook procedure that monitors messages generated


WH_SYSMSGFILTER as a result of an input event in a dialog box, message box,
6 menu, or scroll bar. The hook procedure monitors these
messages for all applications in the same desktop as the
calling thread. For more information, see the SysMsgProc
hook procedure.

lpfn

Type: HOOKPROC
A pointer to the hook procedure. If the dwThreadId parameter is zero or specifies the identifier of a thread
created by a different process, the lpfn parameter must point to a hook procedure in a DLL. Otherwise, lpfn can
point to a hook procedure in the code associated with the current process.
hmod

Type: HINSTANCE
A handle to the DLL containing the hook procedure pointed to by the lpfn parameter. The hMod parameter must
be set to NULL if the dwThreadId parameter specifies a thread created by the current process and if the hook
procedure is within the code associated with the current process.
dwThreadId

Type: DWORD
The identifier of the thread with which the hook procedure is to be associated. For desktop apps, if this
parameter is zero, the hook procedure is associated with all existing threads running in the same desktop as the
calling thread. For Windows Store apps, see the Remarks section.

Return value
Type: HHOOK
If the function succeeds, the return value is the handle to the hook procedure.
If the function fails, the return value is NULL . To get extended error information, call GetLastError.

Remarks
SetWindowsHookEx can be used to inject a DLL into another process. A 32-bit DLL cannot be injected into a
64-bit process, and a 64-bit DLL cannot be injected into a 32-bit process. If an application requires the use of
hooks in other processes, it is required that a 32-bit application call SetWindowsHookEx to inject a 32-bit DLL
into 32-bit processes, and a 64-bit application call SetWindowsHookEx to inject a 64-bit DLL into 64-bit
processes. The 32-bit and 64-bit DLLs must have different names.
Because hooks run in the context of an application, they must match the "bitness" of the application. If a 32-bit
application installs a global hook on 64-bit Windows, the 32-bit hook is injected into each 32-bit process (the
usual security boundaries apply). In a 64-bit process, the threads are still marked as "hooked." However, because
a 32-bit application must run the hook code, the system executes the hook in the hooking app's context;
specifically, on the thread that called SetWindowsHookEx . This means that the hooking application must
continue to pump messages or it might block the normal functioning of the 64-bit processes.
If a 64-bit application installs a global hook on 64-bit Windows, the 64-bit hook is injected into each 64-bit
process, while all 32-bit processes use a callback to the hooking application.
To hook all applications on the desktop of a 64-bit Windows installation, install a 32-bit global hook and a 64-bit
global hook, each from appropriate processes, and be sure to keep pumping messages in the hooking
application to avoid blocking normal functioning. If you already have a 32-bit global hooking application and it
doesn't need to run in each application's context, you may not need to create a 64-bit version.
An error may occur if the hMod parameter is NULL and the dwThreadId parameter is zero or specifies the
identifier of a thread created by another process.
Calling the CallNextHookEx function to chain to the next hook procedure is optional, but it is highly
recommended; otherwise, other applications that have installed hooks will not receive hook notifications and
may behave incorrectly as a result. You should call CallNextHookEx unless you absolutely need to prevent the
notification from being seen by other applications.
Before terminating, an application must call the UnhookWindowsHookEx function to free system resources
associated with the hook.
The scope of a hook depends on the hook type. Some hooks can be set only with global scope; others can also
be set for only a specific thread, as shown in the following table.
H OOK SC O P E

WH_CALLWNDPROC Thread or global

WH_CALLWNDPROCRET Thread or global

WH_CBT Thread or global

WH_DEBUG Thread or global

WH_FOREGROUNDIDLE Thread or global

WH_GETMESSAGE Thread or global

WH_JOURNALPL AYBACK Global only

WH_JOURNALRECORD Global only

WH_KEYBOARD Thread or global

WH_KEYBOARD_LL Global only

WH_MOUSE Thread or global

WH_MOUSE_LL Global only

WH_MSGFILTER Thread or global

WH_SHELL Thread or global

WH_SYSMSGFILTER Global only

For a specified hook type, thread hooks are called first, then global hooks. Be aware that the WH_MOUSE,
WH_KEYBOARD, WH_JOURNAL*, WH_SHELL, and low-level hooks can be called on the thread that installed the
hook rather than the thread processing the hook. For these hooks, it is possible that both the 32-bit and 64-bit
hooks will be called if a 32-bit hook is ahead of a 64-bit hook in the hook chain.
The global hooks are a shared resource, and installing one affects all applications in the same desktop as the
calling thread. All global hook functions must be in libraries. Global hooks should be restricted to special-
purpose applications or to use as a development aid during application debugging. Libraries that no longer
need a hook should remove its hook procedure.
Windows Store app development If dwThreadId is zero, then window hook DLLs are not loaded in-process
for the Windows Store app processes and the Windows Runtime broker process unless they are installed by
either UIAccess processes (accessibility tools). The notification is delivered on the installer's thread for these
hooks:
WH_JOURNALPLAYBACK
WH_JOURNALRECORD
WH_KEYBOARD
WH_KEYBOARD_LL
WH_MOUSE
WH_MOUSE_LL
This behavior is similar to what happens when there is an architecture mismatch between the hook DLL and the
target application process, for example, when the hook DLL is 32-bit and the application process 64-bit.
Examples
For an example, see Installing and Releasing Hook Procedures.

NOTE
The winuser.h header defines SetWindowsHookEx as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
CBTProc
CallNextHookEx
CallWndProc
CallWndRetProc
Conceptual
DebugProc
ForegroundIdleProc
GetMsgProc
Hooks
JournalPlaybackProc
JournalRecordProc
KeyboardProc
LowLevelKeyboardProc
LowLevelMouseProc
MessageProc
MouseProc
Reference
ShellProc
SysMsgProc
UnhookWindowsHookEx
SetWindowTextA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Changes the text of the specified window's title bar (if it has one). If the specified window is a control, the text of
the control is changed. However, SetWindowText cannot change the text of a control in another application.

Syntax
BOOL SetWindowTextA(
HWND hWnd,
LPCSTR lpString
);

Parameters
hWnd

Type: HWND
A handle to the window or control whose text is to be changed.
lpString

Type: LPCTSTR
The new title or control text.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
If the target window is owned by the current process, SetWindowText causes a WM_SETTEXT message to be
sent to the specified window or control. If the control is a list box control created with the WS_CAPTION style,
however, SetWindowText sets the text for the control, not for the list box entries.
To set the text of a control in another process, send the WM_SETTEXT message directly instead of calling
SetWindowText .
The SetWindowText function does not expand tab characters (ASCII code 0x09). Tab characters are displayed as
vertical bar (|) characters.
Examples
For an example, see Sending a Message.
NOTE
The winuser.h header defines SetWindowText as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-3 (introduced in Windows


10, version 10.0.10240)

See also
Conceptual
GetWindowText
Reference
WM_SETTEXT
Windows
SetWindowTextW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Changes the text of the specified window's title bar (if it has one). If the specified window is a control, the text of
the control is changed. However, SetWindowText cannot change the text of a control in another application.

Syntax
BOOL SetWindowTextW(
HWND hWnd,
LPCWSTR lpString
);

Parameters
hWnd

Type: HWND
A handle to the window or control whose text is to be changed.
lpString

Type: LPCTSTR
The new title or control text.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
If the target window is owned by the current process, SetWindowText causes a WM_SETTEXT message to be
sent to the specified window or control. If the control is a list box control created with the WS_CAPTION style,
however, SetWindowText sets the text for the control, not for the list box entries.
To set the text of a control in another process, send the WM_SETTEXT message directly instead of calling
SetWindowText .
The SetWindowText function does not expand tab characters (ASCII code 0x09). Tab characters are displayed as
vertical bar (|) characters.
Examples
For an example, see Sending a Message.
NOTE
The winuser.h header defines SetWindowText as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-3 (introduced in Windows


10, version 10.0.10240)

See also
Conceptual
GetWindowText
Reference
WM_SETTEXT
Windows
ShowOwnedPopups function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Shows or hides all pop-up windows owned by the specified window.

Syntax
BOOL ShowOwnedPopups(
HWND hWnd,
BOOL fShow
);

Parameters
hWnd

Type: HWND
A handle to the window that owns the pop-up windows to be shown or hidden.
fShow

Type: BOOL
If this parameter is TRUE , all hidden pop-up windows are shown. If this parameter is FALSE , all visible pop-up
windows are hidden.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
ShowOwnedPopups shows only windows hidden by a previous call to ShowOwnedPopups . For example, if
a pop-up window is hidden by using the ShowWindow function, subsequently calling ShowOwnedPopups
with the fShow parameter set to TRUE does not cause the window to be shown.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows


Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-3 (introduced in Windows


10, version 10.0.10240)

See also
Conceptual
IsWindowVisible
Reference
ShowWindow
Windows
ShowWindow function (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Sets the specified window's show state.

Syntax
BOOL ShowWindow(
HWND hWnd,
int nCmdShow
);

Parameters
hWnd

Type: HWND
A handle to the window.
nCmdShow

Type: int
Controls how the window is to be shown. This parameter is ignored the first time an application calls
ShowWindow , if the program that launched the application provides a STARTUPINFO structure. Otherwise, the
first time ShowWindow is called, the value should be the value obtained by the WinMain function in its
nCmdShow parameter. In subsequent calls, this parameter can be one of the following values.

VA L UE M EA N IN G

Minimizes a window, even if the thread that owns the


SW_FORCEMINIMIZE window is not responding. This flag should only be used
11 when minimizing windows from a different thread.

Hides the window and activates another window.


SW_HIDE
0

Maximizes the specified window.


SW_MAXIMIZE
3

Minimizes the specified window and activates the next top-


SW_MINIMIZE level window in the Z order.
6

Activates and displays the window. If the window is


SW_RESTORE minimized or maximized, the system restores it to its original
9 size and position. An application should specify this flag
when restoring a minimized window.
Activates the window and displays it in its current size and
SW_SHOW position.
5

Sets the show state based on the SW_ value specified in the
SW_SHOWDEFAULT STARTUPINFO structure passed to the CreateProcess
10 function by the program that started the application.

Activates the window and displays it as a maximized window.


SW_SHOWMAXIMIZED
3

Activates the window and displays it as a minimized window.


SW_SHOWMINIMIZED
2

Displays the window as a minimized window. This value is


SW_SHOWMINNOACTIVE similar to SW_SHOWMINIMIZED , except the window is
7 not activated.

Displays the window in its current size and position. This


SW_SHOWNA value is similar to SW_SHOW , except that the window is not
8 activated.

Displays a window in its most recent size and position. This


SW_SHOWNOACTIVATE value is similar to SW_SHOWNORMAL , except that the
4 window is not activated.

Activates and displays a window. If the window is minimized


SW_SHOWNORMAL or maximized, the system restores it to its original size and
1 position. An application should specify this flag when
displaying the window for the first time.

Return value
Type: BOOL
If the window was previously visible, the return value is nonzero.
If the window was previously hidden, the return value is zero.

Remarks
To perform certain special effects when showing or hiding a window, use AnimateWindow.
The first time an application calls ShowWindow , it should use the WinMain function's nCmdShow parameter as
its nCmdShow parameter. Subsequent calls to ShowWindow must use one of the values in the given list,
instead of the one specified by the WinMain function's nCmdShow parameter.
As noted in the discussion of the nCmdShow parameter, the nCmdShow value is ignored in the first call to
ShowWindow if the program that launched the application specifies startup information in the structure. In
this case, ShowWindow uses the information specified in the STARTUPINFO structure to show the window. On
subsequent calls, the application must call ShowWindow with nCmdShow set to SW_SHOWDEFAULT to use
the startup information provided by the program that launched the application. This behavior is designed for
the following situations:
Applications create their main window by calling CreateWindow with the WS_VISIBLE flag set.
Applications create their main window by calling CreateWindow with the WS_VISIBLE flag cleared, and later
call ShowWindow with the SW_SHOW flag set to make it visible.
Examples
For an example, see Creating a Main Window.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
AnimateWindow
Conceptual
CreateProcess
CreateWindow
Other Resources
Reference
STARTUPINFO
ShowOwnedPopups
ShowWindowAsync
WinMain
Windows
ShowWindowAsync function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Sets the show state of a window without waiting for the operation to complete.

Syntax
BOOL ShowWindowAsync(
HWND hWnd,
int nCmdShow
);

Parameters
hWnd

Type: HWND
A handle to the window.
nCmdShow

Type: int
Controls how the window is to be shown. For a list of possible values, see the description of the ShowWindow
function.

Return value
Type: BOOL
If the operation was successfully started, the return value is nonzero.

Remarks
This function posts a show-window event to the message queue of the given window. An application can use
this function to avoid becoming nonresponsive while waiting for a nonresponsive application to finish
processing a show-window event.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)


Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows


10, version 10.0.14393)

See also
Conceptual
Reference
ShowWindow
Windows
SoundSentry function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Triggers a visual signal to indicate that a sound is playing.

Syntax
BOOL SoundSentry();

Parameters
This function has no parameters.

Return value
Type: BOOL
This function returns one of the following values.

RET URN C O DE DESC RIP T IO N

The visual signal was or will be displayed correctly.


TRUE

An error prevented the signal from being displayed.


FALSE

Remarks
Set the notification behavior by calling SystemParametersInfo with the SPI_SETSOUNDSENTRY value.

Requirements

Minimum suppor ted client Windows Vista [desktop apps only]

Minimum suppor ted ser ver Windows Server 2008 [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll
API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows
8)

See also
Reference
SOUNDSENTRY
SoundSentryProc
STYLESTRUCT structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains the styles for a window.

Syntax
typedef struct tagSTYLESTRUCT {
DWORD styleOld;
DWORD styleNew;
} STYLESTRUCT, *LPSTYLESTRUCT;

Members
styleOld

Type: DWORD
The previous styles for a window. For more information, see the Remarks.
styleNew

Type: DWORD
The new styles for a window. For more information, see the Remarks.

Remarks
The styles in styleOld and styleNew can be either the window styles (WS_ ) or the extended window styles
(WS_EX_ ), depending on the wParam of the message that includes STYLESTRUCT .
The styleOld and styleNew members indicate the styles through their bit pattern. Note that several styles are
equal to zero; to detect these styles, test for the negation of their inverse style. For example, to see if
WS_EX_LEFT is set, you test for ~WS_EX_RIGHT .

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
Conceptual
Reference
WM_STYLECHANGED
WM_STYLECHANGING
Windows
SwitchToThisWindow function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

[This function is not intended for general use. It may be altered or unavailable in subsequent versions of
Windows.]
Switches focus to the specified window and brings it to the foreground.

Syntax
void SwitchToThisWindow(
HWND hwnd,
BOOL fUnknown
);

Parameters
hwnd

Type: HWND
A handle to the window.
fUnknown

Type: BOOL
A TRUE for this parameter indicates that the window is being switched to using the Alt/Ctl+Tab key sequence.
This parameter should be FALSE otherwise.

Return value
None

Remarks
This function is typically called to maintain window z-ordering.
This function was not included in the SDK headers and libraries until Windows XP with Service Pack 1 (SP1) and
Windows Server 2003. If you do not have a header file and import library for this function, you can call the
function using LoadLibrary and GetProcAddress.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows


Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows


10, version 10.0.14393)

See also
Conceptual
IsWindowVisible
Reference
ShowWindow
Windows
SystemParametersInfoA function (winuser.h)
2/1/2021 • 55 minutes to read • Edit Online

Retrieves or sets the value of one of the system-wide parameters. This function can also update the user profile
while setting a parameter.

Syntax
BOOL SystemParametersInfoA(
UINT uiAction,
UINT uiParam,
PVOID pvParam,
UINT fWinIni
);

Parameters
uiAction

Type: UINT
The system-wide parameter to be retrieved or set. The possible values are organized in the following tables of
related parameters:
Accessibility parameters
Desktop parameters
Icon parameters
Input parameters
Menu parameters
Power parameters
Screen saver parameters
Time-out parameters
UI effect parameters
Window parameters
The following are the accessibility parameters.

A C C ESSIB IL IT Y PA RA M ET ER M EA N IN G

Retrieves information about the time-out period associated


SPI_GETACCESSTIMEOUT with the accessibility features. The pvParam parameter must
0x003C point to an ACCESSTIMEOUT structure that receives the
information. Set the cbSize member of this structure and
the uiParam parameter to sizeof(ACCESSTIMEOUT) .
Determines whether audio descriptions are enabled or
SPI_GETAUDIODESCRIPTION disabled. The pvParam parameter is a pointer to an
0x0074 AUDIODESCRIPTION structure. Set the cbSize member of
this structure and the uiParam parameter to
sizeof(AUDIODESCRIPTION) .
While it is possible for users who have visual
impairments to hear the audio in video content, there is
a lot of action in video that does not have
corresponding audio. Specific audio description of what
is happening in a video helps these users understand
the content better. This flag enables you to determine
whether audio descriptions have been enabled and in
which language.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.

Determines whether animations are enabled or disabled. The


SPI_GETCLIENTAREAANIMATION pvParam parameter must point to a BOOL variable that
0x1042 receives TRUE if animations are enabled, or FALSE
otherwise.
Display features such as flashing, blinking, flickering, and
moving content can cause seizures in users with photo-
sensitive epilepsy. This flag enables you to determine
whether such animations have been disabled in the
client area.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.

Determines whether overlapped content is enabled or


SPI_GETDISABLEOVERL APPEDCONTENT disabled. The pvParam parameter must point to a BOOL
0x1040 variable that receives TRUE if enabled, or FALSE otherwise.
Display features such as background images, textured
backgrounds, water marks on documents, alpha
blending, and transparency can reduce the contrast
between the foreground and background, making it
harder for users with low vision to see objects on the
screen. This flag enables you to determine whether such
overlapped content has been disabled.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.

Retrieves information about the FilterKeys accessibility


SPI_GETFILTERKEYS feature. The pvParam parameter must point to a FILTERKEYS
0x0032 structure that receives the information. Set the cbSize
member of this structure and the uiParam parameter to
sizeof(FILTERKEYS) .

Retrieves the height, in pixels, of the top and bottom edges


SPI_GETFOCUSBORDERHEIGHT of the focus rectangle drawn with DrawFocusRect. The
0x2010 pvParam parameter must point to a UINT value.
Windows 2000: This parameter is not supported.
Retrieves the width, in pixels, of the left and right edges of
SPI_GETFOCUSBORDERWIDTH the focus rectangle drawn with DrawFocusRect. The pvParam
0x200E parameter must point to a UINT .
Windows 2000: This parameter is not supported.

Retrieves information about the HighContrast accessibility


SPI_GETHIGHCONTRAST feature. The pvParam parameter must point to a
0x0042 HIGHCONTRAST structure that receives the information. Set
the cbSize member of this structure and the uiParam
parameter to sizeof(HIGHCONTRAST) .
For a general discussion, see Remarks.

Retrieves a value that determines whether Windows 8 is


SPI_GETLOGICALDPIOVERRIDE displaying apps using the default scaling plateau for the
0x009E hardware or going to the next higher plateau. This value is
based on the current "Make everything on your screen
bigger" setting, found in the Ease of Access section of PC
settings : 1 is on, 0 is off.
Apps can provide text and image resources for each of
several scaling plateaus: 100%, 140%, and 180%.
Providing separate resources optimized for a particular
scale avoids distortion due to resizing. Windows 8
determines the appropriate scaling plateau based on a
number of factors, including screen size and pixel
density. When "Make everything on your screen bigger"
is selected (SPI_GETLOGICALDPIOVERRIDE returns a
value of 1), Windows uses resources from the next
higher plateau. For example, in the case of hardware that
Windows determines should use a scale of
SCALE_100_PERCENT, this override causes Windows to
use the SCALE_140_PERCENT scale value, assuming that
it does not violate other constraints.

Note You should not use this value. It might be altered or


unavailable in subsequent versions of Windows. Instead,
use the GetScaleFactorForDevice function or the
DisplayProperties class to retrieve the preferred scaling
factor. Desktop applications should use desktop logical DPI
rather than scale factor. Desktop logical DPI can be
retrieved through the GetDeviceCaps function.

Retrieves the time that notification pop-ups should be


SPI_GETMESSAGEDURATION displayed, in seconds. The pvParam parameter must point to
0x2016 a ULONG that receives the message duration.
Users with visual impairments or cognitive conditions
such as ADHD and dyslexia might need a longer time to
read the text in notification messages. This flag enables
you to retrieve the message duration.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.
Retrieves the state of the Mouse ClickLock feature. The
SPI_GETMOUSECLICKLOCK pvParam parameter must point to a BOOL variable that
0x101E receives TRUE if enabled, or FALSE otherwise. For more
information, see About Mouse Input.
Windows 2000: This parameter is not supported.

Retrieves the time delay before the primary mouse button is


SPI_GETMOUSECLICKLOCKTIME locked. The pvParam parameter must point to DWORD that
0x2008 receives the time delay, in milliseconds. This is only enabled if
SPI_SETMOUSECLICKLOCK is set to TRUE . For more
information, see About Mouse Input.
Windows 2000: This parameter is not supported.

Retrieves information about the MouseKeys accessibility


SPI_GETMOUSEKEYS feature. The pvParam parameter must point to a
0x0036 MOUSEKEYS structure that receives the information. Set the
cbSize member of this structure and the uiParam parameter
to sizeof(MOUSEKEYS) .

Retrieves the state of the Mouse Sonar feature. The pvParam


SPI_GETMOUSESONAR parameter must point to a BOOL variable that receives
0x101C TRUE if enabled or FALSE otherwise. For more information,
see About Mouse Input.
Windows 2000: This parameter is not supported.

Retrieves the state of the Mouse Vanish feature. The


SPI_GETMOUSEVANISH pvParam parameter must point to a BOOL variable that
0x1020 receives TRUE if enabled or FALSE otherwise. For more
information, see About Mouse Input.
Windows 2000: This parameter is not supported.

Determines whether a screen reviewer utility is running. A


SPI_GETSCREENREADER screen reviewer utility directs textual information to an
0x0046 output device, such as a speech synthesizer or Braille display.
When this flag is set, an application should provide textual
information in situations where it would otherwise present
the information graphically.
The pvParam parameter is a pointer to a BOOL variable
that receives TRUE if a screen reviewer utility is running,
or FALSE otherwise.

Note Narrator, the screen reader that is included with


Windows, does not set the SPI_SETSCREENREADER or
SPI_GETSCREENREADER flags.

This parameter is not supported.


SPI_GETSERIALKEYS
Windows Ser ver 2003 and
0x003E
Windows XP/2000: The user should control this
setting through the Control Panel.
Determines whether the Show Sounds accessibility flag is on
SPI_GETSHOWSOUNDS or off. If it is on, the user requires an application to present
0x0038 information visually in situations where it would otherwise
present the information only in audible form. The pvParam
parameter must point to a BOOL variable that receives
TRUE if the feature is on, or FALSE if it is off.
Using this value is equivalent to calling
GetSystemMetrics with SM_SHOWSOUNDS. That is
the recommended call.

Retrieves information about the SoundSentry accessibility


SPI_GETSOUNDSENTRY feature. The pvParam parameter must point to a
0x0040 SOUNDSENTRY structure that receives the information. Set
the cbSize member of this structure and the uiParam
parameter to sizeof(SOUNDSENTRY) .

Retrieves information about the StickyKeys accessibility


SPI_GETSTICKYKEYS feature. The pvParam parameter must point to a
0x003A STICKYKEYS structure that receives the information. Set the
cbSize member of this structure and the uiParam parameter
to sizeof(STICKYKEYS) .

Retrieves information about the ToggleKeys accessibility


SPI_GETTOGGLEKEYS feature. The pvParam parameter must point to a
0x0034 TOGGLEKEYS structure that receives the information. Set the
cbSize member of this structure and the uiParam parameter
to sizeof(TOGGLEKEYS) .

Sets the time-out period associated with the accessibility


SPI_SETACCESSTIMEOUT features. The pvParam parameter must point to an
0x003D ACCESSTIMEOUT structure that contains the new
parameters. Set the cbSize member of this structure and
the uiParam parameter to sizeof(ACCESSTIMEOUT) .

Turns the audio descriptions feature on or off. The pvParam


SPI_SETAUDIODESCRIPTION parameter is a pointer to an AUDIODESCRIPTION structure.
0x0075
While it is possible for users who are visually impaired to
hear the audio in video content, there is a lot of action in
video that does not have corresponding audio. Specific
audio description of what is happening in a video helps
these users understand the content better. This flag
enables you to enable or disable audio descriptions in
the languages they are provided in.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.

Turns client area animations on or off. The pvParam


SPI_SETCLIENTAREAANIMATION parameter is a BOOL variable. Set pvParam to TRUE to
0x1043 enable animations and other transient effects in the client
area, or FALSE to disable them.
Display features such as flashing, blinking, flickering, and
moving content can cause seizures in users with photo-
sensitive epilepsy. This flag enables you to enable or
disable all such animations.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.
Turns overlapped content (such as background images and
SPI_SETDISABLEOVERL APPEDCONTENT watermarks) on or off. The pvParam parameter is a BOOL
0x1041 variable. Set pvParam to TRUE to disable overlapped
content, or FALSE to enable overlapped content.
Display features such as background images, textured
backgrounds, water marks on documents, alpha
blending, and transparency can reduce the contrast
between the foreground and background, making it
harder for users with low vision to see objects on the
screen. This flag enables you to enable or disable all such
overlapped content.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.

Sets the parameters of the FilterKeys accessibility feature.


SPI_SETFILTERKEYS The pvParam parameter must point to a FILTERKEYS
0x0033 structure that contains the new parameters. Set the cbSize
member of this structure and the uiParam parameter to
sizeof(FILTERKEYS) .

Sets the height of the top and bottom edges of the focus
SPI_SETFOCUSBORDERHEIGHT rectangle drawn with DrawFocusRect to the value of the
0x2011 pvParam parameter.
Windows 2000: This parameter is not supported.

Sets the height of the left and right edges of the focus
SPI_SETFOCUSBORDERWIDTH rectangle drawn with DrawFocusRect to the value of the
0x200F pvParam parameter.
Windows 2000: This parameter is not supported.

Sets the parameters of the HighContrast accessibility feature.


SPI_SETHIGHCONTRAST The pvParam parameter must point to a HIGHCONTRAST
0x0043 structure that contains the new parameters. Set the cbSize
member of this structure and the uiParam parameter to
sizeof(HIGHCONTRAST) .

Do not use.
SPI_SETLOGICALDPIOVERRIDE
0x009F

Sets the time that notification pop-ups should be displayed,


SPI_SETMESSAGEDURATION in seconds. The pvParam parameter specifies the message
0x2017 duration.
Users with visual impairments or cognitive conditions
such as ADHD and dyslexia might need a longer time to
read the text in notification messages. This flag enables
you to set the message duration.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.
Turns the Mouse ClickLock accessibility feature on or off. This
SPI_SETMOUSECLICKLOCK feature temporarily locks down the primary mouse button
0x101F when that button is clicked and held down for the time
specified by SPI_SETMOUSECLICKLOCKTIME . The
pvParam parameter specifies TRUE for on, or FALSE for off.
The default is off. For more information, see Remarks and
AboutMouse Input.
Windows 2000: This parameter is not supported.

Adjusts the time delay before the primary mouse button is


SPI_SETMOUSECLICKLOCKTIME locked. The uiParam parameter should be set to 0. The
0x2009 pvParam parameter points to a DWORD that specifies the
time delay in milliseconds. For example, specify 1000 for a 1
second delay. The default is 1200. For more information, see
About Mouse Input.
Windows 2000: This parameter is not supported.

Sets the parameters of the MouseKeys accessibility feature.


SPI_SETMOUSEKEYS The pvParam parameter must point to a MOUSEKEYS
0x0037 structure that contains the new parameters. Set the cbSize
member of this structure and the uiParam parameter to
sizeof(MOUSEKEYS) .

Turns the Sonar accessibility feature on or off. This feature


SPI_SETMOUSESONAR briefly shows several concentric circles around the mouse
0x101D pointer when the user presses and releases the CTRL key.
The pvParam parameter specifies TRUE for on and FALSE
for off. The default is off. For more information, see About
Mouse Input.
Windows 2000: This parameter is not supported.

Turns the Vanish feature on or off. This feature hides the


SPI_SETMOUSEVANISH mouse pointer when the user types; the pointer reappears
0x1021 when the user moves the mouse. The pvParam parameter
specifies TRUE for on and FALSE for off. The default is off.
For more information, see About Mouse Input.
Windows 2000: This parameter is not supported.

Determines whether a screen review utility is running. The


SPI_SETSCREENREADER uiParam parameter specifies TRUE for on, or FALSE for off.
0x0047
Note Narrator, the screen reader that is included with
Windows, does not set the SPI_SETSCREENREADER or
SPI_GETSCREENREADER flags.

This parameter is not supported.


SPI_SETSERIALKEYS
Windows Ser ver 2003 and
0x003F
Windows XP/2000: The user should control this
setting through the Control Panel.

Turns the ShowSounds accessibility feature on or off. The


SPI_SETSHOWSOUNDS uiParam parameter specifies TRUE for on, or FALSE for off.
0x0039
Sets the parameters of the SoundSentr y accessibility
SPI_SETSOUNDSENTRY feature. The pvParam parameter must point to a
0x0041 SOUNDSENTRY structure that contains the new parameters.
Set the cbSize member of this structure and the uiParam
parameter to sizeof(SOUNDSENTRY) .

Sets the parameters of the StickyKeys accessibility feature.


SPI_SETSTICKYKEYS The pvParam parameter must point to a STICKYKEYS
0x003B structure that contains the new parameters. Set the cbSize
member of this structure and the uiParam parameter to
sizeof(STICKYKEYS) .

Sets the parameters of the ToggleKeys accessibility feature.


SPI_SETTOGGLEKEYS The pvParam parameter must point to a TOGGLEKEYS
0x0035 structure that contains the new parameters. Set the cbSize
member of this structure and the uiParam parameter to
sizeof(TOGGLEKEYS) .

The following are the desktop parameters.

DESK TO P PA RA M ET ER M EA N IN G

Determines whether ClearType is enabled. The pvParam


SPI_GETCLEARTYPE parameter must point to a BOOL variable that receives
0x1048 TRUE if ClearType is enabled, or FALSE otherwise.
ClearType is a software technology that improves the
readability of text on liquid crystal display (LCD)
monitors.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.

Retrieves the full path of the bitmap file for the desktop
SPI_GETDESKWALLPAPER wallpaper. The pvParam parameter must point to a buffer to
0x0073 receive the null-terminated path string. Set the uiParam
parameter to the size, in characters, of the pvParam buffer.
The returned string will not exceed MAX_PATH characters. If
there is no desktop wallpaper, the returned string is empty.

Determines whether the drop shadow effect is enabled. The


SPI_GETDROPSHADOW pvParam parameter must point to a BOOL variable that
0x1024 returns TRUE if enabled or FALSE if disabled.
Windows 2000: This parameter is not supported.

Determines whether native User menus have flat menu


SPI_GETFL ATMENU appearance. The pvParam parameter must point to a BOOL
0x1022 variable that returns TRUE if the flat menu appearance is
set, or FALSE otherwise.
Windows 2000: This parameter is not supported.
Determines whether the font smoothing feature is enabled.
SPI_GETFONTSMOOTHING This feature uses font antialiasing to make font curves
0x004A appear smoother by painting pixels at different gray levels.
The pvParam parameter must point to a BOOL variable
that receives TRUE if the feature is enabled, or FALSE if
it is not.

Retrieves a contrast value that is used in ClearType


SPI_GETFONTSMOOTHINGCONTRAST smoothing. The pvParam parameter must point to a UINT
0x200C that receives the information. Valid contrast values are from
1000 to 2200. The default value is 1400.
Windows 2000: This parameter is not supported.

Retrieves the font smoothing orientation. The pvParam


SPI_GETFONTSMOOTHINGORIENTATION parameter must point to a UINT that receives the
0x2012 information. The possible values are
FE_FONTSMOOTHINGORIENTATIONBGR (blue-green-
red) and FE_FONTSMOOTHINGORIENTATIONRGB (red-
green-blue).
Windows XP/2000: This parameter is not supported
until Windows XP with SP2.

Retrieves the type of font smoothing. The pvParam


SPI_GETFONTSMOOTHINGTYPE parameter must point to a UINT that receives the
0x200A information. The possible values are
FE_FONTSMOOTHINGSTANDARD and
FE_FONTSMOOTHINGCLEARTYPE .
Windows 2000: This parameter is not supported.

Retrieves the size of the work area on the primary display


SPI_GETWORKAREA monitor. The work area is the portion of the screen not
0x0030 obscured by the system taskbar or by application desktop
toolbars. The pvParam parameter must point to a RECT
structure that receives the coordinates of the work area,
expressed in physical pixel size. Any DPI virtualization mode
of the caller has no effect on this output.
To get the work area of a monitor other than the
primary display monitor, call the GetMonitorInfo
function.

Turns ClearType on or off. The pvParam parameter is a


SPI_SETCLEARTYPE BOOL variable. Set pvParam to TRUE to enable ClearType,
0x1049 or FALSE to disable it.
ClearType is a software technology that improves the
readability of text on LCD monitors.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.

Reloads the system cursors. Set the uiParam parameter to


SPI_SETCURSORS zero and the pvParam parameter to NULL .
0x0057
Sets the current desktop pattern by causing Windows to
SPI_SETDESKPATTERN read the Pattern= setting from the WIN.INI file.
0x0015

SPI_SETDESKWALLPAPER Note When the SPI_SETDESKWALLPAPER flag is used,


0x0014 SystemParametersInfo returns TRUE unless there is an
error (like when the specified file doesn't exist).

Enables or disables the drop shadow effect. Set pvParam to


SPI_SETDROPSHADOW TRUE to enable the drop shadow effect or FALSE to disable
0x1025 it. You must also have CS_DROPSHADOW in the window
class style.
Windows 2000: This parameter is not supported.

Enables or disables flat menu appearance for native User


SPI_SETFL ATMENU menus. Set pvParam to TRUE to enable flat menu
0x1023 appearance or FALSE to disable it.
When enabled, the menu bar uses COLOR_MENUBAR
for the menubar background, COLOR_MENU for the
menu-popup background, COLOR_MENUHILIGHT for
the fill of the current menu selection, and
COLOR_HILIGHT for the outline of the current menu
selection. If disabled, menus are drawn using the same
metrics and colors as in Windows 2000.
Windows 2000: This parameter is not supported.

Enables or disables the font smoothing feature, which uses


SPI_SETFONTSMOOTHING font antialiasing to make font curves appear smoother by
0x004B painting pixels at different gray levels.
To enable the feature, set the uiParam parameter to
TRUE . To disable the feature, set uiParam to FALSE .

Sets the contrast value used in ClearType smoothing. The


SPI_SETFONTSMOOTHINGCONTRAST pvParam parameter is the contrast value. Valid contrast
0x200D values are from 1000 to 2200. The default value is 1400.
SPI_SETFONTSMOOTHINGTYPE must also be set to
FE_FONTSMOOTHINGCLEARTYPE .
Windows 2000: This parameter is not supported.

Sets the font smoothing orientation. The pvParam


SPI_SETFONTSMOOTHINGORIENTATION parameter is either
0x2013 FE_FONTSMOOTHINGORIENTATIONBGR (blue-green-
red) or FE_FONTSMOOTHINGORIENTATIONRGB (red-
green-blue).
Windows XP/2000: This parameter is not supported
until Windows XP with SP2.
Sets the font smoothing type. The pvParam parameter is
SPI_SETFONTSMOOTHINGTYPE either FE_FONTSMOOTHINGSTANDARD , if standard
0x200B anti-aliasing is used, or
FE_FONTSMOOTHINGCLEARTYPE , if ClearType is used.
The default is FE_FONTSMOOTHINGSTANDARD .
SPI_SETFONTSMOOTHING must also be set.
Windows 2000: This parameter is not supported.

Sets the size of the work area. The work area is the portion
SPI_SETWORKAREA of the screen not obscured by the system taskbar or by
0x002F application desktop toolbars. The pvParam parameter is a
pointer to a RECT structure that specifies the new work area
rectangle, expressed in virtual screen coordinates. In a
system with multiple display monitors, the function sets the
work area of the monitor that contains the specified
rectangle.

The following are the icon parameters.

IC O N PA RA M ET ER M EA N IN G

Retrieves the metrics associated with icons. The pvParam


SPI_GETICONMETRICS parameter must point to an ICONMETRICS structure that
0x002D receives the information. Set the cbSize member of this
structure and the uiParam parameter to
sizeof(ICONMETRICS) .

Retrieves the logical font information for the current icon-


SPI_GETICONTITLELOGFONT title font. The uiParam parameter specifies the size of a
0x001F LOGFONT structure, and the pvParam parameter must point
to the LOGFONT structure to fill in.

Determines whether icon-title wrapping is enabled. The


SPI_GETICONTITLEWRAP pvParam parameter must point to a BOOL variable that
0x0019 receives TRUE if enabled, or FALSE otherwise.

Sets or retrieves the width, in pixels, of an icon cell. The


SPI_ICONHORIZONTALSPACING system uses this rectangle to arrange icons in large icon
0x000D view.
To set this value, set uiParam to the new value and set
pvParam to NULL . You cannot set this value to less than
SM_CXICON.
To retrieve this value, pvParam must point to an integer
that receives the current value.

Sets or retrieves the height, in pixels, of an icon cell.


SPI_ICONVERTICALSPACING
To set this value, set uiParam to the new value and set
0x0018
pvParam to NULL . You cannot set this value to less than
SM_CYICON.
To retrieve this value, pvParam must point to an integer
that receives the current value.
Sets the metrics associated with icons. The pvParam
SPI_SETICONMETRICS parameter must point to an ICONMETRICS structure that
0x002E contains the new parameters. Set the cbSize member of this
structure and the uiParam parameter to
sizeof(ICONMETRICS) .

Reloads the system icons. Set the uiParam parameter to zero


SPI_SETICONS and the pvParam parameter to NULL .
0x0058

Sets the font that is used for icon titles. The uiParam
SPI_SETICONTITLELOGFONT parameter specifies the size of a LOGFONT structure, and
0x0022 the pvParam parameter must point to a LOGFONT
structure.

Turns icon-title wrapping on or off. The uiParam parameter


SPI_SETICONTITLEWRAP specifies TRUE for on, or FALSE for off.
0x001A

The following are the input parameters. They include parameters related to the keyboard, mouse, pen, input
language, and the warning beeper.

IN P UT PA RA M ET ER M EA N IN G

Determines whether the warning beeper is on.


SPI_GETBEEP
The pvParam parameter must point to a BOOL variable
0x0001
that receives TRUE if the beeper is on, or FALSE if it is
off.

Retrieves a BOOL indicating whether an application can


SPI_GETBLOCKSENDINPUTRESETS reset the screensaver's timer by calling the SendInput
0x1026 function to simulate keyboard or mouse input. The pvParam
parameter must point to a BOOL variable that receives
TRUE if the simulated input will be blocked, or FALSE
otherwise.

Retrieves the current contact visualization setting. The


SPI_GETCONTACTVISUALIZATION pvParam parameter must point to a ULONG variable that
0x2018 receives the setting. For more information, see Contact
Visualization.

Retrieves the input locale identifier for the system default


SPI_GETDEFAULTINPUTL ANG input language. The pvParam parameter must point to an
0x0059 HKL variable that receives this value. For more information,
see Languages, Locales, and Keyboard Layouts.

Retrieves the current gesture visualization setting. The


SPI_GETGESTUREVISUALIZATION pvParam parameter must point to a ULONG variable that
0x201A receives the setting. For more information, see Gesture
Visualization.

Determines whether menu access keys are always


SPI_GETKEYBOARDCUES underlined. The pvParam parameter must point to a BOOL
0x100A variable that receives TRUE if menu access keys are always
underlined, and FALSE if they are underlined only when the
menu is activated by the keyboard.
Retrieves the keyboard repeat-delay setting, which is a value
SPI_GETKEYBOARDDEL AY in the range from 0 (approximately 250 ms delay) through 3
0x0016 (approximately 1 second delay). The actual delay associated
with each value may vary depending on the hardware. The
pvParam parameter must point to an integer variable that
receives the setting.

Determines whether the user relies on the keyboard instead


SPI_GETKEYBOARDPREF of the mouse, and wants applications to display keyboard
0x0044 interfaces that would otherwise be hidden. The pvParam
parameter must point to a BOOL variable that receives
TRUE if the user relies on the keyboard; or FALSE
otherwise.

Retrieves the keyboard repeat-speed setting, which is a value


SPI_GETKEYBOARDSPEED in the range from 0 (approximately 2.5 repetitions per
0x000A second) through 31 (approximately 30 repetitions per
second). The actual repeat rates are hardware-dependent
and may vary from a linear scale by as much as 20%. The
pvParam parameter must point to a DWORD variable that
receives the setting.

Retrieves the two mouse threshold values and the mouse


SPI_GETMOUSE acceleration. The pvParam parameter must point to an array
0x0003 of three integers that receives these values. See
mouse_event for further information.

Retrieves the height, in pixels, of the rectangle within which


SPI_GETMOUSEHOVERHEIGHT the mouse pointer has to stay for TrackMouseEvent to
0x0064 generate a WM_MOUSEHOVER message. The pvParam
parameter must point to a UINT variable that receives the
height.

Retrieves the time, in milliseconds, that the mouse pointer


SPI_GETMOUSEHOVERTIME has to stay in the hover rectangle for TrackMouseEvent to
0x0066 generate a WM_MOUSEHOVER message. The pvParam
parameter must point to a UINT variable that receives the
time.

Retrieves the width, in pixels, of the rectangle within which


SPI_GETMOUSEHOVERWIDTH the mouse pointer has to stay for TrackMouseEvent to
0x0062 generate a WM_MOUSEHOVER message. The pvParam
parameter must point to a UINT variable that receives the
width.

Retrieves the current mouse speed. The mouse speed


SPI_GETMOUSESPEED determines how far the pointer will move based on the
0x0070 distance the mouse moves. The pvParam parameter must
point to an integer that receives a value which ranges
between 1 (slowest) and 20 (fastest). A value of 10 is the
default. The value can be set by an end-user using the
mouse control panel application or by an application using
SPI_SETMOUSESPEED .
Determines whether the Mouse Trails feature is enabled. This
SPI_GETMOUSETRAILS feature improves the visibility of mouse cursor movements
0x005E by briefly showing a trail of cursors and quickly erasing
them.
The pvParam parameter must point to an integer
variable that receives a value. if the value is zero or 1,
the feature is disabled. If the value is greater than 1, the
feature is enabled and the value indicates the number of
cursors drawn in the trail. The uiParam parameter is not
used.
Windows 2000: This parameter is not supported.

Retrieves the routing setting for wheel button input. The


SPI_GETMOUSEWHEELROUTING routing setting determines whether wheel button input is
0x201C sent to the app with focus (foreground) or the app under
the mouse cursor.
The pvParam parameter must point to a DWORD
variable that receives the routing option. If the value is
zero or MOUSEWHEEL_ROUTING_FOCUS, mouse wheel
input is delivered to the app with focus. If the value is 1
or MOUSEWHEEL_ROUTING_HYBRID (default), mouse
wheel input is delivered to the app with focus (desktop
apps) or the app under the mouse cursor (Windows
Store apps). The uiParam parameter is not used.

Retrieves the current pen gesture visualization setting. The


SPI_GETPENVISUALIZATION pvParam parameter must point to a ULONG variable that
0x201E receives the setting. For more information, see Pen
Visualization.

Determines whether the snap-to-default-button feature is


SPI_GETSNAPTODEFBUTTON enabled. If enabled, the mouse cursor automatically moves
0x005F to the default button, such as OK or Apply , of a dialog box.
The pvParam parameter must point to a BOOL variable that
receives TRUE if the feature is on, or FALSE if it is off.

Star ting with Windows 8: Determines whether the


SPI_GETSYSTEML ANGUAGEBAR system language bar is enabled or disabled. The pvParam
0x1050 parameter must point to a BOOL variable that receives
TRUE if the language bar is enabled, or FALSE otherwise.

Star ting with Windows 8: Determines whether the active


SPI_GETTHREADLOCALINPUTSETTINGS input settings have Local (per-thread, TRUE ) or Global
0x104E (session, FALSE ) scope. The pvParam parameter must point
to a BOOL variable.

Retrieves the number of characters to scroll when the


SPI_GETWHEELSCROLLCHARS horizontal mouse wheel is moved. The pvParam parameter
0x006C must point to a UINT variable that receives the number of
lines. The default value is 3.

Retrieves the number of lines to scroll when the vertical


SPI_GETWHEELSCROLLLINES mouse wheel is moved. The pvParam parameter must point
0x0068 to a UINT variable that receives the number of lines. The
default value is 3.
Turns the warning beeper on or off. The uiParam parameter
SPI_SETBEEP specifies TRUE for on, or FALSE for off.
0x0002

Determines whether an application can reset the


SPI_SETBLOCKSENDINPUTRESETS screensaver's timer by calling the SendInput function to
0x1027 simulate keyboard or mouse input. The uiParam parameter
specifies TRUE if the screensaver will not be deactivated by
simulated input, or FALSE if the screensaver will be
deactivated by simulated input.

Sets the current contact visualization setting. The pvParam


SPI_SETCONTACTVISUALIZATION parameter must point to a ULONG variable that identifies
0x2019 the setting. For more information, see Contact Visualization.

Note If contact visualizations are disabled, gesture


visualizations cannot be enabled.

Sets the default input language for the system shell and
SPI_SETDEFAULTINPUTL ANG applications. The specified language must be displayable
0x005A using the current system character set. The pvParam
parameter must point to an HKL variable that contains the
input locale identifier for the default language. For more
information, see Languages, Locales, and Keyboard Layouts.

Sets the double-click time for the mouse to the value of the
SPI_SETDOUBLECLICKTIME uiParam parameter. If the uiParam value is greater than
0x0020 5000 milliseconds, the system sets the double-click time to
5000 milliseconds.
The double-click time is the maximum number of
milliseconds that can occur between the first and second
clicks of a double-click. You can also call the
SetDoubleClickTime function to set the double-click
time. To get the current double-click time, call the
GetDoubleClickTime function.

Sets the height of the double-click rectangle to the value of


SPI_SETDOUBLECLKHEIGHT the uiParam parameter.
0x001E
The double-click rectangle is the rectangle within which
the second click of a double-click must fall for it to be
registered as a double-click.
To retrieve the height of the double-click rectangle, call
GetSystemMetrics with the SM_CYDOUBLECLK flag.

Sets the width of the double-click rectangle to the value of


SPI_SETDOUBLECLKWIDTH the uiParam parameter.
0x001D
The double-click rectangle is the rectangle within which
the second click of a double-click must fall for it to be
registered as a double-click.
To retrieve the width of the double-click rectangle, call
GetSystemMetrics with the SM_CXDOUBLECLK flag.
Sets the current gesture visualization setting. The pvParam
SPI_SETGESTUREVISUALIZATION parameter must point to a ULONG variable that identifies
0x201B the setting. For more information, see Gesture Visualization.

Note If contact visualizations are disabled, gesture


visualizations cannot be enabled.

Sets the underlining of menu access key letters. The


SPI_SETKEYBOARDCUES pvParam parameter is a BOOL variable. Set pvParam to
0x100B TRUE to always underline menu access keys, or FALSE to
underline menu access keys only when the menu is activated
from the keyboard.

Sets the keyboard repeat-delay setting. The uiParam


SPI_SETKEYBOARDDEL AY parameter must specify 0, 1, 2, or 3, where zero sets the
0x0017 shortest delay approximately 250 ms) and 3 sets the longest
delay (approximately 1 second). The actual delay associated
with each value may vary depending on the hardware.

Sets the keyboard preference. The uiParam parameter


SPI_SETKEYBOARDPREF specifies TRUE if the user relies on the keyboard instead of
0x0045 the mouse, and wants applications to display keyboard
interfaces that would otherwise be hidden; uiParam is FALSE
otherwise.

Sets the keyboard repeat-speed setting. The uiParam


SPI_SETKEYBOARDSPEED parameter must specify a value in the range from 0
0x000B (approximately 2.5 repetitions per second) through 31
(approximately 30 repetitions per second). The actual repeat
rates are hardware-dependent and may vary from a linear
scale by as much as 20%. If uiParam is greater than 31, the
parameter is set to 31.

Sets the hot key set for switching between input languages.
SPI_SETL ANGTOGGLE The uiParam and pvParam parameters are not used. The
0x005B value sets the shortcut keys in the keyboard property sheets
by reading the registry again. The registry must be set
before this flag is used. the path in the registry is
HKEY_CURRENT_USER\Keyboard Layout \Toggle
. Valid values are "1" = ALT+SHIFT, "2" = CTRL+SHIFT,
and "3" = none.

Sets the two mouse threshold values and the mouse


SPI_SETMOUSE acceleration. The pvParam parameter must point to an array
0x0004 of three integers that specifies these values. See
mouse_event for further information.

Swaps or restores the meaning of the left and right mouse


SPI_SETMOUSEBUTTONSWAP buttons. The uiParam parameter specifies TRUE to swap the
0x0021 meanings of the buttons, or FALSE to restore their original
meanings.
To retrieve the current setting, call GetSystemMetrics
with the SM_SWAPBUTTON flag.
Sets the height, in pixels, of the rectangle within which the
SPI_SETMOUSEHOVERHEIGHT mouse pointer has to stay for TrackMouseEvent to generate
0x0065 a WM_MOUSEHOVER message. Set the uiParam parameter
to the new height.

Sets the time, in milliseconds, that the mouse pointer has to


SPI_SETMOUSEHOVERTIME stay in the hover rectangle for TrackMouseEvent to generate
0x0067 a WM_MOUSEHOVER message. This is used only if you pass
HOVER_DEFAULT in the dwHoverTime parameter in the
call to TrackMouseEvent . Set the uiParamparameter to the
new time.
The time specified should be between
USER_TIMER_MAXIMUM and
USER_TIMER_MINIMUM . If uiParam is less than
USER_TIMER_MINIMUM , the function will use
USER_TIMER_MINIMUM . If uiParam is greater than
USER_TIMER_MAXIMUM , the function will be
USER_TIMER_MAXIMUM .

<b>Windows
Server 2003 and Windows XP: </b>The operating
system does not enforce the use of
<b>USER_TIMER_MAXIMUM</b> and
<b>USER_TIMER_MINIMUM</b> until Windows
Server 2003 with SP1 and Windows XP with SP2.

Sets the width, in pixels, of the rectangle within which the


SPI_SETMOUSEHOVERWIDTH mouse pointer has to stay for TrackMouseEvent to generate
0x0063 a WM_MOUSEHOVER message. Set the uiParam parameter
to the new width.

Sets the current mouse speed. The pvParam parameter is an


SPI_SETMOUSESPEED integer between 1 (slowest) and 20 (fastest). A value of 10 is
0x0071 the default. This value is typically set using the mouse
control panel application.

Enables or disables the Mouse Trails feature, which improves


SPI_SETMOUSETRAILS the visibility of mouse cursor movements by briefly showing
0x005D a trail of cursors and quickly erasing them.
To disable the feature, set the uiParam parameter to zero
or 1. To enable the feature, set uiParam to a value
greater than 1 to indicate the number of cursors drawn
in the trail.
Windows 2000: This parameter is not supported.

Sets the routing setting for wheel button input. The routing
SPI_SETMOUSEWHEELROUTING setting determines whether wheel button input is sent to
0x201D the app with focus (foreground) or the app under the mouse
cursor.
The pvParam parameter must point to a DWORD
variable that receives the routing option. If the value is
zero or MOUSEWHEEL_ROUTING_FOCUS, mouse wheel
input is delivered to the app with focus. If the value is 1
or MOUSEWHEEL_ROUTING_HYBRID (default), mouse
wheel input is delivered to the app with focus (desktop
apps) or the app under the mouse cursor (Windows
Store apps). Set the uiParam parameter to zero.
Sets the current pen gesture visualization setting. The
SPI_SETPENVISUALIZATION pvParam parameter must point to a ULONG variable that
0x201F identifies the setting. For more information, see Pen
Visualization.

Enables or disables the snap-to-default-button feature. If


SPI_SETSNAPTODEFBUTTON enabled, the mouse cursor automatically moves to the
0x0060 default button, such as OK or Apply , of a dialog box. Set
the uiParam parameter to TRUE to enable the feature, or
FALSE to disable it. Applications should use the
ShowWindow function when displaying a dialog box so the
dialog manager can position the mouse cursor.

Star ting with Windows 8: Turns the legacy language bar


SPI_SETSYSTEML ANGUAGEBAR feature on or off. The pvParam parameter is a pointer to a
0x1051 BOOL variable. Set pvParam to TRUE to enable the legacy
language bar, or FALSE to disable it. The flag is supported
on Windows 8 where the legacy language bar is replaced by
Input Switcher and therefore turned off by default. Turning
the legacy language bar on is provided for compatibility
reasons and has no effect on the Input Switcher.

Star ting with Windows 8: Determines whether the active


SPI_SETTHREADLOCALINPUTSETTINGS input settings have Local (per-thread, TRUE ) or Global
0x104F (session, FALSE ) scope. The pvParam parameter must point
to a BOOL variable, casted by PVOID.

Sets the number of characters to scroll when the horizontal


SPI_SETWHEELSCROLLCHARS mouse wheel is moved. The number of characters is set from
0x006D the uiParam parameter.

Sets the number of lines to scroll when the vertical mouse


SPI_SETWHEELSCROLLLINES wheel is moved. The number of lines is set from the uiParam
0x0069 parameter.
The number of lines is the suggested number of lines to
scroll when the mouse wheel is rolled without using
modifier keys. If the number is 0, then no scrolling
should occur. If the number of lines to scroll is greater
than the number of lines viewable, and in particular if it
is WHEEL_PAGESCROLL (#defined as UINT_MAX ),
the scroll operation should be interpreted as clicking
once in the page down or page up regions of the scroll
bar.

The following are the menu parameters.

M EN U PA RA M ET ER M EA N IN G

Determines whether pop-up menus are left-aligned or right-


SPI_GETMENUDROPALIGNMENT aligned, relative to the corresponding menu-bar item. The
0x001B pvParam parameter must point to a BOOL variable that
receives TRUE if right-aligned, or FALSE otherwise.
Determines whether menu fade animation is enabled. The
SPI_GETMENUFADE pvParam parameter must point to a BOOL variable that
0x1012 receives TRUE when fade animation is enabled and FALSE
when it isdisabled. If fade animation is disabled, menus use
slide animation. This flag is ignored unless menu animation is
enabled, which you can do using the
SPI_SETMENUANIMATION flag. For more information,
see AnimateWindow.

Retrieves the time, in milliseconds, that the system waits


SPI_GETMENUSHOWDEL AY before displaying a shortcut menu when the mouse cursor is
0x006A over a submenu item. The pvParam parameter must point to
a DWORD variable that receives the time of the delay.

Sets the alignment value of pop-up menus. The uiParam


SPI_SETMENUDROPALIGNMENT parameter specifies TRUE for right alignment, or FALSE for
0x001C left alignment.

Enables or disables menu fade animation. Set pvParam to


SPI_SETMENUFADE TRUE to enable the menu fade effect or FALSE to disable it.
0x1013 If fade animation is disabled, menus use slide animation. he
The menu fade effect is possible only if the system has a
color depth of more than 256 colors. This flag is ignored
unless SPI_MENUANIMATION is also set. For more
information, see AnimateWindow.

Sets uiParam to the time, in milliseconds, that the system


SPI_SETMENUSHOWDEL AY waits before displaying a shortcut menu when the mouse
0x006B cursor is over a submenu item.

The following are the power parameters.


Beginning with Windows Server 2008 and Windows Vista, these power parameters are not supported. Instead,
to determine the current display power state, an application should register for
GUID_MONITOR_POWER_STATE notifications. To determine the current display power down time-out, an
application should register for notification of changes to the GUID_VIDEO_POWERDOWN_TIMEOUT power
setting. For more information, see Registering for Power Events.
Windows Ser ver 2003 and Windows XP/2000: To determine the current display power state, use the
following power parameters.

P O W ER PA RA M ET ER M EA N IN G

This parameter is not supported.


SPI_GETLOWPOWERACTIVE
Windows Ser ver 2003 and
0x0053
Windows XP/2000: Determines whether the low-
power phase of screen saving is enabled. The pvParam
parameter must point to a BOOL variable that receives
TRUE if enabled, or FALSE if disabled. This flag is
supported for 32-bit applications only.
This parameter is not supported.
SPI_GETLOWPOWERTIMEOUT
Windows Ser ver 2003 and
0x004F
Windows XP/2000: Retrieves the time-out value for
the low-power phase of screen saving. The pvParam
parameter must point to an integer variable that
receives the value. This flag is supported for 32-bit
applications only.

This parameter is not supported. When the power-off phase


SPI_GETPOWEROFFACTIVE of screen saving is enabled, the
0x0054 GUID_VIDEO_POWERDOWN_TIMEOUT power setting is
greater than zero.
Windows Ser ver 2003 and
Windows XP/2000: Determines whether the power-
off phase of screen saving is enabled. The pvParam
parameter must point to a BOOL variable that receives
TRUE if enabled, or FALSE if disabled. This flag is
supported for 32-bit applications only.

This parameter is not supported. Instead, check the


SPI_GETPOWEROFFTIMEOUT GUID_VIDEO_POWERDOWN_TIMEOUT power setting.
0x0050
Windows Ser ver 2003 and
Windows XP/2000: Retrieves the time-out value for
the power-off phase of screen saving. The pvParam
parameter must point to an integer variable that
receives the value. This flag is supported for 32-bit
applications only.

This parameter is not supported.


SPI_SETLOWPOWERACTIVE
Windows Ser ver 2003 and
0x0055
Windows XP/2000: Activates or deactivates the low-
power phase of screen saving. Set uiParam to 1 to
activate, or zero to deactivate. The pvParam parameter
must be NULL . This flag is supported for 32-bit
applications only.

This parameter is not supported.


SPI_SETLOWPOWERTIMEOUT
Windows Ser ver 2003 and
0x0051
Windows XP/2000: Sets the time-out value, in
seconds, for the low-power phase of screen saving. The
uiParam parameter specifies the new value. The pvParam
parameter must be NULL . This flag is supported for 32-
bit applications only.

This parameter is not supported. Instead, set the


SPI_SETPOWEROFFACTIVE GUID_VIDEO_POWERDOWN_TIMEOUT power setting.
0x0056
Windows Ser ver 2003 and
Windows XP/2000: Activates or deactivates the
power-off phase of screen saving. Set uiParam to 1 to
activate, or zero to deactivate. The pvParam parameter
must be NULL . This flag is supported for 32-bit
applications only.
This parameter is not supported. Instead, set the
SPI_SETPOWEROFFTIMEOUT GUID_VIDEO_POWERDOWN_TIMEOUT power setting
0x0052 to a time-out value.
Windows Ser ver 2003 and
Windows XP/2000: Sets the time-out value, in
seconds, for the power-off phase of screen saving. The
uiParam parameter specifies the new value. The pvParam
parameter must be NULL . This flag is supported for 32-
bit applications only.

The following are the screen saver parameters.

SC REEN SAVER PA RA M ET ER M EA N IN G

Determines whether screen saving is enabled. The pvParam


SPI_GETSCREENSAVEACTIVE parameter must point to a BOOL variable that receives
0x0010 TRUE if screen saving is enabled, or FALSE otherwise.
Windows 7, Windows Ser ver 2008 R2 and
Windows 2000: The function returns TRUE even
when screen saving is not enabled. For more information
and a workaround, see KB318781.

Determines whether a screen saver is currently running on


SPI_GETSCREENSAVERRUNNING the window station of the calling process. The pvParam
0x0072 parameter must point to a BOOL variable that receives
TRUE if a screen saver is currently running, or FALSE
otherwise. Note that only the interactive window station,
WinSta0, can have a screen saver running.

Determines whether the screen saver requires a password to


SPI_GETSCREENSAVESECURE display the Windows desktop. The pvParam parameter must
0x0076 point to a BOOL variable that receives TRUE if the screen
saver requires a password, or FALSE otherwise. The uiParam
parameter is ignored.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.

Retrieves the screen saver time-out value, in seconds. The


SPI_GETSCREENSAVETIMEOUT pvParam parameter must point to an integer variable that
0x000E receives the value.

Sets the state of the screen saver. The uiParam parameter


SPI_SETSCREENSAVEACTIVE specifies TRUE to activate screen saving, or FALSE to
0x0011 deactivate it.
If the machine has entered power saving mode or
system lock state, an ERROR_OPERATION_IN_PROGRESS
exception occurs.
Sets whether the screen saver requires the user to enter a
SPI_SETSCREENSAVESECURE password to display the Windows desktop. The uiParam
0x0077 parameter is a BOOL variable. The pvParam parameter is
ignored. Set uiParam to TRUE to require a password, or
FALSE to not require a password.
If the machine has entered power saving mode or
system lock state, an ERROR_OPERATION_IN_PROGRESS
exception occurs.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.

Sets the screen saver time-out value to the value of the


SPI_SETSCREENSAVETIMEOUT uiParam parameter. This value is the amount of time, in
0x000F seconds, that the system must be idle before the screen
saver activates.
If the machine has entered power saving mode or
system lock state, an ERROR_OPERATION_IN_PROGRESS
exception occurs.

The following are the time-out parameters for applications and services.

T IM E- O UT PA RA M ET ER M EA N IN G

Retrieves the number of milliseconds that a thread can go


SPI_GETHUNGAPPTIMEOUT without dispatching a message before the system considers
0x0078 it unresponsive. The pvParam parameter must point to an
integer variable that receives the value.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Retrieves the number of milliseconds that the system waits


SPI_GETWAITTOKILLTIMEOUT before terminating an application that does not respond to a
0x007A shutdown request. The pvParam parameter must point to an
integer variable that receives the value.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Retrieves the number of milliseconds that the service control


SPI_GETWAITTOKILLSERVICETIMEOUT manager waits before terminating a service that does not
0x007C respond to a shutdown request. The pvParam parameter
must point to an integer variable that receives the value.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Sets the hung application time-out to the value of the


SPI_SETHUNGAPPTIMEOUT uiParam parameter. This value is the number of milliseconds
0x0079 that a thread can go without dispatching a message before
the system considers it unresponsive.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.
Sets the application shutdown request time-out to the value
SPI_SETWAITTOKILLTIMEOUT of the uiParam parameter. This value is the number of
0x007B milliseconds that the system waits before terminating an
application that does not respond to a shutdown request.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Sets the service shutdown request time-out to the value of


SPI_SETWAITTOKILLSERVICETIMEOUT the uiParam parameter. This value is the number of
0x007D milliseconds that the system waits before terminating a
service that does not respond to a shutdown request.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

The following are the UI effects. The SPI_SETUIEFFECTS value is used to enable or disable all UI effects at once.
This table contains the complete list of UI effect values.

UI EF F EC T S PA RA M ET ER M EA N IN G

Determines whether the slide-open effect for combo boxes is


SPI_GETCOMBOBOXANIMATION enabled. The pvParam parameter must point to a BOOL
0x1004 variable that receives TRUE for enabled, or FALSE for
disabled.

Determines whether the cursor has a shadow around it. The


SPI_GETCURSORSHADOW pvParam parameter must point to a BOOL variable that
0x101A receives TRUE if the shadow is enabled, FALSE if it is
disabled. This effect appears only if the system has a color
depth of more than 256 colors.

Determines whether the gradient effect for window title bars


SPI_GETGRADIENTCAPTIONS is enabled. The pvParam parameter must point to a BOOL
0x1008 variable that receives TRUE for enabled, or FALSE for
disabled. For more information about the gradient effect, see
the GetSysColor function.

Determines whether hot tracking of user-interface elements,


SPI_GETHOTTRACKING such as menu names on menu bars, is enabled. The pvParam
0x100E parameter must point to a BOOL variable that receives
TRUE for enabled, or FALSE for disabled.
Hot tracking means that when the cursor moves over an
item, it is highlighted but not selected. You can query
this value to decide whether to use hot tracking in the
user interface of your application.

Determines whether the smooth-scrolling effect for list


SPI_GETLISTBOXSMOOTHSCROLLING boxes is enabled. The pvParam parameter must point to a
0x1006 BOOL variable that receives TRUE for enabled, or FALSE for
disabled.
Determines whether the menu animation feature is enabled.
SPI_GETMENUANIMATION This master switch must be on to enable menu animation
0x1002 effects. The pvParam parameter must point to a BOOL
variable that receives TRUE if animation is enabled and
FALSE if it is disabled.
If animation is enabled, SPI_GETMENUFADE indicates
whether menus use fade or slide animation.

Same as SPI_GETKEYBOARDCUES.
SPI_GETMENUUNDERLINES
0x100A

Determines whether the selection fade effect is enabled. The


SPI_GETSELECTIONFADE pvParam parameter must point to a BOOL variable that
0x1014 receives TRUE if enabled or FALSE if disabled.
The selection fade effect causes the menu item selected
by the user to remain on the screen briefly while fading
out after the menu is dismissed.

Determines whether ToolTip animation is enabled. The


SPI_GETTOOLTIPANIMATION pvParam parameter must point to a BOOL variable that
0x1016 receives TRUE if enabled or FALSE if disabled. If ToolTip
animation is enabled, SPI_GETTOOLTIPFADE indicates
whether ToolTips use fade or slide animation.

If SPI_SETTOOLTIPANIMATION is enabled,
SPI_GETTOOLTIPFADE SPI_GETTOOLTIPFADE indicates whether ToolTip
0x1018 animation uses a fade effect or a slide effect. The pvParam
parameter must point to a BOOL variable that receives
TRUE for fade animation or FALSE for slide animation. For
more information on slide and fade effects, see
AnimateWindow.

Determines whether UI effects are enabled or disabled. The


SPI_GETUIEFFECTS pvParam parameter must point to a BOOL variable that
0x103E receives TRUE if all UI effects are enabled, or FALSE if they
are disabled.

Enables or disables the slide-open effect for combo boxes.


SPI_SETCOMBOBOXANIMATION Set the pvParam parameter to TRUE to enable the gradient
0x1005 effect, or FALSE to disable it.

Enables or disables a shadow around the cursor. The


SPI_SETCURSORSHADOW pvParam parameter is a BOOL variable. Set pvParam to
0x101B TRUE to enable the shadow or FALSE to disable the
shadow. This effect appears only if the system has a color
depth of more than 256 colors.

Enables or disables the gradient effect for window title bars.


SPI_SETGRADIENTCAPTIONS Set the pvParam parameter to TRUE to enable it, or FALSE
0x1009 to disable it. The gradient effect is possible only if the system
has a color depth of more than 256 colors. For more
information about the gradient effect, see the GetSysColor
function.
Enables or disables hot tracking of user-interface elements
SPI_SETHOTTRACKING such as menu names on menu bars. Set the pvParam
0x100F parameter to TRUE to enable it, or FALSE to disable it.
Hot-tracking means that when the cursor moves over an
item, it is highlighted but not selected.

Enables or disables the smooth-scrolling effect for list boxes.


SPI_SETLISTBOXSMOOTHSCROLLING Set the pvParam parameter to TRUE to enable the smooth-
0x1007 scrolling effect, or FALSE to disable it.

Enables or disables menu animation. This master switch


SPI_SETMENUANIMATION must be on for any menu animation to occur. The pvParam
0x1003 parameter is a BOOL variable; set pvParam to TRUE to
enable animation and FALSE to disable animation.
If animation is enabled, SPI_GETMENUFADE indicates
whether menus use fade or slide animation.

Same as SPI_SETKEYBOARDCUES.
SPI_SETMENUUNDERLINES
0x100B

Set pvParam to TRUE to enable the selection fade effect or


SPI_SETSELECTIONFADE FALSE to disable it.
0x1015
The selection fade effect causes the menu item selected
by the user to remain on the screen briefly while fading
out after the menu is dismissed. The selection fade effect
is possible only if the system has a color depth of more
than 256 colors.

Set pvParam to TRUE to enable ToolTip animation or FALSE


SPI_SETTOOLTIPANIMATION to disable it. If enabled, you can use SPI_SETTOOLTIPFADE
0x1017 to specify fade or slide animation.

If the SPI_SETTOOLTIPANIMATION flag is enabled, use


SPI_SETTOOLTIPFADE SPI_SETTOOLTIPFADE to indicate whether ToolTip
0x1019 animation uses a fade effect or a slide effect. Set pvParam to
TRUE for fade animation or FALSE for slide animation. The
tooltip fade effect is possible only if the system has a color
depth of more than 256 colors. For more information on the
slide and fade effects, see the AnimateWindowfunction.

Enables or disables UI effects. Set the pvParam parameter to


SPI_SETUIEFFECTS TRUE to enable all UI effects or FALSE to disable all UI
0x103F effects.

The following are the window parameters.

W IN DO W PA RA M ET ER M EA N IN G

Determines whether active window tracking (activating the


SPI_GETACTIVEWINDOWTRACKING window the mouse is on) is on or off. The pvParam
0x1000 parameter must point to a BOOL variable that receives
TRUE for on, or FALSE for off.
Determines whether windows activated through active
SPI_GETACTIVEWNDTRKZORDER window tracking will be brought to the top. The pvParam
0x100C parameter must point to a BOOL variable that receives
TRUE for on, or FALSE for off.

Retrieves the active window tracking delay, in milliseconds.


SPI_GETACTIVEWNDTRKTIMEOUT The pvParam parameter must point to a DWORD variable
0x2002 that receives the time.

Retrieves the animation effects associated with user actions.


SPI_GETANIMATION The pvParam parameter must point to an ANIMATIONINFO
0x0048 structure that receives the information. Set the cbSize
member of this structure and the uiParam parameter to
sizeof(ANIMATIONINFO) .

Retrieves the border multiplier factor that determines the


SPI_GETBORDER width of a window's sizing border. The pvParamparameter
0x0005 must point to an integer variable that receives this value.

Retrieves the caret width in edit controls, in pixels. The


SPI_GETCARETWIDTH pvParam parameter must point to a DWORD variable that
0x2006 receives this value.

Determines whether a window is docked when it is moved to


SPI_GETDOCKMOVING the top, left, or right edges of a monitor or monitor array.
0x0090 The pvParam parameter must point to a BOOL variable that
receives TRUE if enabled, or FALSE otherwise.
Use SPI_GETWINARRANGING to determine whether
this behavior is enabled.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Determines whether a maximized window is restored when


SPI_GETDRAGFROMMAXIMIZE its caption bar is dragged. The pvParam parameter must
0x008C point to a BOOL variable that receives TRUE if enabled, or
FALSE otherwise.
Use SPI_GETWINARRANGING to determine whether
this behavior is enabled.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Determines whether dragging of full windows is enabled. The


SPI_GETDRAGFULLWINDOWS pvParam parameter must point to a BOOL variable that
0x0026 receives TRUE if enabled, or FALSE otherwise.

Retrieves the number of times SetForegroundWindow will


SPI_GETFOREGROUNDFL ASHCOUNT flash the taskbar button when rejecting a foreground switch
0x2004 request. The pvParam parameter must point to a DWORD
variable that receives the value.
Retrieves the amount of time following user input, in
SPI_GETFOREGROUNDLOCKTIMEOUT milliseconds, during which the system will not allow
0x2000 applications to force themselves into the foreground. The
pvParam parameter must point to a DWORD variable that
receives the time.

Retrieves the metrics associated with minimized windows.


SPI_GETMINIMIZEDMETRICS The pvParam parameter must point to a
0x002B MINIMIZEDMETRICS structure that receives the information.
Set the cbSize member of this structure and the uiParam
parameter to sizeof(MINIMIZEDMETRICS) .

Retrieves the threshold in pixels where docking behavior is


SPI_GETMOUSEDOCKTHRESHOLD triggered by using a mouse to drag a window to the edge of
0x007E a monitor or monitor array. The default threshold is 1. The
pvParam parameter must point to a DWORD variable that
receives the value.
Use SPI_GETWINARRANGING to determine whether
this behavior is enabled.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Retrieves the threshold in pixels where undocking behavior is


SPI_GETMOUSEDRAGOUTTHRESHOLD triggered by using a mouse to drag a window from the edge
0x0084 of a monitor or a monitor array toward the center. The
default threshold is 20.
Use SPI_GETWINARRANGING to determine whether
this behavior is enabled.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Retrieves the threshold in pixels from the top of a monitor or


SPI_GETMOUSESIDEMOVETHRESHOLD a monitor array where a vertically maximized window is
0x0088 restored when dragged with the mouse. The default
threshold is 50.
Use SPI_GETWINARRANGING to determine whether
this behavior is enabled.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Retrieves the metrics associated with the nonclient area of


SPI_GETNONCLIENTMETRICS nonminimized windows. The pvParam parameter must point
0x0029 to a NONCLIENTMETRICS structure that receives the
information. Set the cbSize member of this structure and
the uiParam parameter to sizeof(NONCLIENTMETRICS) .
Retrieves the threshold in pixels where docking
SPI_GETPENDOCKTHRESHOLD behavior is triggered by using a pen to drag a
0x0080 window to the edge of a monitor or monitor array.
The default is 30.
Use SPI_GETWINARRANGING to determine whether
this behavior is enabled.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Retrieves the threshold in pixels where undocking behavior is


SPI_GETPENDRAGOUTTHRESHOLD triggered by using a pen to drag a window from the edge of
0x0086 a monitor or monitor array toward its center. The default
threshold is 30.
Use SPI_GETWINARRANGING to determine whether
this behavior is enabled.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Retrieves the threshold in pixels from the top of a monitor or


SPI_GETPENSIDEMOVETHRESHOLD monitor array where a vertically maximized window is
0x008A restored when dragged with the mouse. The default
threshold is 50.
Use SPI_GETWINARRANGING to determine whether
this behavior is enabled.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Determines whether the IME status window is visible (on a


SPI_GETSHOWIMEUI per-user basis). The pvParam parameter must point to a
0x006E BOOL variable that receives TRUE if the status window is
visible, or FALSE if it is not.

Determines whether a window is vertically maximized when


SPI_GETSNAPSIZING it is sized to the top or bottom of a monitor or monitor
0x008E array. The pvParam parameter must point to a BOOL
variable that receives TRUE if enabled, or FALSE otherwise.
Use SPI_GETWINARRANGING to determine whether
this behavior is enabled.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.
Determines whether window arrangement is enabled. The
SPI_GETWINARRANGING pvParam parameter must point to a BOOL variable that
0x0082 receives TRUE if enabled, or FALSE otherwise.
Window arrangement reduces the number of mouse,
pen, or touch interactions needed to move and size top-
level windows by simplifying the default behavior of a
window when it is dragged or sized.
The following parameters retrieve individual window
arrangement settings:
SPI_GETDOCKMOVING
SPI_GETMOUSEDOCKTHRESHOLD
SPI_GETMOUSEDRAGOUTTHRESHOLD
SPI_GETMOUSESIDEMOVETHRESHOLD
SPI_GETPENDOCKTHRESHOLD
SPI_GETPENDRAGOUTTHRESHOLD
SPI_GETPENSIDEMOVETHRESHOLD
SPI_GETSNAPSIZING
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This parameter is
not supported.

Sets active window tracking (activating the window the


SPI_SETACTIVEWINDOWTRACKING mouse is on) either on or off. Set pvParam to TRUE for on or
0x1001 FALSE for off.

Determines whether or not windows activated through


SPI_SETACTIVEWNDTRKZORDER active window tracking should be brought to the top. Set
0x100D pvParam to TRUE for on or FALSE for off.

Sets the active window tracking delay. Set pvParam to the


SPI_SETACTIVEWNDTRKTIMEOUT number of milliseconds to delay before activating the
0x2003 window under the mouse pointer.

Sets the animation effects associated with user actions. The


SPI_SETANIMATION pvParam parameter must point to an ANIMATIONINFO
0x0049 structure that contains the new parameters. Set the cbSize
member of this structure and the uiParam parameter to
sizeof(ANIMATIONINFO) .

Sets the border multiplier factor that determines the width


SPI_SETBORDER of a window's sizing border. The uiParam parameter specifies
0x0006 the new value.

Sets the caret width in edit controls. Set pvParam to the


SPI_SETCARETWIDTH desired width, in pixels. The default and minimum value is 1.
0x2007

Sets whether a window is docked when it is moved to the


SPI_SETDOCKMOVING top, left, or right docking targets on a monitor or monitor
0x0091 array. Set pvParam to TRUE for on or FALSE for off.
SPI_GETWINARRANGING must be TRUE to enable
this behavior.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.
Sets whether a maximized window is restored when its
SPI_SETDRAGFROMMAXIMIZE caption bar is dragged. Set pvParam to TRUE for on or
0x008D FALSE for off.
SPI_GETWINARRANGING must be TRUE to enable
this behavior.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Sets dragging of full windows either on or off. The uiParam


SPI_SETDRAGFULLWINDOWS parameter specifies TRUE for on, or FALSE for off.
0x0025

Sets the height, in pixels, of the rectangle used to detect the


SPI_SETDRAGHEIGHT start of a drag operation. Set uiParam to the new value. To
0x004D retrieve the drag height, call GetSystemMetrics with the
SM_CYDRAG flag.

Sets the width, in pixels, of the rectangle used to detect the


SPI_SETDRAGWIDTH start of a drag operation. Set uiParam to the new value. To
0x004C retrieve the drag width, call GetSystemMetrics with the
SM_CXDRAG flag.

Sets the number of times SetForegroundWindow will flash


SPI_SETFOREGROUNDFL ASHCOUNT the taskbar button when rejecting a foreground switch
0x2005 request. Set pvParam to the number of times to flash.

Sets the amount of time following user input, in milliseconds,


SPI_SETFOREGROUNDLOCKTIMEOUT during which the system does not allow applications to force
0x2001 themselves into the foreground. Set pvParam to the new
time-out value.
The calling thread must be able to change the
foreground window, otherwise the call fails.

Sets the metrics associated with minimized windows. The


SPI_SETMINIMIZEDMETRICS pvParam parameter must point to a MINIMIZEDMETRICS
0x002C structure that contains the new parameters. Set the cbSize
member of this structure and the uiParam parameter to
sizeof(MINIMIZEDMETRICS) .

Sets the threshold in pixels where docking behavior is


SPI_SETMOUSEDOCKTHRESHOLD triggered by using a mouse to drag a window to the edge of
0x007F a monitor or monitor array. The default threshold is 1. The
pvParam parameter must point to a DWORD variable that
contains the new value.
SPI_GETWINARRANGING must be TRUE to enable
this behavior.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.
Sets the threshold in pixels where undocking behavior is
SPI_SETMOUSEDRAGOUTTHRESHOLD triggered by using a mouse to drag a window from the edge
0x0085 of a monitor or monitor array to its center. The default
threshold is 20. The pvParam parameter must point to a
DWORD variable that contains the new value.
SPI_GETWINARRANGING must be TRUE to enable
this behavior.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Sets the threshold in pixels from the top of the monitor


SPI_SETMOUSESIDEMOVETHRESHOLD where a vertically maximized window is restored when
0x0089 dragged with the mouse. The default threshold is 50. The
pvParam parameter must point to a DWORD variable that
contains the new value.
SPI_GETWINARRANGING must be TRUE to enable
this behavior.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Sets the metrics associated with the nonclient area of


SPI_SETNONCLIENTMETRICS nonminimized windows. The pvParam parameter must point
0x002A to a NONCLIENTMETRICS structure that contains the new
parameters. Set the cbSize member of this structure and
the uiParam parameter to sizeof(NONCLIENTMETRICS) .
Also, the lfHeight member of the LOGFONT structure must
be a negative value.

Sets the threshold in pixels where docking behavior is


SPI_SETPENDOCKTHRESHOLD triggered by using a pen to drag a window to the edge of a
0x0081 monitor or monitor array. The default threshold is 30. The
pvParam parameter must point to a DWORD variable that
contains the new value.
SPI_GETWINARRANGING must be TRUE to enable
this behavior.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Sets the threshold in pixels where undocking behavior is


SPI_SETPENDRAGOUTTHRESHOLD triggered by using a pen to drag a window from the edge of
0x0087 a monitor or monitor array to its center. The default
threshold is 30. The pvParam parameter must point to a
DWORD variable that contains the new value.
SPI_GETWINARRANGING must be TRUE to enable
this behavior.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.
Sets the threshold in pixels from the top of the monitor
SPI_SETPENSIDEMOVETHRESHOLD where a vertically maximized window is restored when
0x008B dragged with a pen. The default threshold is 50. The
pvParam parameter must point to a DWORD variable that
contains the new value.
SPI_GETWINARRANGING must be TRUE to enable
this behavior.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Sets whether the IME status window is visible or not on a


SPI_SETSHOWIMEUI per-user basis. The uiParam parameter specifies TRUE for on
0x006F or FALSE for off.

Sets whether a window is vertically maximized when it is


SPI_SETSNAPSIZING sized to the top or bottom of the monitor. Set pvParam to
0x008F TRUE for on or FALSE for off.
SPI_GETWINARRANGING must be TRUE to enable
this behavior.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Sets whether window arrangement is enabled. Set pvParam


SPI_SETWINARRANGING to TRUE for on or FALSE for off.
0x0083
Window arrangement reduces the number of mouse,
pen, or touch interactions needed to move and size top-
level windows by simplifying the default behavior of a
window when it is dragged or sized.
The following parameters set individual window
arrangement settings:
SPI_SETDOCKMOVING
SPI_SETMOUSEDOCKTHRESHOLD
SPI_SETMOUSEDRAGOUTTHRESHOLD
SPI_SETMOUSESIDEMOVETHRESHOLD
SPI_SETPENDOCKTHRESHOLD
SPI_SETPENDRAGOUTTHRESHOLD
SPI_SETPENSIDEMOVETHRESHOLD
SPI_SETSNAPSIZING
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This parameter is
not supported.

uiParam

Type: UINT
A parameter whose usage and format depends on the system parameter being queried or set. For more
information about system-wide parameters, see the uiAction parameter. If not otherwise indicated, you must
specify zero for this parameter.
pvParam

Type: PVOID
A parameter whose usage and format depends on the system parameter being queried or set. For more
information about system-wide parameters, see the uiAction parameter. If not otherwise indicated, you must
specify NULL for this parameter. For information on the PVOID datatype, see Windows Data Types.
fWinIni

Type: UINT
If a system parameter is being set, specifies whether the user profile is to be updated, and if so, whether the
WM_SETTINGCHANGE message is to be broadcast to all top-level windows to notify them of the change.
This parameter can be zero if you do not want to update the user profile or broadcast the WM_SETTINGCHANGE
message, or it can be one or more of the following values.

VA L UE M EA N IN G

Writes the new system-wide parameter setting to the user


SPIF_UPDATEINIFILE profile.

Broadcasts the WM_SETTINGCHANGE message after


SPIF_SENDCHANGE updating the user profile.

Same as SPIF_SENDCHANGE .
SPIF_SENDWININICHANGE

Return value
Type: BOOL
If the function succeeds, the return value is a nonzero value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
This function is intended for use with applications that allow the user to customize the environment.
A keyboard layout name should be derived from the hexadecimal value of the language identifier corresponding
to the layout. For example, U.S. English has a language identifier of 0x0409, so the primary U.S. English layout is
named "00000409". Variants of U.S. English layout, such as the Dvorak layout, are named "00010409",
"00020409" and so on. For a list of the primary language identifiers and sublanguage identifiers that make up a
language identifier, see the MAKEL ANGID macro.
There is a difference between the High Contrast color scheme and the High Contrast Mode. The High Contrast
color scheme changes the system colors to colors that have obvious contrast; you switch to this color scheme by
using the Display Options in the control panel. The High Contrast Mode, which uses SPI_GETHIGHCONTRAST
and SPI_SETHIGHCONTRAST , advises applications to modify their appearance for visually-impaired users. It
involves such things as audible warning to users and customized color scheme (using the Accessibility Options
in the control panel). For more information, see HIGHCONTRAST. For more information on general accessibility
features, see Accessibility.
During the time that the primary button is held down to activate the Mouse ClickLock feature, the user can
move the mouse. After the primary button is locked down, releasing the primary button does not result in a
WM_LBUTTONUP message. Thus, it will appear to an application that the primary button is still down. Any
subsequent button message releases the primary button, sending a WM_LBUTTONUP message to the
application, thus the button can be unlocked programmatically or through the user clicking any button.
This API is not DPI aware, and should not be used if the calling thread is per-monitor DPI aware. For the DPI-
aware version of this API, see SystemParametersInfoForDPI. For more information on DPI awareness, see the
Windows High DPI documentation.
Examples
The following example uses SystemParametersInfo to double the mouse speed.

#include <windows.h>
#include <stdio.h>
#pragma comment(lib, "user32.lib")

void main()
{
BOOL fResult;
int aMouseInfo[3]; // Array for mouse information

// Get the current mouse speed.


fResult = SystemParametersInfo(SPI_GETMOUSE, // Get mouse information
0, // Not used
&aMouseInfo, // Holds mouse information
0); // Not used

// Double it.
if( fResult )
{
aMouseInfo[2] = 2 * aMouseInfo[2];

// Change the mouse speed to the new value.


SystemParametersInfo(SPI_SETMOUSE, // Set mouse information
0, // Not used
aMouseInfo, // Mouse information
SPIF_SENDCHANGE); // Update Win.ini
}
}

NOTE
The winuser.h header defines SystemParametersInfo as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib
DLL User32.dll

API set ext-ms-win-ntuser-sysparams-ext-l1-1-0 (introduced in


Windows 8)

See also
ACCESSTIMEOUT
ANIMATIONINFO
AUDIODESCRIPTION
FILTERKEYS
HIGHCONTRAST
ICONMETRICS
LOGFONT
MAKELANGID
MINIMIZEDMETRICS
MOUSEKEYS
NONCLIENTMETRICS
RECT
SERIALKEYS
SOUNDSENTRY
STICKYKEYS
SystemParametersInfoForDPI
TOGGLEKEYS
WM_SETTINGCHANGE
Windows Data Types
SystemParametersInfoW function (winuser.h)
2/1/2021 • 55 minutes to read • Edit Online

Retrieves or sets the value of one of the system-wide parameters. This function can also update the user profile
while setting a parameter.

Syntax
BOOL SystemParametersInfoW(
UINT uiAction,
UINT uiParam,
PVOID pvParam,
UINT fWinIni
);

Parameters
uiAction

Type: UINT
The system-wide parameter to be retrieved or set. The possible values are organized in the following tables of
related parameters:
Accessibility parameters
Desktop parameters
Icon parameters
Input parameters
Menu parameters
Power parameters
Screen saver parameters
Time-out parameters
UI effect parameters
Window parameters
The following are the accessibility parameters.

A C C ESSIB IL IT Y PA RA M ET ER M EA N IN G

Retrieves information about the time-out period associated


SPI_GETACCESSTIMEOUT with the accessibility features. The pvParam parameter must
0x003C point to an ACCESSTIMEOUT structure that receives the
information. Set the cbSize member of this structure and
the uiParam parameter to sizeof(ACCESSTIMEOUT) .
Determines whether audio descriptions are enabled or
SPI_GETAUDIODESCRIPTION disabled. The pvParam parameter is a pointer to an
0x0074 AUDIODESCRIPTION structure. Set the cbSize member of
this structure and the uiParam parameter to
sizeof(AUDIODESCRIPTION) .
While it is possible for users who have visual
impairments to hear the audio in video content, there is
a lot of action in video that does not have
corresponding audio. Specific audio description of what
is happening in a video helps these users understand
the content better. This flag enables you to determine
whether audio descriptions have been enabled and in
which language.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.

Determines whether animations are enabled or disabled. The


SPI_GETCLIENTAREAANIMATION pvParam parameter must point to a BOOL variable that
0x1042 receives TRUE if animations are enabled, or FALSE
otherwise.
Display features such as flashing, blinking, flickering, and
moving content can cause seizures in users with photo-
sensitive epilepsy. This flag enables you to determine
whether such animations have been disabled in the
client area.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.

Determines whether overlapped content is enabled or


SPI_GETDISABLEOVERL APPEDCONTENT disabled. The pvParam parameter must point to a BOOL
0x1040 variable that receives TRUE if enabled, or FALSE otherwise.
Display features such as background images, textured
backgrounds, water marks on documents, alpha
blending, and transparency can reduce the contrast
between the foreground and background, making it
harder for users with low vision to see objects on the
screen. This flag enables you to determine whether such
overlapped content has been disabled.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.

Retrieves information about the FilterKeys accessibility


SPI_GETFILTERKEYS feature. The pvParam parameter must point to a FILTERKEYS
0x0032 structure that receives the information. Set the cbSize
member of this structure and the uiParam parameter to
sizeof(FILTERKEYS) .

Retrieves the height, in pixels, of the top and bottom edges


SPI_GETFOCUSBORDERHEIGHT of the focus rectangle drawn with DrawFocusRect. The
0x2010 pvParam parameter must point to a UINT value.
Windows 2000: This parameter is not supported.
Retrieves the width, in pixels, of the left and right edges of
SPI_GETFOCUSBORDERWIDTH the focus rectangle drawn with DrawFocusRect. The pvParam
0x200E parameter must point to a UINT .
Windows 2000: This parameter is not supported.

Retrieves information about the HighContrast accessibility


SPI_GETHIGHCONTRAST feature. The pvParam parameter must point to a
0x0042 HIGHCONTRAST structure that receives the information. Set
the cbSize member of this structure and the uiParam
parameter to sizeof(HIGHCONTRAST) .
For a general discussion, see Remarks.

Retrieves a value that determines whether Windows 8 is


SPI_GETLOGICALDPIOVERRIDE displaying apps using the default scaling plateau for the
0x009E hardware or going to the next higher plateau. This value is
based on the current "Make everything on your screen
bigger" setting, found in the Ease of Access section of PC
settings : 1 is on, 0 is off.
Apps can provide text and image resources for each of
several scaling plateaus: 100%, 140%, and 180%.
Providing separate resources optimized for a particular
scale avoids distortion due to resizing. Windows 8
determines the appropriate scaling plateau based on a
number of factors, including screen size and pixel
density. When "Make everything on your screen bigger"
is selected (SPI_GETLOGICALDPIOVERRIDE returns a
value of 1), Windows uses resources from the next
higher plateau. For example, in the case of hardware that
Windows determines should use a scale of
SCALE_100_PERCENT, this override causes Windows to
use the SCALE_140_PERCENT scale value, assuming that
it does not violate other constraints.

Note You should not use this value. It might be altered or


unavailable in subsequent versions of Windows. Instead,
use the GetScaleFactorForDevice function or the
DisplayProperties class to retrieve the preferred scaling
factor. Desktop applications should use desktop logical DPI
rather than scale factor. Desktop logical DPI can be
retrieved through the GetDeviceCaps function.

Retrieves the time that notification pop-ups should be


SPI_GETMESSAGEDURATION displayed, in seconds. The pvParam parameter must point to
0x2016 a ULONG that receives the message duration.
Users with visual impairments or cognitive conditions
such as ADHD and dyslexia might need a longer time to
read the text in notification messages. This flag enables
you to retrieve the message duration.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.
Retrieves the state of the Mouse ClickLock feature. The
SPI_GETMOUSECLICKLOCK pvParam parameter must point to a BOOL variable that
0x101E receives TRUE if enabled, or FALSE otherwise. For more
information, see About Mouse Input.
Windows 2000: This parameter is not supported.

Retrieves the time delay before the primary mouse button is


SPI_GETMOUSECLICKLOCKTIME locked. The pvParam parameter must point to DWORD that
0x2008 receives the time delay, in milliseconds. This is only enabled if
SPI_SETMOUSECLICKLOCK is set to TRUE . For more
information, see About Mouse Input.
Windows 2000: This parameter is not supported.

Retrieves information about the MouseKeys accessibility


SPI_GETMOUSEKEYS feature. The pvParam parameter must point to a
0x0036 MOUSEKEYS structure that receives the information. Set the
cbSize member of this structure and the uiParam parameter
to sizeof(MOUSEKEYS) .

Retrieves the state of the Mouse Sonar feature. The pvParam


SPI_GETMOUSESONAR parameter must point to a BOOL variable that receives
0x101C TRUE if enabled or FALSE otherwise. For more information,
see About Mouse Input.
Windows 2000: This parameter is not supported.

Retrieves the state of the Mouse Vanish feature. The


SPI_GETMOUSEVANISH pvParam parameter must point to a BOOL variable that
0x1020 receives TRUE if enabled or FALSE otherwise. For more
information, see About Mouse Input.
Windows 2000: This parameter is not supported.

Determines whether a screen reviewer utility is running. A


SPI_GETSCREENREADER screen reviewer utility directs textual information to an
0x0046 output device, such as a speech synthesizer or Braille display.
When this flag is set, an application should provide textual
information in situations where it would otherwise present
the information graphically.
The pvParam parameter is a pointer to a BOOL variable
that receives TRUE if a screen reviewer utility is running,
or FALSE otherwise.

Note Narrator, the screen reader that is included with


Windows, does not set the SPI_SETSCREENREADER or
SPI_GETSCREENREADER flags.

This parameter is not supported.


SPI_GETSERIALKEYS
Windows Ser ver 2003 and
0x003E
Windows XP/2000: The user should control this
setting through the Control Panel.
Determines whether the Show Sounds accessibility flag is on
SPI_GETSHOWSOUNDS or off. If it is on, the user requires an application to present
0x0038 information visually in situations where it would otherwise
present the information only in audible form. The pvParam
parameter must point to a BOOL variable that receives
TRUE if the feature is on, or FALSE if it is off.
Using this value is equivalent to calling
GetSystemMetrics with SM_SHOWSOUNDS. That is
the recommended call.

Retrieves information about the SoundSentry accessibility


SPI_GETSOUNDSENTRY feature. The pvParam parameter must point to a
0x0040 SOUNDSENTRY structure that receives the information. Set
the cbSize member of this structure and the uiParam
parameter to sizeof(SOUNDSENTRY) .

Retrieves information about the StickyKeys accessibility


SPI_GETSTICKYKEYS feature. The pvParam parameter must point to a
0x003A STICKYKEYS structure that receives the information. Set the
cbSize member of this structure and the uiParam parameter
to sizeof(STICKYKEYS) .

Retrieves information about the ToggleKeys accessibility


SPI_GETTOGGLEKEYS feature. The pvParam parameter must point to a
0x0034 TOGGLEKEYS structure that receives the information. Set the
cbSize member of this structure and the uiParam parameter
to sizeof(TOGGLEKEYS) .

Sets the time-out period associated with the accessibility


SPI_SETACCESSTIMEOUT features. The pvParam parameter must point to an
0x003D ACCESSTIMEOUT structure that contains the new
parameters. Set the cbSize member of this structure and
the uiParam parameter to sizeof(ACCESSTIMEOUT) .

Turns the audio descriptions feature on or off. The pvParam


SPI_SETAUDIODESCRIPTION parameter is a pointer to an AUDIODESCRIPTION structure.
0x0075
While it is possible for users who are visually impaired to
hear the audio in video content, there is a lot of action in
video that does not have corresponding audio. Specific
audio description of what is happening in a video helps
these users understand the content better. This flag
enables you to enable or disable audio descriptions in
the languages they are provided in.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.

Turns client area animations on or off. The pvParam


SPI_SETCLIENTAREAANIMATION parameter is a BOOL variable. Set pvParam to TRUE to
0x1043 enable animations and other transient effects in the client
area, or FALSE to disable them.
Display features such as flashing, blinking, flickering, and
moving content can cause seizures in users with photo-
sensitive epilepsy. This flag enables you to enable or
disable all such animations.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.
Turns overlapped content (such as background images and
SPI_SETDISABLEOVERL APPEDCONTENT watermarks) on or off. The pvParam parameter is a BOOL
0x1041 variable. Set pvParam to TRUE to disable overlapped
content, or FALSE to enable overlapped content.
Display features such as background images, textured
backgrounds, water marks on documents, alpha
blending, and transparency can reduce the contrast
between the foreground and background, making it
harder for users with low vision to see objects on the
screen. This flag enables you to enable or disable all such
overlapped content.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.

Sets the parameters of the FilterKeys accessibility feature.


SPI_SETFILTERKEYS The pvParam parameter must point to a FILTERKEYS
0x0033 structure that contains the new parameters. Set the cbSize
member of this structure and the uiParam parameter to
sizeof(FILTERKEYS) .

Sets the height of the top and bottom edges of the focus
SPI_SETFOCUSBORDERHEIGHT rectangle drawn with DrawFocusRect to the value of the
0x2011 pvParam parameter.
Windows 2000: This parameter is not supported.

Sets the height of the left and right edges of the focus
SPI_SETFOCUSBORDERWIDTH rectangle drawn with DrawFocusRect to the value of the
0x200F pvParam parameter.
Windows 2000: This parameter is not supported.

Sets the parameters of the HighContrast accessibility feature.


SPI_SETHIGHCONTRAST The pvParam parameter must point to a HIGHCONTRAST
0x0043 structure that contains the new parameters. Set the cbSize
member of this structure and the uiParam parameter to
sizeof(HIGHCONTRAST) .

Do not use.
SPI_SETLOGICALDPIOVERRIDE
0x009F

Sets the time that notification pop-ups should be displayed,


SPI_SETMESSAGEDURATION in seconds. The pvParam parameter specifies the message
0x2017 duration.
Users with visual impairments or cognitive conditions
such as ADHD and dyslexia might need a longer time to
read the text in notification messages. This flag enables
you to set the message duration.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.
Turns the Mouse ClickLock accessibility feature on or off. This
SPI_SETMOUSECLICKLOCK feature temporarily locks down the primary mouse button
0x101F when that button is clicked and held down for the time
specified by SPI_SETMOUSECLICKLOCKTIME . The
pvParam parameter specifies TRUE for on, or FALSE for off.
The default is off. For more information, see Remarks and
AboutMouse Input.
Windows 2000: This parameter is not supported.

Adjusts the time delay before the primary mouse button is


SPI_SETMOUSECLICKLOCKTIME locked. The uiParam parameter should be set to 0. The
0x2009 pvParam parameter points to a DWORD that specifies the
time delay in milliseconds. For example, specify 1000 for a 1
second delay. The default is 1200. For more information, see
About Mouse Input.
Windows 2000: This parameter is not supported.

Sets the parameters of the MouseKeys accessibility feature.


SPI_SETMOUSEKEYS The pvParam parameter must point to a MOUSEKEYS
0x0037 structure that contains the new parameters. Set the cbSize
member of this structure and the uiParam parameter to
sizeof(MOUSEKEYS) .

Turns the Sonar accessibility feature on or off. This feature


SPI_SETMOUSESONAR briefly shows several concentric circles around the mouse
0x101D pointer when the user presses and releases the CTRL key.
The pvParam parameter specifies TRUE for on and FALSE
for off. The default is off. For more information, see About
Mouse Input.
Windows 2000: This parameter is not supported.

Turns the Vanish feature on or off. This feature hides the


SPI_SETMOUSEVANISH mouse pointer when the user types; the pointer reappears
0x1021 when the user moves the mouse. The pvParam parameter
specifies TRUE for on and FALSE for off. The default is off.
For more information, see About Mouse Input.
Windows 2000: This parameter is not supported.

Determines whether a screen review utility is running. The


SPI_SETSCREENREADER uiParam parameter specifies TRUE for on, or FALSE for off.
0x0047
Note Narrator, the screen reader that is included with
Windows, does not set the SPI_SETSCREENREADER or
SPI_GETSCREENREADER flags.

This parameter is not supported.


SPI_SETSERIALKEYS
Windows Ser ver 2003 and
0x003F
Windows XP/2000: The user should control this
setting through the Control Panel.

Turns the ShowSounds accessibility feature on or off. The


SPI_SETSHOWSOUNDS uiParam parameter specifies TRUE for on, or FALSE for off.
0x0039
Sets the parameters of the SoundSentr y accessibility
SPI_SETSOUNDSENTRY feature. The pvParam parameter must point to a
0x0041 SOUNDSENTRY structure that contains the new parameters.
Set the cbSize member of this structure and the uiParam
parameter to sizeof(SOUNDSENTRY) .

Sets the parameters of the StickyKeys accessibility feature.


SPI_SETSTICKYKEYS The pvParam parameter must point to a STICKYKEYS
0x003B structure that contains the new parameters. Set the cbSize
member of this structure and the uiParam parameter to
sizeof(STICKYKEYS) .

Sets the parameters of the ToggleKeys accessibility feature.


SPI_SETTOGGLEKEYS The pvParam parameter must point to a TOGGLEKEYS
0x0035 structure that contains the new parameters. Set the cbSize
member of this structure and the uiParam parameter to
sizeof(TOGGLEKEYS) .

The following are the desktop parameters.

DESK TO P PA RA M ET ER M EA N IN G

Determines whether ClearType is enabled. The pvParam


SPI_GETCLEARTYPE parameter must point to a BOOL variable that receives
0x1048 TRUE if ClearType is enabled, or FALSE otherwise.
ClearType is a software technology that improves the
readability of text on liquid crystal display (LCD)
monitors.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.

Retrieves the full path of the bitmap file for the desktop
SPI_GETDESKWALLPAPER wallpaper. The pvParam parameter must point to a buffer to
0x0073 receive the null-terminated path string. Set the uiParam
parameter to the size, in characters, of the pvParam buffer.
The returned string will not exceed MAX_PATH characters. If
there is no desktop wallpaper, the returned string is empty.

Determines whether the drop shadow effect is enabled. The


SPI_GETDROPSHADOW pvParam parameter must point to a BOOL variable that
0x1024 returns TRUE if enabled or FALSE if disabled.
Windows 2000: This parameter is not supported.

Determines whether native User menus have flat menu


SPI_GETFL ATMENU appearance. The pvParam parameter must point to a BOOL
0x1022 variable that returns TRUE if the flat menu appearance is
set, or FALSE otherwise.
Windows 2000: This parameter is not supported.
Determines whether the font smoothing feature is enabled.
SPI_GETFONTSMOOTHING This feature uses font antialiasing to make font curves
0x004A appear smoother by painting pixels at different gray levels.
The pvParam parameter must point to a BOOL variable
that receives TRUE if the feature is enabled, or FALSE if
it is not.

Retrieves a contrast value that is used in ClearType


SPI_GETFONTSMOOTHINGCONTRAST smoothing. The pvParam parameter must point to a UINT
0x200C that receives the information. Valid contrast values are from
1000 to 2200. The default value is 1400.
Windows 2000: This parameter is not supported.

Retrieves the font smoothing orientation. The pvParam


SPI_GETFONTSMOOTHINGORIENTATION parameter must point to a UINT that receives the
0x2012 information. The possible values are
FE_FONTSMOOTHINGORIENTATIONBGR (blue-green-
red) and FE_FONTSMOOTHINGORIENTATIONRGB (red-
green-blue).
Windows XP/2000: This parameter is not supported
until Windows XP with SP2.

Retrieves the type of font smoothing. The pvParam


SPI_GETFONTSMOOTHINGTYPE parameter must point to a UINT that receives the
0x200A information. The possible values are
FE_FONTSMOOTHINGSTANDARD and
FE_FONTSMOOTHINGCLEARTYPE .
Windows 2000: This parameter is not supported.

Retrieves the size of the work area on the primary display


SPI_GETWORKAREA monitor. The work area is the portion of the screen not
0x0030 obscured by the system taskbar or by application desktop
toolbars. The pvParam parameter must point to a RECT
structure that receives the coordinates of the work area,
expressed in physical pixel size. Any DPI virtualization mode
of the caller has no effect on this output.
To get the work area of a monitor other than the
primary display monitor, call the GetMonitorInfo
function.

Turns ClearType on or off. The pvParam parameter is a


SPI_SETCLEARTYPE BOOL variable. Set pvParam to TRUE to enable ClearType,
0x1049 or FALSE to disable it.
ClearType is a software technology that improves the
readability of text on LCD monitors.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.

Reloads the system cursors. Set the uiParam parameter to


SPI_SETCURSORS zero and the pvParam parameter to NULL .
0x0057
Sets the current desktop pattern by causing Windows to
SPI_SETDESKPATTERN read the Pattern= setting from the WIN.INI file.
0x0015

SPI_SETDESKWALLPAPER Note When the SPI_SETDESKWALLPAPER flag is used,


0x0014 SystemParametersInfo returns TRUE unless there is an
error (like when the specified file doesn't exist).

Enables or disables the drop shadow effect. Set pvParam to


SPI_SETDROPSHADOW TRUE to enable the drop shadow effect or FALSE to disable
0x1025 it. You must also have CS_DROPSHADOW in the window
class style.
Windows 2000: This parameter is not supported.

Enables or disables flat menu appearance for native User


SPI_SETFL ATMENU menus. Set pvParam to TRUE to enable flat menu
0x1023 appearance or FALSE to disable it.
When enabled, the menu bar uses COLOR_MENUBAR
for the menubar background, COLOR_MENU for the
menu-popup background, COLOR_MENUHILIGHT for
the fill of the current menu selection, and
COLOR_HILIGHT for the outline of the current menu
selection. If disabled, menus are drawn using the same
metrics and colors as in Windows 2000.
Windows 2000: This parameter is not supported.

Enables or disables the font smoothing feature, which uses


SPI_SETFONTSMOOTHING font antialiasing to make font curves appear smoother by
0x004B painting pixels at different gray levels.
To enable the feature, set the uiParam parameter to
TRUE . To disable the feature, set uiParam to FALSE .

Sets the contrast value used in ClearType smoothing. The


SPI_SETFONTSMOOTHINGCONTRAST pvParam parameter is the contrast value. Valid contrast
0x200D values are from 1000 to 2200. The default value is 1400.
SPI_SETFONTSMOOTHINGTYPE must also be set to
FE_FONTSMOOTHINGCLEARTYPE .
Windows 2000: This parameter is not supported.

Sets the font smoothing orientation. The pvParam


SPI_SETFONTSMOOTHINGORIENTATION parameter is either
0x2013 FE_FONTSMOOTHINGORIENTATIONBGR (blue-green-
red) or FE_FONTSMOOTHINGORIENTATIONRGB (red-
green-blue).
Windows XP/2000: This parameter is not supported
until Windows XP with SP2.
Sets the font smoothing type. The pvParam parameter is
SPI_SETFONTSMOOTHINGTYPE either FE_FONTSMOOTHINGSTANDARD , if standard
0x200B anti-aliasing is used, or
FE_FONTSMOOTHINGCLEARTYPE , if ClearType is used.
The default is FE_FONTSMOOTHINGSTANDARD .
SPI_SETFONTSMOOTHING must also be set.
Windows 2000: This parameter is not supported.

Sets the size of the work area. The work area is the portion
SPI_SETWORKAREA of the screen not obscured by the system taskbar or by
0x002F application desktop toolbars. The pvParam parameter is a
pointer to a RECT structure that specifies the new work area
rectangle, expressed in virtual screen coordinates. In a
system with multiple display monitors, the function sets the
work area of the monitor that contains the specified
rectangle.

The following are the icon parameters.

IC O N PA RA M ET ER M EA N IN G

Retrieves the metrics associated with icons. The pvParam


SPI_GETICONMETRICS parameter must point to an ICONMETRICS structure that
0x002D receives the information. Set the cbSize member of this
structure and the uiParam parameter to
sizeof(ICONMETRICS) .

Retrieves the logical font information for the current icon-


SPI_GETICONTITLELOGFONT title font. The uiParam parameter specifies the size of a
0x001F LOGFONT structure, and the pvParam parameter must point
to the LOGFONT structure to fill in.

Determines whether icon-title wrapping is enabled. The


SPI_GETICONTITLEWRAP pvParam parameter must point to a BOOL variable that
0x0019 receives TRUE if enabled, or FALSE otherwise.

Sets or retrieves the width, in pixels, of an icon cell. The


SPI_ICONHORIZONTALSPACING system uses this rectangle to arrange icons in large icon
0x000D view.
To set this value, set uiParam to the new value and set
pvParam to NULL . You cannot set this value to less than
SM_CXICON.
To retrieve this value, pvParam must point to an integer
that receives the current value.

Sets or retrieves the height, in pixels, of an icon cell.


SPI_ICONVERTICALSPACING
To set this value, set uiParam to the new value and set
0x0018
pvParam to NULL . You cannot set this value to less than
SM_CYICON.
To retrieve this value, pvParam must point to an integer
that receives the current value.
Sets the metrics associated with icons. The pvParam
SPI_SETICONMETRICS parameter must point to an ICONMETRICS structure that
0x002E contains the new parameters. Set the cbSize member of this
structure and the uiParam parameter to
sizeof(ICONMETRICS) .

Reloads the system icons. Set the uiParam parameter to zero


SPI_SETICONS and the pvParam parameter to NULL .
0x0058

Sets the font that is used for icon titles. The uiParam
SPI_SETICONTITLELOGFONT parameter specifies the size of a LOGFONT structure, and
0x0022 the pvParam parameter must point to a LOGFONT
structure.

Turns icon-title wrapping on or off. The uiParam parameter


SPI_SETICONTITLEWRAP specifies TRUE for on, or FALSE for off.
0x001A

The following are the input parameters. They include parameters related to the keyboard, mouse, pen, input
language, and the warning beeper.

IN P UT PA RA M ET ER M EA N IN G

Determines whether the warning beeper is on.


SPI_GETBEEP
The pvParam parameter must point to a BOOL variable
0x0001
that receives TRUE if the beeper is on, or FALSE if it is
off.

Retrieves a BOOL indicating whether an application can


SPI_GETBLOCKSENDINPUTRESETS reset the screensaver's timer by calling the SendInput
0x1026 function to simulate keyboard or mouse input. The pvParam
parameter must point to a BOOL variable that receives
TRUE if the simulated input will be blocked, or FALSE
otherwise.

Retrieves the current contact visualization setting. The


SPI_GETCONTACTVISUALIZATION pvParam parameter must point to a ULONG variable that
0x2018 receives the setting. For more information, see Contact
Visualization.

Retrieves the input locale identifier for the system default


SPI_GETDEFAULTINPUTL ANG input language. The pvParam parameter must point to an
0x0059 HKL variable that receives this value. For more information,
see Languages, Locales, and Keyboard Layouts.

Retrieves the current gesture visualization setting. The


SPI_GETGESTUREVISUALIZATION pvParam parameter must point to a ULONG variable that
0x201A receives the setting. For more information, see Gesture
Visualization.

Determines whether menu access keys are always


SPI_GETKEYBOARDCUES underlined. The pvParam parameter must point to a BOOL
0x100A variable that receives TRUE if menu access keys are always
underlined, and FALSE if they are underlined only when the
menu is activated by the keyboard.
Retrieves the keyboard repeat-delay setting, which is a value
SPI_GETKEYBOARDDEL AY in the range from 0 (approximately 250 ms delay) through 3
0x0016 (approximately 1 second delay). The actual delay associated
with each value may vary depending on the hardware. The
pvParam parameter must point to an integer variable that
receives the setting.

Determines whether the user relies on the keyboard instead


SPI_GETKEYBOARDPREF of the mouse, and wants applications to display keyboard
0x0044 interfaces that would otherwise be hidden. The pvParam
parameter must point to a BOOL variable that receives
TRUE if the user relies on the keyboard; or FALSE
otherwise.

Retrieves the keyboard repeat-speed setting, which is a value


SPI_GETKEYBOARDSPEED in the range from 0 (approximately 2.5 repetitions per
0x000A second) through 31 (approximately 30 repetitions per
second). The actual repeat rates are hardware-dependent
and may vary from a linear scale by as much as 20%. The
pvParam parameter must point to a DWORD variable that
receives the setting.

Retrieves the two mouse threshold values and the mouse


SPI_GETMOUSE acceleration. The pvParam parameter must point to an array
0x0003 of three integers that receives these values. See
mouse_event for further information.

Retrieves the height, in pixels, of the rectangle within which


SPI_GETMOUSEHOVERHEIGHT the mouse pointer has to stay for TrackMouseEvent to
0x0064 generate a WM_MOUSEHOVER message. The pvParam
parameter must point to a UINT variable that receives the
height.

Retrieves the time, in milliseconds, that the mouse pointer


SPI_GETMOUSEHOVERTIME has to stay in the hover rectangle for TrackMouseEvent to
0x0066 generate a WM_MOUSEHOVER message. The pvParam
parameter must point to a UINT variable that receives the
time.

Retrieves the width, in pixels, of the rectangle within which


SPI_GETMOUSEHOVERWIDTH the mouse pointer has to stay for TrackMouseEvent to
0x0062 generate a WM_MOUSEHOVER message. The pvParam
parameter must point to a UINT variable that receives the
width.

Retrieves the current mouse speed. The mouse speed


SPI_GETMOUSESPEED determines how far the pointer will move based on the
0x0070 distance the mouse moves. The pvParam parameter must
point to an integer that receives a value which ranges
between 1 (slowest) and 20 (fastest). A value of 10 is the
default. The value can be set by an end-user using the
mouse control panel application or by an application using
SPI_SETMOUSESPEED .
Determines whether the Mouse Trails feature is enabled. This
SPI_GETMOUSETRAILS feature improves the visibility of mouse cursor movements
0x005E by briefly showing a trail of cursors and quickly erasing
them.
The pvParam parameter must point to an integer
variable that receives a value. if the value is zero or 1,
the feature is disabled. If the value is greater than 1, the
feature is enabled and the value indicates the number of
cursors drawn in the trail. The uiParam parameter is not
used.
Windows 2000: This parameter is not supported.

Retrieves the routing setting for wheel button input. The


SPI_GETMOUSEWHEELROUTING routing setting determines whether wheel button input is
0x201C sent to the app with focus (foreground) or the app under
the mouse cursor.
The pvParam parameter must point to a DWORD
variable that receives the routing option. If the value is
zero or MOUSEWHEEL_ROUTING_FOCUS, mouse wheel
input is delivered to the app with focus. If the value is 1
or MOUSEWHEEL_ROUTING_HYBRID (default), mouse
wheel input is delivered to the app with focus (desktop
apps) or the app under the mouse cursor (Windows
Store apps). The uiParam parameter is not used.

Retrieves the current pen gesture visualization setting. The


SPI_GETPENVISUALIZATION pvParam parameter must point to a ULONG variable that
0x201E receives the setting. For more information, see Pen
Visualization.

Determines whether the snap-to-default-button feature is


SPI_GETSNAPTODEFBUTTON enabled. If enabled, the mouse cursor automatically moves
0x005F to the default button, such as OK or Apply , of a dialog box.
The pvParam parameter must point to a BOOL variable that
receives TRUE if the feature is on, or FALSE if it is off.

Star ting with Windows 8: Determines whether the


SPI_GETSYSTEML ANGUAGEBAR system language bar is enabled or disabled. The pvParam
0x1050 parameter must point to a BOOL variable that receives
TRUE if the language bar is enabled, or FALSE otherwise.

Star ting with Windows 8: Determines whether the active


SPI_GETTHREADLOCALINPUTSETTINGS input settings have Local (per-thread, TRUE ) or Global
0x104E (session, FALSE ) scope. The pvParam parameter must point
to a BOOL variable.

Retrieves the number of characters to scroll when the


SPI_GETWHEELSCROLLCHARS horizontal mouse wheel is moved. The pvParam parameter
0x006C must point to a UINT variable that receives the number of
lines. The default value is 3.

Retrieves the number of lines to scroll when the vertical


SPI_GETWHEELSCROLLLINES mouse wheel is moved. The pvParam parameter must point
0x0068 to a UINT variable that receives the number of lines. The
default value is 3.
Turns the warning beeper on or off. The uiParam parameter
SPI_SETBEEP specifies TRUE for on, or FALSE for off.
0x0002

Determines whether an application can reset the


SPI_SETBLOCKSENDINPUTRESETS screensaver's timer by calling the SendInput function to
0x1027 simulate keyboard or mouse input. The uiParam parameter
specifies TRUE if the screensaver will not be deactivated by
simulated input, or FALSE if the screensaver will be
deactivated by simulated input.

Sets the current contact visualization setting. The pvParam


SPI_SETCONTACTVISUALIZATION parameter must point to a ULONG variable that identifies
0x2019 the setting. For more information, see Contact Visualization.

Note If contact visualizations are disabled, gesture


visualizations cannot be enabled.

Sets the default input language for the system shell and
SPI_SETDEFAULTINPUTL ANG applications. The specified language must be displayable
0x005A using the current system character set. The pvParam
parameter must point to an HKL variable that contains the
input locale identifier for the default language. For more
information, see Languages, Locales, and Keyboard Layouts.

Sets the double-click time for the mouse to the value of the
SPI_SETDOUBLECLICKTIME uiParam parameter. If the uiParam value is greater than
0x0020 5000 milliseconds, the system sets the double-click time to
5000 milliseconds.
The double-click time is the maximum number of
milliseconds that can occur between the first and second
clicks of a double-click. You can also call the
SetDoubleClickTime function to set the double-click
time. To get the current double-click time, call the
GetDoubleClickTime function.

Sets the height of the double-click rectangle to the value of


SPI_SETDOUBLECLKHEIGHT the uiParam parameter.
0x001E
The double-click rectangle is the rectangle within which
the second click of a double-click must fall for it to be
registered as a double-click.
To retrieve the height of the double-click rectangle, call
GetSystemMetrics with the SM_CYDOUBLECLK flag.

Sets the width of the double-click rectangle to the value of


SPI_SETDOUBLECLKWIDTH the uiParam parameter.
0x001D
The double-click rectangle is the rectangle within which
the second click of a double-click must fall for it to be
registered as a double-click.
To retrieve the width of the double-click rectangle, call
GetSystemMetrics with the SM_CXDOUBLECLK flag.
Sets the current gesture visualization setting. The pvParam
SPI_SETGESTUREVISUALIZATION parameter must point to a ULONG variable that identifies
0x201B the setting. For more information, see Gesture Visualization.

Note If contact visualizations are disabled, gesture


visualizations cannot be enabled.

Sets the underlining of menu access key letters. The


SPI_SETKEYBOARDCUES pvParam parameter is a BOOL variable. Set pvParam to
0x100B TRUE to always underline menu access keys, or FALSE to
underline menu access keys only when the menu is activated
from the keyboard.

Sets the keyboard repeat-delay setting. The uiParam


SPI_SETKEYBOARDDEL AY parameter must specify 0, 1, 2, or 3, where zero sets the
0x0017 shortest delay approximately 250 ms) and 3 sets the longest
delay (approximately 1 second). The actual delay associated
with each value may vary depending on the hardware.

Sets the keyboard preference. The uiParam parameter


SPI_SETKEYBOARDPREF specifies TRUE if the user relies on the keyboard instead of
0x0045 the mouse, and wants applications to display keyboard
interfaces that would otherwise be hidden; uiParam is FALSE
otherwise.

Sets the keyboard repeat-speed setting. The uiParam


SPI_SETKEYBOARDSPEED parameter must specify a value in the range from 0
0x000B (approximately 2.5 repetitions per second) through 31
(approximately 30 repetitions per second). The actual repeat
rates are hardware-dependent and may vary from a linear
scale by as much as 20%. If uiParam is greater than 31, the
parameter is set to 31.

Sets the hot key set for switching between input languages.
SPI_SETL ANGTOGGLE The uiParam and pvParam parameters are not used. The
0x005B value sets the shortcut keys in the keyboard property sheets
by reading the registry again. The registry must be set
before this flag is used. the path in the registry is
HKEY_CURRENT_USER\Keyboard Layout \Toggle
. Valid values are "1" = ALT+SHIFT, "2" = CTRL+SHIFT,
and "3" = none.

Sets the two mouse threshold values and the mouse


SPI_SETMOUSE acceleration. The pvParam parameter must point to an array
0x0004 of three integers that specifies these values. See
mouse_event for further information.

Swaps or restores the meaning of the left and right mouse


SPI_SETMOUSEBUTTONSWAP buttons. The uiParam parameter specifies TRUE to swap the
0x0021 meanings of the buttons, or FALSE to restore their original
meanings.
To retrieve the current setting, call GetSystemMetrics
with the SM_SWAPBUTTON flag.
Sets the height, in pixels, of the rectangle within which the
SPI_SETMOUSEHOVERHEIGHT mouse pointer has to stay for TrackMouseEvent to generate
0x0065 a WM_MOUSEHOVER message. Set the uiParam parameter
to the new height.

Sets the time, in milliseconds, that the mouse pointer has to


SPI_SETMOUSEHOVERTIME stay in the hover rectangle for TrackMouseEvent to generate
0x0067 a WM_MOUSEHOVER message. This is used only if you pass
HOVER_DEFAULT in the dwHoverTime parameter in the
call to TrackMouseEvent . Set the uiParamparameter to the
new time.
The time specified should be between
USER_TIMER_MAXIMUM and
USER_TIMER_MINIMUM . If uiParam is less than
USER_TIMER_MINIMUM , the function will use
USER_TIMER_MINIMUM . If uiParam is greater than
USER_TIMER_MAXIMUM , the function will be
USER_TIMER_MAXIMUM .

<b>Windows
Server 2003 and Windows XP: </b>The operating
system does not enforce the use of
<b>USER_TIMER_MAXIMUM</b> and
<b>USER_TIMER_MINIMUM</b> until Windows
Server 2003 with SP1 and Windows XP with SP2.

Sets the width, in pixels, of the rectangle within which the


SPI_SETMOUSEHOVERWIDTH mouse pointer has to stay for TrackMouseEvent to generate
0x0063 a WM_MOUSEHOVER message. Set the uiParam parameter
to the new width.

Sets the current mouse speed. The pvParam parameter is an


SPI_SETMOUSESPEED integer between 1 (slowest) and 20 (fastest). A value of 10 is
0x0071 the default. This value is typically set using the mouse
control panel application.

Enables or disables the Mouse Trails feature, which improves


SPI_SETMOUSETRAILS the visibility of mouse cursor movements by briefly showing
0x005D a trail of cursors and quickly erasing them.
To disable the feature, set the uiParam parameter to zero
or 1. To enable the feature, set uiParam to a value
greater than 1 to indicate the number of cursors drawn
in the trail.
Windows 2000: This parameter is not supported.

Sets the routing setting for wheel button input. The routing
SPI_SETMOUSEWHEELROUTING setting determines whether wheel button input is sent to
0x201D the app with focus (foreground) or the app under the mouse
cursor.
The pvParam parameter must point to a DWORD
variable that receives the routing option. If the value is
zero or MOUSEWHEEL_ROUTING_FOCUS, mouse wheel
input is delivered to the app with focus. If the value is 1
or MOUSEWHEEL_ROUTING_HYBRID (default), mouse
wheel input is delivered to the app with focus (desktop
apps) or the app under the mouse cursor (Windows
Store apps). Set the uiParam parameter to zero.
Sets the current pen gesture visualization setting. The
SPI_SETPENVISUALIZATION pvParam parameter must point to a ULONG variable that
0x201F identifies the setting. For more information, see Pen
Visualization.

Enables or disables the snap-to-default-button feature. If


SPI_SETSNAPTODEFBUTTON enabled, the mouse cursor automatically moves to the
0x0060 default button, such as OK or Apply , of a dialog box. Set
the uiParam parameter to TRUE to enable the feature, or
FALSE to disable it. Applications should use the
ShowWindow function when displaying a dialog box so the
dialog manager can position the mouse cursor.

Star ting with Windows 8: Turns the legacy language bar


SPI_SETSYSTEML ANGUAGEBAR feature on or off. The pvParam parameter is a pointer to a
0x1051 BOOL variable. Set pvParam to TRUE to enable the legacy
language bar, or FALSE to disable it. The flag is supported
on Windows 8 where the legacy language bar is replaced by
Input Switcher and therefore turned off by default. Turning
the legacy language bar on is provided for compatibility
reasons and has no effect on the Input Switcher.

Star ting with Windows 8: Determines whether the active


SPI_SETTHREADLOCALINPUTSETTINGS input settings have Local (per-thread, TRUE ) or Global
0x104F (session, FALSE ) scope. The pvParam parameter must point
to a BOOL variable, casted by PVOID.

Sets the number of characters to scroll when the horizontal


SPI_SETWHEELSCROLLCHARS mouse wheel is moved. The number of characters is set from
0x006D the uiParam parameter.

Sets the number of lines to scroll when the vertical mouse


SPI_SETWHEELSCROLLLINES wheel is moved. The number of lines is set from the uiParam
0x0069 parameter.
The number of lines is the suggested number of lines to
scroll when the mouse wheel is rolled without using
modifier keys. If the number is 0, then no scrolling
should occur. If the number of lines to scroll is greater
than the number of lines viewable, and in particular if it
is WHEEL_PAGESCROLL (#defined as UINT_MAX ),
the scroll operation should be interpreted as clicking
once in the page down or page up regions of the scroll
bar.

The following are the menu parameters.

M EN U PA RA M ET ER M EA N IN G

Determines whether pop-up menus are left-aligned or right-


SPI_GETMENUDROPALIGNMENT aligned, relative to the corresponding menu-bar item. The
0x001B pvParam parameter must point to a BOOL variable that
receives TRUE if right-aligned, or FALSE otherwise.
Determines whether menu fade animation is enabled. The
SPI_GETMENUFADE pvParam parameter must point to a BOOL variable that
0x1012 receives TRUE when fade animation is enabled and FALSE
when it isdisabled. If fade animation is disabled, menus use
slide animation. This flag is ignored unless menu animation is
enabled, which you can do using the
SPI_SETMENUANIMATION flag. For more information,
see AnimateWindow.

Retrieves the time, in milliseconds, that the system waits


SPI_GETMENUSHOWDEL AY before displaying a shortcut menu when the mouse cursor is
0x006A over a submenu item. The pvParam parameter must point to
a DWORD variable that receives the time of the delay.

Sets the alignment value of pop-up menus. The uiParam


SPI_SETMENUDROPALIGNMENT parameter specifies TRUE for right alignment, or FALSE for
0x001C left alignment.

Enables or disables menu fade animation. Set pvParam to


SPI_SETMENUFADE TRUE to enable the menu fade effect or FALSE to disable it.
0x1013 If fade animation is disabled, menus use slide animation. he
The menu fade effect is possible only if the system has a
color depth of more than 256 colors. This flag is ignored
unless SPI_MENUANIMATION is also set. For more
information, see AnimateWindow.

Sets uiParam to the time, in milliseconds, that the system


SPI_SETMENUSHOWDEL AY waits before displaying a shortcut menu when the mouse
0x006B cursor is over a submenu item.

The following are the power parameters.


Beginning with Windows Server 2008 and Windows Vista, these power parameters are not supported. Instead,
to determine the current display power state, an application should register for
GUID_MONITOR_POWER_STATE notifications. To determine the current display power down time-out, an
application should register for notification of changes to the GUID_VIDEO_POWERDOWN_TIMEOUT power
setting. For more information, see Registering for Power Events.
Windows Ser ver 2003 and Windows XP/2000: To determine the current display power state, use the
following power parameters.

P O W ER PA RA M ET ER M EA N IN G

This parameter is not supported.


SPI_GETLOWPOWERACTIVE
Windows Ser ver 2003 and
0x0053
Windows XP/2000: Determines whether the low-
power phase of screen saving is enabled. The pvParam
parameter must point to a BOOL variable that receives
TRUE if enabled, or FALSE if disabled. This flag is
supported for 32-bit applications only.
This parameter is not supported.
SPI_GETLOWPOWERTIMEOUT
Windows Ser ver 2003 and
0x004F
Windows XP/2000: Retrieves the time-out value for
the low-power phase of screen saving. The pvParam
parameter must point to an integer variable that
receives the value. This flag is supported for 32-bit
applications only.

This parameter is not supported. When the power-off phase


SPI_GETPOWEROFFACTIVE of screen saving is enabled, the
0x0054 GUID_VIDEO_POWERDOWN_TIMEOUT power setting is
greater than zero.
Windows Ser ver 2003 and
Windows XP/2000: Determines whether the power-
off phase of screen saving is enabled. The pvParam
parameter must point to a BOOL variable that receives
TRUE if enabled, or FALSE if disabled. This flag is
supported for 32-bit applications only.

This parameter is not supported. Instead, check the


SPI_GETPOWEROFFTIMEOUT GUID_VIDEO_POWERDOWN_TIMEOUT power setting.
0x0050
Windows Ser ver 2003 and
Windows XP/2000: Retrieves the time-out value for
the power-off phase of screen saving. The pvParam
parameter must point to an integer variable that
receives the value. This flag is supported for 32-bit
applications only.

This parameter is not supported.


SPI_SETLOWPOWERACTIVE
Windows Ser ver 2003 and
0x0055
Windows XP/2000: Activates or deactivates the low-
power phase of screen saving. Set uiParam to 1 to
activate, or zero to deactivate. The pvParam parameter
must be NULL . This flag is supported for 32-bit
applications only.

This parameter is not supported.


SPI_SETLOWPOWERTIMEOUT
Windows Ser ver 2003 and
0x0051
Windows XP/2000: Sets the time-out value, in
seconds, for the low-power phase of screen saving. The
uiParam parameter specifies the new value. The pvParam
parameter must be NULL . This flag is supported for 32-
bit applications only.

This parameter is not supported. Instead, set the


SPI_SETPOWEROFFACTIVE GUID_VIDEO_POWERDOWN_TIMEOUT power setting.
0x0056
Windows Ser ver 2003 and
Windows XP/2000: Activates or deactivates the
power-off phase of screen saving. Set uiParam to 1 to
activate, or zero to deactivate. The pvParam parameter
must be NULL . This flag is supported for 32-bit
applications only.
This parameter is not supported. Instead, set the
SPI_SETPOWEROFFTIMEOUT GUID_VIDEO_POWERDOWN_TIMEOUT power setting
0x0052 to a time-out value.
Windows Ser ver 2003 and
Windows XP/2000: Sets the time-out value, in
seconds, for the power-off phase of screen saving. The
uiParam parameter specifies the new value. The pvParam
parameter must be NULL . This flag is supported for 32-
bit applications only.

The following are the screen saver parameters.

SC REEN SAVER PA RA M ET ER M EA N IN G

Determines whether screen saving is enabled. The pvParam


SPI_GETSCREENSAVEACTIVE parameter must point to a BOOL variable that receives
0x0010 TRUE if screen saving is enabled, or FALSE otherwise.
Windows 7, Windows Ser ver 2008 R2 and
Windows 2000: The function returns TRUE even
when screen saving is not enabled. For more information
and a workaround, see KB318781.

Determines whether a screen saver is currently running on


SPI_GETSCREENSAVERRUNNING the window station of the calling process. The pvParam
0x0072 parameter must point to a BOOL variable that receives
TRUE if a screen saver is currently running, or FALSE
otherwise. Note that only the interactive window station,
WinSta0, can have a screen saver running.

Determines whether the screen saver requires a password to


SPI_GETSCREENSAVESECURE display the Windows desktop. The pvParam parameter must
0x0076 point to a BOOL variable that receives TRUE if the screen
saver requires a password, or FALSE otherwise. The uiParam
parameter is ignored.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.

Retrieves the screen saver time-out value, in seconds. The


SPI_GETSCREENSAVETIMEOUT pvParam parameter must point to an integer variable that
0x000E receives the value.

Sets the state of the screen saver. The uiParam parameter


SPI_SETSCREENSAVEACTIVE specifies TRUE to activate screen saving, or FALSE to
0x0011 deactivate it.
If the machine has entered power saving mode or
system lock state, an ERROR_OPERATION_IN_PROGRESS
exception occurs.
Sets whether the screen saver requires the user to enter a
SPI_SETSCREENSAVESECURE password to display the Windows desktop. The uiParam
0x0077 parameter is a BOOL variable. The pvParam parameter is
ignored. Set uiParam to TRUE to require a password, or
FALSE to not require a password.
If the machine has entered power saving mode or
system lock state, an ERROR_OPERATION_IN_PROGRESS
exception occurs.
Windows Ser ver 2003 and
Windows XP/2000: This parameter is not supported.

Sets the screen saver time-out value to the value of the


SPI_SETSCREENSAVETIMEOUT uiParam parameter. This value is the amount of time, in
0x000F seconds, that the system must be idle before the screen
saver activates.
If the machine has entered power saving mode or
system lock state, an ERROR_OPERATION_IN_PROGRESS
exception occurs.

The following are the time-out parameters for applications and services.

T IM E- O UT PA RA M ET ER M EA N IN G

Retrieves the number of milliseconds that a thread can go


SPI_GETHUNGAPPTIMEOUT without dispatching a message before the system considers
0x0078 it unresponsive. The pvParam parameter must point to an
integer variable that receives the value.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Retrieves the number of milliseconds that the system waits


SPI_GETWAITTOKILLTIMEOUT before terminating an application that does not respond to a
0x007A shutdown request. The pvParam parameter must point to an
integer variable that receives the value.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Retrieves the number of milliseconds that the service control


SPI_GETWAITTOKILLSERVICETIMEOUT manager waits before terminating a service that does not
0x007C respond to a shutdown request. The pvParam parameter
must point to an integer variable that receives the value.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Sets the hung application time-out to the value of the


SPI_SETHUNGAPPTIMEOUT uiParam parameter. This value is the number of milliseconds
0x0079 that a thread can go without dispatching a message before
the system considers it unresponsive.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.
Sets the application shutdown request time-out to the value
SPI_SETWAITTOKILLTIMEOUT of the uiParam parameter. This value is the number of
0x007B milliseconds that the system waits before terminating an
application that does not respond to a shutdown request.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Sets the service shutdown request time-out to the value of


SPI_SETWAITTOKILLSERVICETIMEOUT the uiParam parameter. This value is the number of
0x007D milliseconds that the system waits before terminating a
service that does not respond to a shutdown request.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

The following are the UI effects. The SPI_SETUIEFFECTS value is used to enable or disable all UI effects at once.
This table contains the complete list of UI effect values.

UI EF F EC T S PA RA M ET ER M EA N IN G

Determines whether the slide-open effect for combo boxes is


SPI_GETCOMBOBOXANIMATION enabled. The pvParam parameter must point to a BOOL
0x1004 variable that receives TRUE for enabled, or FALSE for
disabled.

Determines whether the cursor has a shadow around it. The


SPI_GETCURSORSHADOW pvParam parameter must point to a BOOL variable that
0x101A receives TRUE if the shadow is enabled, FALSE if it is
disabled. This effect appears only if the system has a color
depth of more than 256 colors.

Determines whether the gradient effect for window title bars


SPI_GETGRADIENTCAPTIONS is enabled. The pvParam parameter must point to a BOOL
0x1008 variable that receives TRUE for enabled, or FALSE for
disabled. For more information about the gradient effect, see
the GetSysColor function.

Determines whether hot tracking of user-interface elements,


SPI_GETHOTTRACKING such as menu names on menu bars, is enabled. The pvParam
0x100E parameter must point to a BOOL variable that receives
TRUE for enabled, or FALSE for disabled.
Hot tracking means that when the cursor moves over an
item, it is highlighted but not selected. You can query
this value to decide whether to use hot tracking in the
user interface of your application.

Determines whether the smooth-scrolling effect for list


SPI_GETLISTBOXSMOOTHSCROLLING boxes is enabled. The pvParam parameter must point to a
0x1006 BOOL variable that receives TRUE for enabled, or FALSE for
disabled.
Determines whether the menu animation feature is enabled.
SPI_GETMENUANIMATION This master switch must be on to enable menu animation
0x1002 effects. The pvParam parameter must point to a BOOL
variable that receives TRUE if animation is enabled and
FALSE if it is disabled.
If animation is enabled, SPI_GETMENUFADE indicates
whether menus use fade or slide animation.

Same as SPI_GETKEYBOARDCUES.
SPI_GETMENUUNDERLINES
0x100A

Determines whether the selection fade effect is enabled. The


SPI_GETSELECTIONFADE pvParam parameter must point to a BOOL variable that
0x1014 receives TRUE if enabled or FALSE if disabled.
The selection fade effect causes the menu item selected
by the user to remain on the screen briefly while fading
out after the menu is dismissed.

Determines whether ToolTip animation is enabled. The


SPI_GETTOOLTIPANIMATION pvParam parameter must point to a BOOL variable that
0x1016 receives TRUE if enabled or FALSE if disabled. If ToolTip
animation is enabled, SPI_GETTOOLTIPFADE indicates
whether ToolTips use fade or slide animation.

If SPI_SETTOOLTIPANIMATION is enabled,
SPI_GETTOOLTIPFADE SPI_GETTOOLTIPFADE indicates whether ToolTip
0x1018 animation uses a fade effect or a slide effect. The pvParam
parameter must point to a BOOL variable that receives
TRUE for fade animation or FALSE for slide animation. For
more information on slide and fade effects, see
AnimateWindow.

Determines whether UI effects are enabled or disabled. The


SPI_GETUIEFFECTS pvParam parameter must point to a BOOL variable that
0x103E receives TRUE if all UI effects are enabled, or FALSE if they
are disabled.

Enables or disables the slide-open effect for combo boxes.


SPI_SETCOMBOBOXANIMATION Set the pvParam parameter to TRUE to enable the gradient
0x1005 effect, or FALSE to disable it.

Enables or disables a shadow around the cursor. The


SPI_SETCURSORSHADOW pvParam parameter is a BOOL variable. Set pvParam to
0x101B TRUE to enable the shadow or FALSE to disable the
shadow. This effect appears only if the system has a color
depth of more than 256 colors.

Enables or disables the gradient effect for window title bars.


SPI_SETGRADIENTCAPTIONS Set the pvParam parameter to TRUE to enable it, or FALSE
0x1009 to disable it. The gradient effect is possible only if the system
has a color depth of more than 256 colors. For more
information about the gradient effect, see the GetSysColor
function.
Enables or disables hot tracking of user-interface elements
SPI_SETHOTTRACKING such as menu names on menu bars. Set the pvParam
0x100F parameter to TRUE to enable it, or FALSE to disable it.
Hot-tracking means that when the cursor moves over an
item, it is highlighted but not selected.

Enables or disables the smooth-scrolling effect for list boxes.


SPI_SETLISTBOXSMOOTHSCROLLING Set the pvParam parameter to TRUE to enable the smooth-
0x1007 scrolling effect, or FALSE to disable it.

Enables or disables menu animation. This master switch


SPI_SETMENUANIMATION must be on for any menu animation to occur. The pvParam
0x1003 parameter is a BOOL variable; set pvParam to TRUE to
enable animation and FALSE to disable animation.
If animation is enabled, SPI_GETMENUFADE indicates
whether menus use fade or slide animation.

Same as SPI_SETKEYBOARDCUES.
SPI_SETMENUUNDERLINES
0x100B

Set pvParam to TRUE to enable the selection fade effect or


SPI_SETSELECTIONFADE FALSE to disable it.
0x1015
The selection fade effect causes the menu item selected
by the user to remain on the screen briefly while fading
out after the menu is dismissed. The selection fade effect
is possible only if the system has a color depth of more
than 256 colors.

Set pvParam to TRUE to enable ToolTip animation or FALSE


SPI_SETTOOLTIPANIMATION to disable it. If enabled, you can use SPI_SETTOOLTIPFADE
0x1017 to specify fade or slide animation.

If the SPI_SETTOOLTIPANIMATION flag is enabled, use


SPI_SETTOOLTIPFADE SPI_SETTOOLTIPFADE to indicate whether ToolTip
0x1019 animation uses a fade effect or a slide effect. Set pvParam to
TRUE for fade animation or FALSE for slide animation. The
tooltip fade effect is possible only if the system has a color
depth of more than 256 colors. For more information on the
slide and fade effects, see the AnimateWindowfunction.

Enables or disables UI effects. Set the pvParam parameter to


SPI_SETUIEFFECTS TRUE to enable all UI effects or FALSE to disable all UI
0x103F effects.

The following are the window parameters.

W IN DO W PA RA M ET ER M EA N IN G

Determines whether active window tracking (activating the


SPI_GETACTIVEWINDOWTRACKING window the mouse is on) is on or off. The pvParam
0x1000 parameter must point to a BOOL variable that receives
TRUE for on, or FALSE for off.
Determines whether windows activated through active
SPI_GETACTIVEWNDTRKZORDER window tracking will be brought to the top. The pvParam
0x100C parameter must point to a BOOL variable that receives
TRUE for on, or FALSE for off.

Retrieves the active window tracking delay, in milliseconds.


SPI_GETACTIVEWNDTRKTIMEOUT The pvParam parameter must point to a DWORD variable
0x2002 that receives the time.

Retrieves the animation effects associated with user actions.


SPI_GETANIMATION The pvParam parameter must point to an ANIMATIONINFO
0x0048 structure that receives the information. Set the cbSize
member of this structure and the uiParam parameter to
sizeof(ANIMATIONINFO) .

Retrieves the border multiplier factor that determines the


SPI_GETBORDER width of a window's sizing border. The pvParamparameter
0x0005 must point to an integer variable that receives this value.

Retrieves the caret width in edit controls, in pixels. The


SPI_GETCARETWIDTH pvParam parameter must point to a DWORD variable that
0x2006 receives this value.

Determines whether a window is docked when it is moved to


SPI_GETDOCKMOVING the top, left, or right edges of a monitor or monitor array.
0x0090 The pvParam parameter must point to a BOOL variable that
receives TRUE if enabled, or FALSE otherwise.
Use SPI_GETWINARRANGING to determine whether
this behavior is enabled.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Determines whether a maximized window is restored when


SPI_GETDRAGFROMMAXIMIZE its caption bar is dragged. The pvParam parameter must
0x008C point to a BOOL variable that receives TRUE if enabled, or
FALSE otherwise.
Use SPI_GETWINARRANGING to determine whether
this behavior is enabled.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Determines whether dragging of full windows is enabled. The


SPI_GETDRAGFULLWINDOWS pvParam parameter must point to a BOOL variable that
0x0026 receives TRUE if enabled, or FALSE otherwise.

Retrieves the number of times SetForegroundWindow will


SPI_GETFOREGROUNDFL ASHCOUNT flash the taskbar button when rejecting a foreground switch
0x2004 request. The pvParam parameter must point to a DWORD
variable that receives the value.
Retrieves the amount of time following user input, in
SPI_GETFOREGROUNDLOCKTIMEOUT milliseconds, during which the system will not allow
0x2000 applications to force themselves into the foreground. The
pvParam parameter must point to a DWORD variable that
receives the time.

Retrieves the metrics associated with minimized windows.


SPI_GETMINIMIZEDMETRICS The pvParam parameter must point to a
0x002B MINIMIZEDMETRICS structure that receives the information.
Set the cbSize member of this structure and the uiParam
parameter to sizeof(MINIMIZEDMETRICS) .

Retrieves the threshold in pixels where docking behavior is


SPI_GETMOUSEDOCKTHRESHOLD triggered by using a mouse to drag a window to the edge of
0x007E a monitor or monitor array. The default threshold is 1. The
pvParam parameter must point to a DWORD variable that
receives the value.
Use SPI_GETWINARRANGING to determine whether
this behavior is enabled.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Retrieves the threshold in pixels where undocking behavior is


SPI_GETMOUSEDRAGOUTTHRESHOLD triggered by using a mouse to drag a window from the edge
0x0084 of a monitor or a monitor array toward the center. The
default threshold is 20.
Use SPI_GETWINARRANGING to determine whether
this behavior is enabled.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Retrieves the threshold in pixels from the top of a monitor or


SPI_GETMOUSESIDEMOVETHRESHOLD a monitor array where a vertically maximized window is
0x0088 restored when dragged with the mouse. The default
threshold is 50.
Use SPI_GETWINARRANGING to determine whether
this behavior is enabled.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Retrieves the metrics associated with the nonclient area of


SPI_GETNONCLIENTMETRICS nonminimized windows. The pvParam parameter must point
0x0029 to a NONCLIENTMETRICS structure that receives the
information. Set the cbSize member of this structure and
the uiParam parameter to sizeof(NONCLIENTMETRICS) .
Retrieves the threshold in pixels where docking
SPI_GETPENDOCKTHRESHOLD behavior is triggered by using a pen to drag a
0x0080 window to the edge of a monitor or monitor array.
The default is 30.
Use SPI_GETWINARRANGING to determine whether
this behavior is enabled.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Retrieves the threshold in pixels where undocking behavior is


SPI_GETPENDRAGOUTTHRESHOLD triggered by using a pen to drag a window from the edge of
0x0086 a monitor or monitor array toward its center. The default
threshold is 30.
Use SPI_GETWINARRANGING to determine whether
this behavior is enabled.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Retrieves the threshold in pixels from the top of a monitor or


SPI_GETPENSIDEMOVETHRESHOLD monitor array where a vertically maximized window is
0x008A restored when dragged with the mouse. The default
threshold is 50.
Use SPI_GETWINARRANGING to determine whether
this behavior is enabled.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Determines whether the IME status window is visible (on a


SPI_GETSHOWIMEUI per-user basis). The pvParam parameter must point to a
0x006E BOOL variable that receives TRUE if the status window is
visible, or FALSE if it is not.

Determines whether a window is vertically maximized when


SPI_GETSNAPSIZING it is sized to the top or bottom of a monitor or monitor
0x008E array. The pvParam parameter must point to a BOOL
variable that receives TRUE if enabled, or FALSE otherwise.
Use SPI_GETWINARRANGING to determine whether
this behavior is enabled.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.
Determines whether window arrangement is enabled. The
SPI_GETWINARRANGING pvParam parameter must point to a BOOL variable that
0x0082 receives TRUE if enabled, or FALSE otherwise.
Window arrangement reduces the number of mouse,
pen, or touch interactions needed to move and size top-
level windows by simplifying the default behavior of a
window when it is dragged or sized.
The following parameters retrieve individual window
arrangement settings:
SPI_GETDOCKMOVING
SPI_GETMOUSEDOCKTHRESHOLD
SPI_GETMOUSEDRAGOUTTHRESHOLD
SPI_GETMOUSESIDEMOVETHRESHOLD
SPI_GETPENDOCKTHRESHOLD
SPI_GETPENDRAGOUTTHRESHOLD
SPI_GETPENSIDEMOVETHRESHOLD
SPI_GETSNAPSIZING
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This parameter is
not supported.

Sets active window tracking (activating the window the


SPI_SETACTIVEWINDOWTRACKING mouse is on) either on or off. Set pvParam to TRUE for on or
0x1001 FALSE for off.

Determines whether or not windows activated through


SPI_SETACTIVEWNDTRKZORDER active window tracking should be brought to the top. Set
0x100D pvParam to TRUE for on or FALSE for off.

Sets the active window tracking delay. Set pvParam to the


SPI_SETACTIVEWNDTRKTIMEOUT number of milliseconds to delay before activating the
0x2003 window under the mouse pointer.

Sets the animation effects associated with user actions. The


SPI_SETANIMATION pvParam parameter must point to an ANIMATIONINFO
0x0049 structure that contains the new parameters. Set the cbSize
member of this structure and the uiParam parameter to
sizeof(ANIMATIONINFO) .

Sets the border multiplier factor that determines the width


SPI_SETBORDER of a window's sizing border. The uiParam parameter specifies
0x0006 the new value.

Sets the caret width in edit controls. Set pvParam to the


SPI_SETCARETWIDTH desired width, in pixels. The default and minimum value is 1.
0x2007

Sets whether a window is docked when it is moved to the


SPI_SETDOCKMOVING top, left, or right docking targets on a monitor or monitor
0x0091 array. Set pvParam to TRUE for on or FALSE for off.
SPI_GETWINARRANGING must be TRUE to enable
this behavior.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.
Sets whether a maximized window is restored when its
SPI_SETDRAGFROMMAXIMIZE caption bar is dragged. Set pvParam to TRUE for on or
0x008D FALSE for off.
SPI_GETWINARRANGING must be TRUE to enable
this behavior.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Sets dragging of full windows either on or off. The uiParam


SPI_SETDRAGFULLWINDOWS parameter specifies TRUE for on, or FALSE for off.
0x0025

Sets the height, in pixels, of the rectangle used to detect the


SPI_SETDRAGHEIGHT start of a drag operation. Set uiParam to the new value. To
0x004D retrieve the drag height, call GetSystemMetrics with the
SM_CYDRAG flag.

Sets the width, in pixels, of the rectangle used to detect the


SPI_SETDRAGWIDTH start of a drag operation. Set uiParam to the new value. To
0x004C retrieve the drag width, call GetSystemMetrics with the
SM_CXDRAG flag.

Sets the number of times SetForegroundWindow will flash


SPI_SETFOREGROUNDFL ASHCOUNT the taskbar button when rejecting a foreground switch
0x2005 request. Set pvParam to the number of times to flash.

Sets the amount of time following user input, in milliseconds,


SPI_SETFOREGROUNDLOCKTIMEOUT during which the system does not allow applications to force
0x2001 themselves into the foreground. Set pvParam to the new
time-out value.
The calling thread must be able to change the
foreground window, otherwise the call fails.

Sets the metrics associated with minimized windows. The


SPI_SETMINIMIZEDMETRICS pvParam parameter must point to a MINIMIZEDMETRICS
0x002C structure that contains the new parameters. Set the cbSize
member of this structure and the uiParam parameter to
sizeof(MINIMIZEDMETRICS) .

Sets the threshold in pixels where docking behavior is


SPI_SETMOUSEDOCKTHRESHOLD triggered by using a mouse to drag a window to the edge of
0x007F a monitor or monitor array. The default threshold is 1. The
pvParam parameter must point to a DWORD variable that
contains the new value.
SPI_GETWINARRANGING must be TRUE to enable
this behavior.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.
Sets the threshold in pixels where undocking behavior is
SPI_SETMOUSEDRAGOUTTHRESHOLD triggered by using a mouse to drag a window from the edge
0x0085 of a monitor or monitor array to its center. The default
threshold is 20. The pvParam parameter must point to a
DWORD variable that contains the new value.
SPI_GETWINARRANGING must be TRUE to enable
this behavior.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Sets the threshold in pixels from the top of the monitor


SPI_SETMOUSESIDEMOVETHRESHOLD where a vertically maximized window is restored when
0x0089 dragged with the mouse. The default threshold is 50. The
pvParam parameter must point to a DWORD variable that
contains the new value.
SPI_GETWINARRANGING must be TRUE to enable
this behavior.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Sets the metrics associated with the nonclient area of


SPI_SETNONCLIENTMETRICS nonminimized windows. The pvParam parameter must point
0x002A to a NONCLIENTMETRICS structure that contains the new
parameters. Set the cbSize member of this structure and
the uiParam parameter to sizeof(NONCLIENTMETRICS) .
Also, the lfHeight member of the LOGFONT structure must
be a negative value.

Sets the threshold in pixels where docking behavior is


SPI_SETPENDOCKTHRESHOLD triggered by using a pen to drag a window to the edge of a
0x0081 monitor or monitor array. The default threshold is 30. The
pvParam parameter must point to a DWORD variable that
contains the new value.
SPI_GETWINARRANGING must be TRUE to enable
this behavior.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Sets the threshold in pixels where undocking behavior is


SPI_SETPENDRAGOUTTHRESHOLD triggered by using a pen to drag a window from the edge of
0x0087 a monitor or monitor array to its center. The default
threshold is 30. The pvParam parameter must point to a
DWORD variable that contains the new value.
SPI_GETWINARRANGING must be TRUE to enable
this behavior.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.
Sets the threshold in pixels from the top of the monitor
SPI_SETPENSIDEMOVETHRESHOLD where a vertically maximized window is restored when
0x008B dragged with a pen. The default threshold is 50. The
pvParam parameter must point to a DWORD variable that
contains the new value.
SPI_GETWINARRANGING must be TRUE to enable
this behavior.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Sets whether the IME status window is visible or not on a


SPI_SETSHOWIMEUI per-user basis. The uiParam parameter specifies TRUE for on
0x006F or FALSE for off.

Sets whether a window is vertically maximized when it is


SPI_SETSNAPSIZING sized to the top or bottom of the monitor. Set pvParam to
0x008F TRUE for on or FALSE for off.
SPI_GETWINARRANGING must be TRUE to enable
this behavior.
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This
parameter is not supported.

Sets whether window arrangement is enabled. Set pvParam


SPI_SETWINARRANGING to TRUE for on or FALSE for off.
0x0083
Window arrangement reduces the number of mouse,
pen, or touch interactions needed to move and size top-
level windows by simplifying the default behavior of a
window when it is dragged or sized.
The following parameters set individual window
arrangement settings:
SPI_SETDOCKMOVING
SPI_SETMOUSEDOCKTHRESHOLD
SPI_SETMOUSEDRAGOUTTHRESHOLD
SPI_SETMOUSESIDEMOVETHRESHOLD
SPI_SETPENDOCKTHRESHOLD
SPI_SETPENDRAGOUTTHRESHOLD
SPI_SETPENSIDEMOVETHRESHOLD
SPI_SETSNAPSIZING
Windows Ser ver 2008, Windows Vista, Windows
Ser ver 2003 and Windows XP/2000: This parameter is
not supported.

uiParam

Type: UINT
A parameter whose usage and format depends on the system parameter being queried or set. For more
information about system-wide parameters, see the uiAction parameter. If not otherwise indicated, you must
specify zero for this parameter.
pvParam

Type: PVOID
A parameter whose usage and format depends on the system parameter being queried or set. For more
information about system-wide parameters, see the uiAction parameter. If not otherwise indicated, you must
specify NULL for this parameter. For information on the PVOID datatype, see Windows Data Types.
fWinIni

Type: UINT
If a system parameter is being set, specifies whether the user profile is to be updated, and if so, whether the
WM_SETTINGCHANGE message is to be broadcast to all top-level windows to notify them of the change.
This parameter can be zero if you do not want to update the user profile or broadcast the WM_SETTINGCHANGE
message, or it can be one or more of the following values.

VA L UE M EA N IN G

Writes the new system-wide parameter setting to the user


SPIF_UPDATEINIFILE profile.

Broadcasts the WM_SETTINGCHANGE message after


SPIF_SENDCHANGE updating the user profile.

Same as SPIF_SENDCHANGE .
SPIF_SENDWININICHANGE

Return value
Type: BOOL
If the function succeeds, the return value is a nonzero value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
This function is intended for use with applications that allow the user to customize the environment.
A keyboard layout name should be derived from the hexadecimal value of the language identifier corresponding
to the layout. For example, U.S. English has a language identifier of 0x0409, so the primary U.S. English layout is
named "00000409". Variants of U.S. English layout, such as the Dvorak layout, are named "00010409",
"00020409" and so on. For a list of the primary language identifiers and sublanguage identifiers that make up a
language identifier, see the MAKEL ANGID macro.
There is a difference between the High Contrast color scheme and the High Contrast Mode. The High Contrast
color scheme changes the system colors to colors that have obvious contrast; you switch to this color scheme by
using the Display Options in the control panel. The High Contrast Mode, which uses SPI_GETHIGHCONTRAST
and SPI_SETHIGHCONTRAST , advises applications to modify their appearance for visually-impaired users. It
involves such things as audible warning to users and customized color scheme (using the Accessibility Options
in the control panel). For more information, see HIGHCONTRAST. For more information on general accessibility
features, see Accessibility.
During the time that the primary button is held down to activate the Mouse ClickLock feature, the user can
move the mouse. After the primary button is locked down, releasing the primary button does not result in a
WM_LBUTTONUP message. Thus, it will appear to an application that the primary button is still down. Any
subsequent button message releases the primary button, sending a WM_LBUTTONUP message to the
application, thus the button can be unlocked programmatically or through the user clicking any button.
This API is not DPI aware, and should not be used if the calling thread is per-monitor DPI aware. For the DPI-
aware version of this API, see SystemParametersInfoForDPI. For more information on DPI awareness, see the
Windows High DPI documentation.
Examples
The following example uses SystemParametersInfo to double the mouse speed.

#include <windows.h>
#include <stdio.h>
#pragma comment(lib, "user32.lib")

void main()
{
BOOL fResult;
int aMouseInfo[3]; // Array for mouse information

// Get the current mouse speed.


fResult = SystemParametersInfo(SPI_GETMOUSE, // Get mouse information
0, // Not used
&aMouseInfo, // Holds mouse information
0); // Not used

// Double it.
if( fResult )
{
aMouseInfo[2] = 2 * aMouseInfo[2];

// Change the mouse speed to the new value.


SystemParametersInfo(SPI_SETMOUSE, // Set mouse information
0, // Not used
aMouseInfo, // Mouse information
SPIF_SENDCHANGE); // Update Win.ini
}
}

NOTE
The winuser.h header defines SystemParametersInfo as an alias which automatically selects the ANSI or Unicode version of
this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias
with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib
DLL User32.dll

API set ext-ms-win-ntuser-sysparams-ext-l1-1-0 (introduced in


Windows 8)

See also
ACCESSTIMEOUT
ANIMATIONINFO
AUDIODESCRIPTION
FILTERKEYS
HIGHCONTRAST
ICONMETRICS
LOGFONT
MAKELANGID
MINIMIZEDMETRICS
MOUSEKEYS
NONCLIENTMETRICS
RECT
SERIALKEYS
SOUNDSENTRY
STICKYKEYS
SystemParametersInfoForDPI
TOGGLEKEYS
WM_SETTINGCHANGE
Windows Data Types
TileWindows function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Tiles the specified child windows of the specified parent window.

Syntax
WORD TileWindows(
HWND hwndParent,
UINT wHow,
const RECT *lpRect,
UINT cKids,
const HWND *lpKids
);

Parameters
hwndParent

Type: HWND
A handle to the parent window. If this parameter is NULL , the desktop window is assumed.
wHow

Type: UINT
The tiling flags. This parameter can be one of the following values—optionally combined with
MDITILE_SKIPDISABLED to prevent disabled MDI child windows from being tiled.

VA L UE M EA N IN G

Tiles windows horizontally.


MDITILE_HORIZONTAL
0x0001

Tiles windows vertically.


MDITILE_VERTICAL
0x0000

lpRect

Type: const RECT *


A pointer to a structure that specifies the rectangular area, in client coordinates, within which the windows are
arranged. If this parameter is NULL , the client area of the parent window is used.
cKids

Type: UINT
The number of elements in the array specified by the lpKids parameter. This parameter is ignored if lpKids is
NULL .
lpKids

Type: const HWND*


An array of handles to the child windows to arrange. If a specified child window is a top-level window with the
style WS_EX_TOPMOST or WS_EX_TOOLWINDOW , the child window is not arranged. If this parameter is
NULL , all child windows of the specified parent window (or of the desktop window) are arranged.

Return value
Type: WORD
If the function succeeds, the return value is the number of windows arranged.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
Calling TileWindows causes all maximized windows to be restored to their previous size.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

See also
CascadeWindows
Conceptual
Other Resources
RECT
Reference
Windows
TIMERPROC callback function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

An application-defined callback function that processes WM_TIMER messages. The TIMERPROC type defines a
pointer to this callback function. TimerProc is a placeholder for the application-defined function name.

Syntax
TIMERPROC Timerproc;

void Timerproc(
HWND Arg1,
UINT Arg2,
UINT_PTR Arg3,
DWORD Arg4
)
{...}

Parameters
Arg1

Type: HWND
A handle to the window associated with the timer.
Arg2

Type: UINT
The WM_TIMER message.
Arg3

Type: UINT_PTR
The timer's identifier.
Arg4

Type: DWORD
The number of milliseconds that have elapsed since the system was started. This is the value returned by the
GetTickCount function.

Return value
None

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]
Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

See also
Conceptual
KillTimer
Reference
SetTimer
Timers
WM_TIMER
TITLEBARINFO structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains title bar information.

Syntax
typedef struct tagTITLEBARINFO {
DWORD cbSize;
RECT rcTitleBar;
DWORD rgstate[CCHILDREN_TITLEBAR + 1];
} TITLEBARINFO, *PTITLEBARINFO, *LPTITLEBARINFO;

Members
cbSize

Type: DWORD
The size, in bytes, of the structure. The caller must set this member to sizeof(TITLEBARINFO) .
rcTitleBar

Type: RECT
The coordinates of the title bar. These coordinates include all title-bar elements except the window menu.
rgstate

Type: DWORD[CCHILDREN_TITLEBAR+1]
An array that receives a value for each element of the title bar. The following are the title bar elements
represented by the array.

IN DEX T IT L E B A R EL EM EN T

0 The title bar itself.

1 Reserved.

2 Minimize button.

3 Maximize button.

4 Help button.

5 Close button.

Each array element is a combination of one or more of the following values.

VA L UE M EA N IN G
The element can accept the focus.
STATE_SYSTEM_FOCUSABLE
0x00100000

The element is invisible.


STATE_SYSTEM_INVISIBLE
0x00008000

The element has no visible representation.


STATE_SYSTEM_OFFSCREEN
0x00010000

The element is unavailable.


STATE_SYSTEM_UNAVAIL ABLE
0x00000001

The element is in the pressed state.


STATE_SYSTEM_PRESSED
0x00000008

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
Conceptual
GetTitleBarInfo
Reference
Windows
TITLEBARINFOEX structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Expands on the information described in the TITLEBARINFO structure by including the coordinates of each
element of the title bar.
This structure is sent with the WM_GETTITLEBARINFOEX message.

Syntax
typedef struct tagTITLEBARINFOEX {
DWORD cbSize;
RECT rcTitleBar;
DWORD rgstate[CCHILDREN_TITLEBAR + 1];
RECT rgrect[CCHILDREN_TITLEBAR + 1];
} TITLEBARINFOEX, *PTITLEBARINFOEX, *LPTITLEBARINFOEX;

Members
cbSize

Type: DWORD
The size of the structure, in bytes. Set this member to sizeof(TITLEBARINFOEX) before sending with the
WM_GETTITLEBARINFOEX message.
rcTitleBar

Type: RECT
The bounding rectangle of the title bar. The rectangle is expressed in screen coordinates and includes all titlebar
elements except the window menu.
rgstate

Type: DWORD[CCHILDREN_TITLEBAR+1]
An array that receives a DWORD value for each element of the title bar. The following are the title bar elements
represented by the array.

IN DEX T IT L E B A R EL EM EN T

0 The title bar itself.

1 Reserved.

2 Minimize button.

3 Maximize button.

4 Help button.
5 Close button.

Each array element is a combination of one or more of the following values.

VA L UE M EA N IN G

The element can accept the focus.


STATE_SYSTEM_FOCUSABLE
0x00100000

The element is invisible.


STATE_SYSTEM_INVISIBLE
0x00008000

The element has no visible representation.


STATE_SYSTEM_OFFSCREEN
0x00010000

The element is unavailable.


STATE_SYSTEM_UNAVAIL ABLE
0x00000001

The element is in the pressed state.


STATE_SYSTEM_PRESSED
0x00000008

rgrect

Type: RECT [CCHILDREN_TITLEBAR+1]


An array that receives a structure for each element of the title bar. The structures are expressed in screen
coordinates. The following are the title bar elements represented by the array.

IN DEX T IT L E B A R EL EM EN T

0 Reserved.

1 Reserved.

2 Minimize button.

3 Maximize button.

4 Help button.

5 Close button.

Requirements

Minimum suppor ted client Windows Vista [desktop apps only]


Minimum suppor ted ser ver Windows Server 2008 [desktop apps only]

Header winuser.h (include Windows.h)

See also
Conceptual
Reference
WM_GETTITLEBARINFOEX
Windows
TranslateMDISysAccel function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Processes accelerator keystrokes for window menu commands of the multiple-document interface (MDI) child
windows associated with the specified MDI client window. The function translates WM_KEYUP and
WM_KEYDOWN messages to WM_SYSCOMMAND messages and sends them to the appropriate MDI child
windows.

Syntax
BOOL TranslateMDISysAccel(
HWND hWndClient,
LPMSG lpMsg
);

Parameters
hWndClient

Type: HWND
A handle to the MDI client window.
lpMsg

Type: LPMSG
A pointer to a message retrieved by using the GetMessage or PeekMessage function. The message must be an
MSG structure and contain message information from the application's message queue.

Return value
Type: BOOL
If the message is translated into a system command, the return value is nonzero.
If the message is not translated into a system command, the return value is zero.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib
DLL User32.dll

See also
Conceptual
GetMessage
MSG
Multiple Document Interface
PeekMessage
Reference
TranslateAccelerator
WM_KEYDOWN
WM_KEYUP
WM_SYSCOMMAND
TranslateMessage function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Translates virtual-key messages into character messages. The character messages are posted to the calling
thread's message queue, to be read the next time the thread calls the GetMessage or PeekMessage function.

Syntax
BOOL TranslateMessage(
const MSG *lpMsg
);

Parameters
lpMsg

Type: const MSG *


A pointer to an MSG structure that contains message information retrieved from the calling thread's message
queue by using the GetMessage or PeekMessage function.

Return value
Type: BOOL
If the message is translated (that is, a character message is posted to the thread's message queue), the return
value is nonzero.
If the message is WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, or WM_SYSKEYUP, the return value is
nonzero, regardless of the translation.
If the message is not translated (that is, a character message is not posted to the thread's message queue), the
return value is zero.

Remarks
The TranslateMessage function does not modify the message pointed to by the lpMsg parameter.
WM_KEYDOWN and WM_KEYUP combinations produce a WM_CHAR or WM_DEADCHAR message.
WM_SYSKEYDOWN and WM_SYSKEYUP combinations produce a WM_SYSCHAR or WM_SYSDEADCHAR
message.
TranslateMessage produces WM_CHAR messages only for keys that are mapped to ASCII characters by the
keyboard driver.
If applications process virtual-key messages for some other purpose, they should not call TranslateMessage .
For instance, an application should not call TranslateMessage if the TranslateAccelerator function returns a
nonzero value. Note that the application is responsible for retrieving and dispatching input messages to the
dialog box. Most applications use the main message loop for this. However, to permit the user to move to and to
select controls by using the keyboard, the application must call IsDialogMessage. For more information, see
Dialog Box Keyboard Interface.
Examples
For an example, see Creating a Message Loop.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows


8)

See also
Conceptual
GetMessage
IsDialogMessage
Messages and Message Queues
PeekMessage
Reference
TranslateAccelerator
WM_CHAR
WM_DEADCHAR
WM_KEYDOWN
WM_KEYUP
WM_SYSCHAR
WM_SYSDEADCHAR
WM_SYSKEYDOWN
WM_SYSKEYUP
UnhookWindowsHookEx function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Removes a hook procedure installed in a hook chain by the SetWindowsHookEx function.

Syntax
BOOL UnhookWindowsHookEx(
HHOOK hhk
);

Parameters
hhk

Type: HHOOK
A handle to the hook to be removed. This parameter is a hook handle obtained by a previous call to
SetWindowsHookEx.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
The hook procedure can be in the state of being called by another thread even after UnhookWindowsHookEx
returns. If the hook procedure is not being called concurrently, the hook procedure is removed immediately
before UnhookWindowsHookEx returns.
Examples
For an example, see Monitoring System Events.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib
DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows


8)

See also
Conceptual
Hooks
Reference
SetWindowsHookEx
UnregisterClassA function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Unregisters a window class, freeing the memory required for the class.

Syntax
BOOL UnregisterClassA(
LPCSTR lpClassName,
HINSTANCE hInstance
);

Parameters
lpClassName

Type: LPCTSTR
A null-terminated string or a class atom. If lpClassName is a string, it specifies the window class name. This class
name must have been registered by a previous call to the RegisterClass or RegisterClassEx function. System
classes, such as dialog box controls, cannot be unregistered. If this parameter is an atom, it must be a class atom
created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-
order word of lpClassName; the high-order word must be zero.
hInstance

Type: HINSTANCE
A handle to the instance of the module that created the class.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the class could not be found or if a window still exists that was created with the class, the return value is zero.
To get extended error information, call GetLastError.

Remarks
Before calling this function, an application must destroy all windows created with the specified class.
All window classes that an application registers are unregistered when it terminates.
Class atoms are special atoms returned only by RegisterClass and RegisterClassEx.
No window classes registered by a DLL are unregistered when the .dll is unloaded.
NOTE
The winuser.h header defines UnregisterClass as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)

See also
Conceptual
Reference
RegisterClass
RegisterClassEx
Window Classes
UnregisterClassW function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Unregisters a window class, freeing the memory required for the class.

Syntax
BOOL UnregisterClassW(
LPCWSTR lpClassName,
HINSTANCE hInstance
);

Parameters
lpClassName

Type: LPCTSTR
A null-terminated string or a class atom. If lpClassName is a string, it specifies the window class name. This class
name must have been registered by a previous call to the RegisterClass or RegisterClassEx function. System
classes, such as dialog box controls, cannot be unregistered. If this parameter is an atom, it must be a class atom
created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-
order word of lpClassName; the high-order word must be zero.
hInstance

Type: HINSTANCE
A handle to the instance of the module that created the class.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the class could not be found or if a window still exists that was created with the class, the return value is zero.
To get extended error information, call GetLastError.

Remarks
Before calling this function, an application must destroy all windows created with the specified class.
All window classes that an application registers are unregistered when it terminates.
Class atoms are special atoms returned only by RegisterClass and RegisterClassEx.
No window classes registered by a DLL are unregistered when the .dll is unloaded.
NOTE
The winuser.h header defines UnregisterClass as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in


Windows 8)

See also
Conceptual
Reference
RegisterClass
RegisterClassEx
Window Classes
UpdateLayeredWindow function (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Updates the position, size, shape, content, and translucency of a layered window.

Syntax
BOOL UpdateLayeredWindow(
HWND hWnd,
HDC hdcDst,
POINT *pptDst,
SIZE *psize,
HDC hdcSrc,
POINT *pptSrc,
COLORREF crKey,
BLENDFUNCTION *pblend,
DWORD dwFlags
);

Parameters
hWnd

Type: HWND
A handle to a layered window. A layered window is created by specifying WS_EX_L AYERED when creating the
window with the CreateWindowEx function.
Windows 8: The WS_EX_L AYERED style is supported for top-level windows and child windows. Previous
Windows versions support WS_EX_L AYERED only for top-level windows.
hdcDst

Type: HDC
A handle to a DC for the screen. This handle is obtained by specifying NULL when calling the function. It is used
for palette color matching when the window contents are updated. If hdcDst isNULL , the default palette will be
used.
If hdcSrc is NULL , hdcDst must be NULL .
pptDst

Type: POINT *
A pointer to a structure that specifies the new screen position of the layered window. If the current position is
not changing, pptDst can be NULL .
psize

Type: SIZE *
A pointer to a structure that specifies the new size of the layered window. If the size of the window is not
changing, psize can be NULL . If hdcSrc is NULL , psize must be NULL .
hdcSrc
Type: HDC
A handle to a DC for the surface that defines the layered window. This handle can be obtained by calling the
CreateCompatibleDC function. If the shape and visual context of the window are not changing, hdcSrc can be
NULL .
pptSrc

Type: POINT *
A pointer to a structure that specifies the location of the layer in the device context. If hdcSrc is NULL , pptSrc
should be NULL .
crKey

Type: COLORREF
A structure that specifies the color key to be used when composing the layered window. To generate a
COLORREF, use the RGB macro.
pblend

Type: BLENDFUNCTION *
A pointer to a structure that specifies the transparency value to be used when composing the layered window.
dwFlags

Type: DWORD
This parameter can be one of the following values.

VA L UE M EA N IN G

Use pblend as the blend function. If the display mode is 256


ULW_ALPHA colors or less, the effect of this value is the same as the effect
0x00000002 of ULW_OPAQUE .

Use crKey as the transparency color.


ULW_COLORKEY
0x00000001

Draw an opaque layered window.


ULW_OPAQUE
0x00000004

Force the UpdateLayeredWindowIndirect function to fail if


ULW_EX_NORESIZE the current window size does not match the size specified in
0x00000008 the psize.

If hdcSrc is NULL , dwFlags should be zero.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
The source DC should contain the surface that defines the visible contents of the layered window. For example,
you can select a bitmap into a device context obtained by calling the CreateCompatibleDC function.
An application should call SetLayout on the hdcSrc device context to properly set the mirroring mode.
SetLayout will properly mirror all drawing into an HDC while properly preserving text glyph and (optionally)
bitmap direction order. It cannot modify drawing directly into the bits of a device-independent bitmap (DIB). For
more information, see Window Layout and Mirroring.
The UpdateLayeredWindow function maintains the window's appearance on the screen. The windows
underneath a layered window do not need to be repainted when they are uncovered due to a call to
UpdateLayeredWindow , because the system will automatically repaint them. This permits seamless animation
of the layered window.
UpdateLayeredWindow always updates the entire window. To update part of a window, use the traditional
WM_PAINT and set the blend value using SetLayeredWindowAttributes.
For best drawing performance by the layered window and any underlying windows, the layered window should
be as small as possible. An application should also process the message and re-create its layered windows when
the display's color depth changes.
For more information, see Layered Windows.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows


8.1)

See also
AlphaBlend
Conceptual
CreateCompatibleBitmap
Other Resources
Reference
SetWindowLong
SetWindowPos
TransparentBlt
UpdateLayeredWindowIndirect
Windows
UPDATELAYEREDWINDOWINFO structure
(winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Used by UpdateLayeredWindowIndirect to provide position, size, shape, content, and translucency information
for a layered window.

Syntax
typedef struct tagUPDATELAYEREDWINDOWINFO {
DWORD cbSize;
HDC hdcDst;
const POINT *pptDst;
const SIZE *psize;
HDC hdcSrc;
const POINT *pptSrc;
COLORREF crKey;
const BLENDFUNCTION *pblend;
DWORD dwFlags;
const RECT *prcDirty;
} UPDATELAYEREDWINDOWINFO, *PUPDATELAYEREDWINDOWINFO;

Members
cbSize

Type: DWORD
The size, in bytes, of this structure.
hdcDst

Type: HDC
A handle to a DC for the screen. This handle is obtained by specifying NULL in this member when calling
UpdateLayeredWindowIndirect. The handle is used for palette color matching when the window contents are
updated. If hdcDst is NULL , the default palette is used.
If hdcSrc is NULL , hdcDst must be NULL .
pptDst

Type: const POINT *


The new screen position of the layered window. If the new position is unchanged from the current position,
pptDst can be NULL .
psize

Type: const SIZE *


The new size of the layered window. If the size of the window will not change, this parameter can be NULL . If
hdcSrc is NULL , psize must be NULL .
hdcSrc
Type: HDC
A handle to the DC for the surface that defines the layered window. This handle can be obtained by calling the
CreateCompatibleDC function. If the shape and visual context of the window will not change, hdcSrc can be
NULL .
pptSrc

Type: const POINT *


The location of the layer in the device context. If hdcSrc is NULL , pptSrc should be NULL .
crKey

Type: COLORREF
The color key to be used when composing the layered window. To generate a COLORREF, use the RGB macro.
pblend

Type: const BLENDFUNCTION *


The transparency value to be used when composing the layered window.
dwFlags

Type: DWORD
This parameter can be one of the following values.

VA L UE M EA N IN G

Use pblend as the blend function. If the display mode is 256


ULW_ALPHA colors or less, the effect of this value is the same as the effect
0x00000002 of ULW_OPAQUE.

Use crKey as the transparency color.


ULW_COLORKEY
0x00000001

Draw an opaque layered window.


ULW_OPAQUE
0x00000004

Force the UpdateLayeredWindowIndirect function to fail if


ULW_EX_NORESIZE the current window size does not match the size specified in
0x00000008 the psize.

If hdcSrc is NULL , dwFlags should be zero.


prcDirty

Type: const RECT *


The area to be updated. This parameter can be NULL . If it is non-NULL, only the area in this rectangle is updated
from the source DC.

Requirements
Minimum suppor ted client Windows Vista [desktop apps only]

Minimum suppor ted ser ver Windows Server 2008 [desktop apps only]

Header winuser.h (include Windows.h)

See also
Conceptual
Reference
UpdateLayeredWindow
Window Features
WaitMessage function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Yields control to other threads when a thread has no other messages in its message queue. The WaitMessage
function suspends the thread and does not return until a new message is placed in the thread's message queue.

Syntax
BOOL WaitMessage();

Parameters
This function has no parameters.

Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
Note that WaitMessage does not return if there is unread input in the message queue after the thread has
called a function to check the queue. This is because functions such as PeekMessage, GetMessage,
GetQueueStatus, WaitMessage , MsgWaitForMultipleObjects, and MsgWaitForMultipleObjectsEx check the
queue and then change the state information for the queue so that the input is no longer considered new. A
subsequent call to WaitMessage will not return until new input of the specified type arrives. The existing
unread input (received prior to the last time the thread checked the queue) is ignored.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows


10, version 10.0.14393)
See also
Conceptual
GetMessage
Messages and Message Queues
PeekMessage
Reference
WindowFromPhysicalPoint function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves a handle to the window that contains the specified physical point.

Syntax
HWND WindowFromPhysicalPoint(
POINT Point
);

Parameters
Point

Type: POINT
The physical coordinates of the point.

Return value
Type: HWND
A handle to the window that contains the given physical point. If no window exists at the point, this value is
NULL .

Remarks
The WindowFromPhysicalPoint function does not retrieve a handle to a hidden or disabled window, even if
the point is within the window.

Requirements

Minimum suppor ted client Windows Vista [desktop apps only]

Minimum suppor ted ser ver Windows Server 2008 [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll

API set ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows


8.1)
See also
ChildWindowFromPoint
Conceptual
Other Resources
POINT
Reference
WindowFromDC
WindowFromPoint
Windows
WindowFromPoint function (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Retrieves a handle to the window that contains the specified point.

Syntax
HWND WindowFromPoint(
POINT Point
);

Parameters
Point

Type: POINT
The point to be checked.

Return value
Type: HWND
The return value is a handle to the window that contains the point. If no window exists at the given point, the
return value is NULL . If the point is over a static text control, the return value is a handle to the window under
the static text control.

Remarks
The WindowFromPoint function does not retrieve a handle to a hidden or disabled window, even if the point is
within the window. An application should use the ChildWindowFromPoint function for a nonrestrictive search.
Examples
For an example, see "Interface from Running Object Table" in About Text Object Model.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Target Platform Windows

Header winuser.h (include Windows.h)

Librar y User32.lib

DLL User32.dll
API set ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows
8.1)

See also
ChildWindowFromPoint
Conceptual
Other Resources
POINT
Reference
WindowFromDC
Windows
WINDOWINFO structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains window information.

Syntax
typedef struct tagWINDOWINFO {
DWORD cbSize;
RECT rcWindow;
RECT rcClient;
DWORD dwStyle;
DWORD dwExStyle;
DWORD dwWindowStatus;
UINT cxWindowBorders;
UINT cyWindowBorders;
ATOM atomWindowType;
WORD wCreatorVersion;
} WINDOWINFO, *PWINDOWINFO, *LPWINDOWINFO;

Members
cbSize

Type: DWORD
The size of the structure, in bytes. The caller must set this member to sizeof(WINDOWINFO) .
rcWindow

Type: RECT
The coordinates of the window.
rcClient

Type: RECT
The coordinates of the client area.
dwStyle

Type: DWORD
The window styles. For a table of window styles, see Window Styles.
dwExStyle

Type: DWORD
The extended window styles. For a table of extended window styles, see Extended Window Styles.
dwWindowStatus

Type: DWORD
The window status. If this member is WS_ACTIVECAPTION (0x0001), the window is active. Otherwise, this
member is zero.
cxWindowBorders

Type: UINT
The width of the window border, in pixels.
cyWindowBorders

Type: UINT
The height of the window border, in pixels.
atomWindowType

Type: ATOM
The window class atom (see RegisterClass).
wCreatorVersion

Type: WORD
The Windows version of the application that created the window.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
Conceptual
CreateWindowEx
GetWindowInfo
Reference
RegisterClass
Windows
WINDOWPLACEMENT structure (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Contains information about the placement of a window on the screen.

Syntax
typedef struct tagWINDOWPLACEMENT {
UINT length;
UINT flags;
UINT showCmd;
POINT ptMinPosition;
POINT ptMaxPosition;
RECT rcNormalPosition;
RECT rcDevice;
} WINDOWPLACEMENT;

Members
length

Type: UINT
The length of the structure, in bytes. Before calling the GetWindowPlacement or SetWindowPlacement functions,
set this member to sizeof(WINDOWPLACEMENT) .
GetWindowPlacement and SetWindowPlacement fail if this member is not set correctly.
flags

Type: UINT
The flags that control the position of the minimized window and the method by which the window is restored.
This member can be one or more of the following values.

VA L UE M EA N IN G

If the calling thread and the thread that owns the window
WPF_ASYNCWINDOWPL ACEMENT are attached to different input queues, the system posts the
0x0004 request to the thread that owns the window. This prevents
the calling thread from blocking its execution while other
threads process the request.

The restored window will be maximized, regardless of


WPF_RESTORETOMAXIMIZED whether it was maximized before it was minimized. This
0x0002 setting is only valid the next time the window is restored. It
does not change the default restoration behavior.
This flag is only valid when the SW_SHOWMINIMIZED
value is specified for the showCmd member.

The coordinates of the minimized window may be specified.


WPF_SETMINPOSITION
This flag must be specified if the coordinates are set in
0x0001
the ptMinPosition member.
showCmd

Type: UINT
The current show state of the window. This member can be one of the following values.

VA L UE M EA N IN G

Hides the window and activates another window.


SW_HIDE
0

Maximizes the specified window.


SW_MAXIMIZE
3

Minimizes the specified window and activates the next top-


SW_MINIMIZE level window in the z-order.
6

Activates and displays the window. If the window is


SW_RESTORE minimized or maximized, the system restores it to its original
9 size and position. An application should specify this flag
when restoring a minimized window.

Activates the window and displays it in its current size and


SW_SHOW position.
5

Activates the window and displays it as a maximized window.


SW_SHOWMAXIMIZED
3

Activates the window and displays it as a minimized window.


SW_SHOWMINIMIZED
2

Displays the window as a minimized window.


SW_SHOWMINNOACTIVE
This value is similar to SW_SHOWMINIMIZED , except
7
the window is not activated.

Displays the window in its current size and position.


SW_SHOWNA
This value is similar to SW_SHOW , except the window is
8
not activated.

Displays a window in its most recent size and position.


SW_SHOWNOACTIVATE
This value is similar to SW_SHOWNORMAL , except the
4
window is not activated.

Activates and displays a window. If the window is minimized


SW_SHOWNORMAL or maximized, the system restores it to its original size and
1 position. An application should specify this flag when
displaying the window for the first time.
ptMinPosition

Type: POINT
The coordinates of the window's upper-left corner when the window is minimized.
ptMaxPosition

Type: POINT
The coordinates of the window's upper-left corner when the window is maximized.
rcNormalPosition

Type: RECT
The window's coordinates when the window is in the restored position.
rcDevice

Remarks
If the window is a top-level window that does not have the WS_EX_TOOLWINDOW window style, then the
coordinates represented by the following members are in workspace coordinates: ptMinPosition ,
ptMaxPosition , and rcNormalPosition . Otherwise, these members are in screen coordinates.
Workspace coordinates differ from screen coordinates in that they take the locations and sizes of application
toolbars (including the taskbar) into account. Workspace coordinate (0,0) is the upper-left corner of the
workspace area, the area of the screen not being used by application toolbars.
The coordinates used in a WINDOWPL ACEMENT structure should be used only by the GetWindowPlacement
and SetWindowPlacement functions. Passing workspace coordinates to functions which expect screen
coordinates (such as SetWindowPos) will result in the window appearing in the wrong location. For example, if
the taskbar is at the top of the screen, saving window coordinates using GetWindowPlacement and restoring
them using SetWindowPos causes the window to appear to "creep" up the screen.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
Conceptual
GetWindowPlacement
POINT
RECT
Reference
SetWindowPlacement
SetWindowPos
ShowWindow
Windows
WINDOWPOS structure (winuser.h)
2/1/2021 • 2 minutes to read • Edit Online

Contains information about the size and position of a window.

Syntax
typedef struct tagWINDOWPOS {
HWND hwnd;
HWND hwndInsertAfter;
int x;
int y;
int cx;
int cy;
UINT flags;
} WINDOWPOS, *LPWINDOWPOS, *PWINDOWPOS;

Members
hwnd

Type: HWND
A handle to the window.
hwndInsertAfter

Type: HWND
The position of the window in Z order (front-to-back position). This member can be a handle to the window
behind which this window is placed, or can be one of the special values listed with the SetWindowPos function.
x

Type: int
The position of the left edge of the window.
y

Type: int
The position of the top edge of the window.
cx

Type: int
The window width, in pixels.
cy

Type: int
The window height, in pixels.
flags
Type: UINT
The window position. This member can be one or more of the following values.

VA L UE M EA N IN G

Draws a frame (defined in the window's class description)


SWP_DRAWFRAME around the window. Same as the SWP_FRAMECHANGED
0x0020 flag.

Sends a WM_NCCALCSIZE message to the window, even if


SWP_FRAMECHANGED the window's size is not being changed. If this flag is not
0x0020 specified, WM_NCCALCSIZE is sent only when the
window's size is being changed.

Hides the window.


SWP_HIDEWINDOW
0x0080

Does not activate the window. If this flag is not set, the
SWP_NOACTIVATE window is activated and moved to the top of either the
0x0010 topmost or non-topmost group (depending on the setting
of the hwndInser tAfter member).

Discards the entire contents of the client area. If this flag is


SWP_NOCOPYBITS not specified, the valid contents of the client area are saved
0x0100 and copied back into the client area after the window is sized
or repositioned.

Retains the current position (ignores the x and y members).


SWP_NOMOVE
0x0002

Does not change the owner window's position in the Z order.


SWP_ NOOWNERZORDER
0x0200

Does not redraw changes. If this flag is set, no repainting of


SWP_NOREDRAW any kind occurs. This applies to the client area, the nonclient
0x0008 area (including the title bar and scroll bars), and any part of
the parent window uncovered as a result of the window
being moved. When this flag is set, the application must
explicitly invalidate or redraw any parts of the window and
parent window that need redrawing.

Does not change the owner window's position in the Z order.


SWP_NOREPOSITION Same as the SWP_NOOWNERZORDER flag.
0x0200

Prevents the window from receiving the


SWP_NOSENDCHANGING WM_WINDOWPOSCHANGING message.
0x0400

Retains the current size (ignores the cx and cy members).


SWP_NOSIZE
0x0001
Retains the current Z order (ignores the hwndInser tAfter
SWP_NOZORDER member).
0x0004

Displays the window.


SWP_SHOWWINDOW
0x0040

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
Conceptual
EndDeferWindowPos
Reference
SetWindowPos
WM_NCCALCSIZE
Windows
WNDCLASSA structure (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Contains the window class attributes that are registered by the RegisterClass function.
This structure has been superseded by the WNDCLASSEX structure used with the RegisterClassEx function. You
can still use WNDCL ASS and RegisterClass if you do not need to set the small icon associated with the window
class.

Syntax
typedef struct tagWNDCLASSA {
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HINSTANCE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPCSTR lpszMenuName;
LPCSTR lpszClassName;
} WNDCLASSA, *PWNDCLASSA, *NPWNDCLASSA, *LPWNDCLASSA;

Members
style

Type: UINT
The class style(s). This member can be any combination of the Class Styles.
lpfnWndProc

Type: WNDPROC
A pointer to the window procedure. You must use the CallWindowProc function to call the window procedure.
For more information, see WindowProc.
cbClsExtra

Type: int
The number of extra bytes to allocate following the window-class structure. The system initializes the bytes to
zero.
cbWndExtra

Type: int
The number of extra bytes to allocate following the window instance. The system initializes the bytes to zero. If
an application uses WNDCL ASS to register a dialog box created by using the CL ASS directive in the resource
file, it must set this member to DLGWINDOWEXTRA .
hInstance
Type: HINSTANCE
A handle to the instance that contains the window procedure for the class.
hIcon

Type: HICON
A handle to the class icon. This member must be a handle to an icon resource. If this member is NULL , the
system provides a default icon.
hCursor

Type: HCURSOR
A handle to the class cursor. This member must be a handle to a cursor resource. If this member is NULL , an
application must explicitly set the cursor shape whenever the mouse moves into the application's window.
hbrBackground

Type: HBRUSH
A handle to the class background brush. This member can be a handle to the physical brush to be used for
painting the background, or it can be a color value. A color value must be one of the following standard system
colors (the value 1 must be added to the chosen color). If a color value is given, you must convert it to one of the
following HBRUSH types:
COLOR_ACTIVEBORDER
COLOR_ACTIVECAPTION
COLOR_APPWORKSPACE
COLOR_BACKGROUND
COLOR_BTNFACE
COLOR_BTNSHADOW
COLOR_BTNTEXT
COLOR_CAPTIONTEXT
COLOR_GRAYTEXT
COLOR_HIGHLIGHT
COLOR_HIGHLIGHTTEXT
COLOR_INACTIVEBORDER
COLOR_INACTIVECAPTION
COLOR_MENU
COLOR_MENUTEXT
COLOR_SCROLLBAR
COLOR_WINDOW
COLOR_WINDOWFRAME
COLOR_WINDOWTEXT
The system automatically deletes class background brushes when the class is unregistered by using
UnregisterClass. An application should not delete these brushes.
When this member is NULL , an application must paint its own background whenever it is requested to paint in
its client area. To determine whether the background must be painted, an application can either process the
WM_ERASEBKGND message or test the fErase member of the PAINTSTRUCT structure filled by the BeginPaint
function.
lpszMenuName
Type: LPCTSTR
The resource name of the class menu, as the name appears in the resource file. If you use an integer to identify
the menu, use the MAKEINTRESOURCE macro. If this member is NULL , windows belonging to this class have no
default menu.
lpszClassName

Type: LPCTSTR
A pointer to a null-terminated string or is an atom. If this parameter is an atom, it must be a class atom created
by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of
lpszClassName ; the high-order word must be zero.
If lpszClassName is a string, it specifies the window class name. The class name can be any name registered
with RegisterClass or RegisterClassEx, or any of the predefined control-class names.
The maximum length for lpszClassName is 256. If lpszClassName is greater than the maximum length, the
RegisterClass function will fail.

Remarks
NOTE
The winuser.h header defines WNDCLASS as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
BeginPaint
Conceptual
CreateWindow
CreateWindowEx
GetDC
MAKEINTRESOURCE
Other Resources
PAINTSTRUCT
Reference
RegisterClass
UnregisterClass
WM_PAINT
WNDCLASSEX
Window Classes
WindowProc
WNDCLASSEXA structure (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Contains window class information. It is used with the RegisterClassEx and GetClassInfoEx functions.
The WNDCL ASSEX structure is similar to the WNDCLASS structure. There are two differences. WNDCL ASSEX
includes the cbSize member, which specifies the size of the structure, and the hIconSm member, which
contains a handle to a small icon associated with the window class.

Syntax
typedef struct tagWNDCLASSEXA {
UINT cbSize;
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HINSTANCE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPCSTR lpszMenuName;
LPCSTR lpszClassName;
HICON hIconSm;
} WNDCLASSEXA, *PWNDCLASSEXA, *NPWNDCLASSEXA, *LPWNDCLASSEXA;

Members
cbSize

Type: UINT
The size, in bytes, of this structure. Set this member to sizeof(WNDCLASSEX) . Be sure to set this member before
calling the GetClassInfoEx function.
style

Type: UINT
The class style(s). This member can be any combination of the Class Styles.
lpfnWndProc

Type: WNDPROC
A pointer to the window procedure. You must use the CallWindowProc function to call the window procedure.
For more information, see WindowProc.
cbClsExtra

Type: int
The number of extra bytes to allocate following the window-class structure. The system initializes the bytes to
zero.
cbWndExtra
Type: int
The number of extra bytes to allocate following the window instance. The system initializes the bytes to zero. If
an application uses WNDCL ASSEX to register a dialog box created by using the CL ASS directive in the
resource file, it must set this member to DLGWINDOWEXTRA .
hInstance

Type: HINSTANCE
A handle to the instance that contains the window procedure for the class.
hIcon

Type: HICON
A handle to the class icon. This member must be a handle to an icon resource. If this member is NULL , the
system provides a default icon.
hCursor

Type: HCURSOR
A handle to the class cursor. This member must be a handle to a cursor resource. If this member is NULL , an
application must explicitly set the cursor shape whenever the mouse moves into the application's window.
hbrBackground

Type: HBRUSH
A handle to the class background brush. This member can be a handle to the brush to be used for painting the
background, or it can be a color value. A color value must be one of the following standard system colors (the
value 1 must be added to the chosen color). If a color value is given, you must convert it to one of the following
HBRUSH types:
COLOR_ACTIVEBORDER
COLOR_ACTIVECAPTION
COLOR_APPWORKSPACE
COLOR_BACKGROUND
COLOR_BTNFACE
COLOR_BTNSHADOW
COLOR_BTNTEXT
COLOR_CAPTIONTEXT
COLOR_GRAYTEXT
COLOR_HIGHLIGHT
COLOR_HIGHLIGHTTEXT
COLOR_INACTIVEBORDER
COLOR_INACTIVECAPTION
COLOR_MENU
COLOR_MENUTEXT
COLOR_SCROLLBAR
COLOR_WINDOW
COLOR_WINDOWFRAME
COLOR_WINDOWTEXT
The system automatically deletes class background brushes when the class is unregistered by using
UnregisterClass. An application should not delete these brushes.
When this member is NULL , an application must paint its own background whenever it is requested to paint in
its client area. To determine whether the background must be painted, an application can either process the
WM_ERASEBKGND message or test the fErase member of the PAINTSTRUCT structure filled by the BeginPaint
function.
lpszMenuName

Type: LPCTSTR
Pointer to a null-terminated character string that specifies the resource name of the class menu, as the name
appears in the resource file. If you use an integer to identify the menu, use the MAKEINTRESOURCE macro. If
this member is NULL , windows belonging to this class have no default menu.
lpszClassName

Type: LPCTSTR
A pointer to a null-terminated string or is an atom. If this parameter is an atom, it must be a class atom created
by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of
lpszClassName ; the high-order word must be zero.
If lpszClassName is a string, it specifies the window class name. The class name can be any name registered
with RegisterClass or RegisterClassEx, or any of the predefined control-class names.
The maximum length for lpszClassName is 256. If lpszClassName is greater than the maximum length, the
RegisterClassEx function will fail.
hIconSm

Type: HICON
A handle to a small icon that is associated with the window class. If this member is NULL , the system searches
the icon resource specified by the hIcon member for an icon of the appropriate size to use as the small icon.

Remarks
NOTE
The winuser.h header defines WNDCLASSEX as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
Conceptual
GetClassInfoEx
Reference
RegisterClassEx
UnregisterClass
Window Classes
WNDCLASSEXW structure (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Contains window class information. It is used with the RegisterClassEx and GetClassInfoEx functions.
The WNDCL ASSEX structure is similar to the WNDCLASS structure. There are two differences. WNDCL ASSEX
includes the cbSize member, which specifies the size of the structure, and the hIconSm member, which
contains a handle to a small icon associated with the window class.

Syntax
typedef struct tagWNDCLASSEXW {
UINT cbSize;
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HINSTANCE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPCWSTR lpszMenuName;
LPCWSTR lpszClassName;
HICON hIconSm;
} WNDCLASSEXW, *PWNDCLASSEXW, *NPWNDCLASSEXW, *LPWNDCLASSEXW;

Members
cbSize

Type: UINT
The size, in bytes, of this structure. Set this member to sizeof(WNDCLASSEX) . Be sure to set this member before
calling the GetClassInfoEx function.
style

Type: UINT
The class style(s). This member can be any combination of the Class Styles.
lpfnWndProc

Type: WNDPROC
A pointer to the window procedure. You must use the CallWindowProc function to call the window procedure.
For more information, see WindowProc.
cbClsExtra

Type: int
The number of extra bytes to allocate following the window-class structure. The system initializes the bytes to
zero.
cbWndExtra
Type: int
The number of extra bytes to allocate following the window instance. The system initializes the bytes to zero. If
an application uses WNDCL ASSEX to register a dialog box created by using the CL ASS directive in the
resource file, it must set this member to DLGWINDOWEXTRA .
hInstance

Type: HINSTANCE
A handle to the instance that contains the window procedure for the class.
hIcon

Type: HICON
A handle to the class icon. This member must be a handle to an icon resource. If this member is NULL , the
system provides a default icon.
hCursor

Type: HCURSOR
A handle to the class cursor. This member must be a handle to a cursor resource. If this member is NULL , an
application must explicitly set the cursor shape whenever the mouse moves into the application's window.
hbrBackground

Type: HBRUSH
A handle to the class background brush. This member can be a handle to the brush to be used for painting the
background, or it can be a color value. A color value must be one of the following standard system colors (the
value 1 must be added to the chosen color). If a color value is given, you must convert it to one of the following
HBRUSH types:
COLOR_ACTIVEBORDER
COLOR_ACTIVECAPTION
COLOR_APPWORKSPACE
COLOR_BACKGROUND
COLOR_BTNFACE
COLOR_BTNSHADOW
COLOR_BTNTEXT
COLOR_CAPTIONTEXT
COLOR_GRAYTEXT
COLOR_HIGHLIGHT
COLOR_HIGHLIGHTTEXT
COLOR_INACTIVEBORDER
COLOR_INACTIVECAPTION
COLOR_MENU
COLOR_MENUTEXT
COLOR_SCROLLBAR
COLOR_WINDOW
COLOR_WINDOWFRAME
COLOR_WINDOWTEXT
The system automatically deletes class background brushes when the class is unregistered by using
UnregisterClass. An application should not delete these brushes.
When this member is NULL , an application must paint its own background whenever it is requested to paint in
its client area. To determine whether the background must be painted, an application can either process the
WM_ERASEBKGND message or test the fErase member of the PAINTSTRUCT structure filled by the BeginPaint
function.
lpszMenuName

Type: LPCTSTR
Pointer to a null-terminated character string that specifies the resource name of the class menu, as the name
appears in the resource file. If you use an integer to identify the menu, use the MAKEINTRESOURCE macro. If
this member is NULL , windows belonging to this class have no default menu.
lpszClassName

Type: LPCTSTR
A pointer to a null-terminated string or is an atom. If this parameter is an atom, it must be a class atom created
by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of
lpszClassName ; the high-order word must be zero.
If lpszClassName is a string, it specifies the window class name. The class name can be any name registered
with RegisterClass or RegisterClassEx, or any of the predefined control-class names.
The maximum length for lpszClassName is 256. If lpszClassName is greater than the maximum length, the
RegisterClassEx function will fail.
hIconSm

Type: HICON
A handle to a small icon that is associated with the window class. If this member is NULL , the system searches
the icon resource specified by the hIcon member for an icon of the appropriate size to use as the small icon.

Remarks
NOTE
The winuser.h header defines WNDCLASSEX as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
Conceptual
GetClassInfoEx
Reference
RegisterClassEx
UnregisterClass
Window Classes
WNDCLASSW structure (winuser.h)
2/1/2021 • 3 minutes to read • Edit Online

Contains the window class attributes that are registered by the RegisterClass function.
This structure has been superseded by the WNDCLASSEX structure used with the RegisterClassEx function. You
can still use WNDCL ASS and RegisterClass if you do not need to set the small icon associated with the window
class.

Syntax
typedef struct tagWNDCLASSW {
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HINSTANCE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPCWSTR lpszMenuName;
LPCWSTR lpszClassName;
} WNDCLASSW, *PWNDCLASSW, *NPWNDCLASSW, *LPWNDCLASSW;

Members
style

Type: UINT
The class style(s). This member can be any combination of the Class Styles.
lpfnWndProc

Type: WNDPROC
A pointer to the window procedure. You must use the CallWindowProc function to call the window procedure.
For more information, see WindowProc.
cbClsExtra

Type: int
The number of extra bytes to allocate following the window-class structure. The system initializes the bytes to
zero.
cbWndExtra

Type: int
The number of extra bytes to allocate following the window instance. The system initializes the bytes to zero. If
an application uses WNDCL ASS to register a dialog box created by using the CL ASS directive in the resource
file, it must set this member to DLGWINDOWEXTRA .
hInstance
Type: HINSTANCE
A handle to the instance that contains the window procedure for the class.
hIcon

Type: HICON
A handle to the class icon. This member must be a handle to an icon resource. If this member is NULL , the
system provides a default icon.
hCursor

Type: HCURSOR
A handle to the class cursor. This member must be a handle to a cursor resource. If this member is NULL , an
application must explicitly set the cursor shape whenever the mouse moves into the application's window.
hbrBackground

Type: HBRUSH
A handle to the class background brush. This member can be a handle to the physical brush to be used for
painting the background, or it can be a color value. A color value must be one of the following standard system
colors (the value 1 must be added to the chosen color). If a color value is given, you must convert it to one of the
following HBRUSH types:
COLOR_ACTIVEBORDER
COLOR_ACTIVECAPTION
COLOR_APPWORKSPACE
COLOR_BACKGROUND
COLOR_BTNFACE
COLOR_BTNSHADOW
COLOR_BTNTEXT
COLOR_CAPTIONTEXT
COLOR_GRAYTEXT
COLOR_HIGHLIGHT
COLOR_HIGHLIGHTTEXT
COLOR_INACTIVEBORDER
COLOR_INACTIVECAPTION
COLOR_MENU
COLOR_MENUTEXT
COLOR_SCROLLBAR
COLOR_WINDOW
COLOR_WINDOWFRAME
COLOR_WINDOWTEXT
The system automatically deletes class background brushes when the class is unregistered by using
UnregisterClass. An application should not delete these brushes.
When this member is NULL , an application must paint its own background whenever it is requested to paint in
its client area. To determine whether the background must be painted, an application can either process the
WM_ERASEBKGND message or test the fErase member of the PAINTSTRUCT structure filled by the BeginPaint
function.
lpszMenuName
Type: LPCTSTR
The resource name of the class menu, as the name appears in the resource file. If you use an integer to identify
the menu, use the MAKEINTRESOURCE macro. If this member is NULL , windows belonging to this class have no
default menu.
lpszClassName

Type: LPCTSTR
A pointer to a null-terminated string or is an atom. If this parameter is an atom, it must be a class atom created
by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of
lpszClassName ; the high-order word must be zero.
If lpszClassName is a string, it specifies the window class name. The class name can be any name registered
with RegisterClass or RegisterClassEx, or any of the predefined control-class names.
The maximum length for lpszClassName is 256. If lpszClassName is greater than the maximum length, the
RegisterClass function will fail.

Remarks
NOTE
The winuser.h header defines WNDCLASS as an alias which automatically selects the ANSI or Unicode version of this
function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with
code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more
information, see Conventions for Function Prototypes.

Requirements

Minimum suppor ted client Windows 2000 Professional [desktop apps only]

Minimum suppor ted ser ver Windows 2000 Server [desktop apps only]

Header winuser.h (include Windows.h)

See also
BeginPaint
Conceptual
CreateWindow
CreateWindowEx
GetDC
MAKEINTRESOURCE
Other Resources
PAINTSTRUCT
Reference
RegisterClass
UnregisterClass
WM_PAINT
WNDCLASSEX
Window Classes
WindowProc

You might also like