Search
USER32.dll Overview
The USER32.dll module provides access to the core Windows user interface functions. This includes managing windows, menus, messages, controls, and other elements that constitute the graphical user interface (GUI) of Windows.
Key Function Categories
Window Management
CreateWindowEx
Creates an overlapping, top-level window.
Parameters: Specifies window attributes, title, position, size, parent window, menu, and instance.
Return Value: Handle to the new window if successful, NULL otherwise.
DestroyWindow
Destroys the specified window.
Parameters: Handle to the window to destroy.
Return Value: Nonzero if successful, zero otherwise.
ShowWindow
Sets the show state of a window.
Parameters: Handle to the window and the command to control its display.
Return Value: The previous value of nCmdShow.
SetWindowText
Sets the text of a specified window's title bar.
Parameters: Handle to the window and the new text.
Return Value: Nonzero if successful, zero otherwise.
GetWindowText
Copies the text of the specified window's title bar into a buffer.
Parameters: Handle to the window, buffer to receive text, and maximum characters to copy.
Return Value: The number of characters copied, or 0 if no text is found.
Message Handling
GetMessage
Retrieves messages from the calling thread's message queue.
Parameters: Pointer to a MSG structure, handle to the window, minimum message value, and maximum message value.
Return Value: Nonzero if a message is retrieved, zero if WM_QUIT is received, -1 on error.
TranslateMessage
Translates virtual-key messages into character messages.
Parameters: Pointer to a MSG structure.
Return Value: Nonzero if message was translated, zero otherwise.
DispatchMessage
Sends a message to the appropriate window procedure.
Parameters: Pointer to a MSG structure.
Return Value: The return value of the window procedure.
PostMessage
Places (posts) a message in the message queue of the specified thread or process.
Parameters: Handle to the destination window or thread, message identifier, and message parameters.
Return Value: Nonzero if successful, zero otherwise.
Controls and Dialogs
MessageBox
Creates, displays, and operates a message box window.
Parameters: Handle to the owner window, text, caption, and buttons/icons.
Return Value: Identifier of the key pressed by the user.
DialogBox
Creates a modality dialog box from a template resource.
Parameters: Instance handle, dialog box template name or resource ID, parent window handle, and dialog box procedure.
Return Value: The value passed as the nResult parameter when the dialog box procedure called the EndDialog function.
SendDlgItemMessage
Sends a message to a specific control in a dialog box.
Parameters: Handle to the dialog box, identifier of the control, message, and message parameters.
Return Value: The return value of the control's message procedure.
Input Handling
GetCursorPos
Retrieves the screen coordinates of the mouse cursor.
Parameters: Pointer to a POINT structure to receive coordinates.
Return Value: Nonzero if successful, zero otherwise.
SetFocus
Sets the keyboard focus to the specified window.
Parameters: Handle to the window that will receive keyboard input.
Return Value: Handle to the window that previously had keyboard focus.