Module win32gui

A module which provides an interface to the native win32 GUI API.
Note that a module winxpgui also exists, which has the same methods as win32gui, but has an XP manifest and is setup for side-by-side sharing support for certain system DLLs, notably commctl32.

Methods

EnumFontFamilies
Enumerates the available font families. 

set_logger
Sets a logger object for exceptions and error information 

LOGFONT
Creates a LOGFONT object. 

CreateFontIndirect
function creates a logical font that has the specified characteristics. The font can subsequently be selected as the current font for any device context. 

GetObject
Returns a struct containing the parameters used to create a GDI object 

GetObjectType
Returns the type (OBJ_* constant) of a GDI handle 

PyGetMemory
Returns a buffer object from and address and length 

PyGetString
Returns a string from an address. 

PySetString
Copies a string to an address (null terminated). You almost certainly should use win32gui::PySetMemory instead. 

PySetMemory
Copies bytes to an address. 

PyGetArraySignedLong
Returns a signed long from an array object at specified index 

PyGetBufferAddressAndLen
Returns a buffer object address and len 

FlashWindow
The FlashWindow function flashes the specified window one time. It does not change the active state of the window. 

FlashWindowEx
The FlashWindowEx function flashes the specified window a specified number of times. 

GetWindowLong
 

GetClassLong
 

SetWindowLong
Places a long value at the specified offset into the extra window memory of the given window. 

CallWindowProc
 

SendMessage
Sends a message to the window. 

SendMessageTimeout
Sends a message to the window. 

PostMessage
 

PostThreadMessage
 

ReplyMessage
Used to reply to a message sent through the SendMessage function without returning control to the function that called SendMessage. 

RegisterWindowMessage
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. 

DefWindowProc
 

EnumWindows
Enumerates all top-level windows on the screen by passing the handle to each window, in turn, to an application-defined callback function. 

EnumThreadWindows
Enumerates all top-level windows associated with a thread on the screen by passing the handle to each window, in turn, to an application-defined callback function. EnumThreadWindows continues until the last top-level window associated with the thread is enumerated or the callback function returns FALSE 

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. EnumChildWindows continues until the last child window is enumerated or the callback function returns FALSE. 

DialogBox
Creates a modal dialog box. 

DialogBoxParam
See win32gui::DialogBox 

DialogBoxIndirect
Creates a modal dialog box from a template, see win32ui::CreateDialogIndirect 

DialogBoxIndirectParam
See win32gui::DialogBoxIndirect 

CreateDialogIndirect
Creates a modeless dialog box from a template, see win32ui::CreateDialogIndirect 

DialogBoxIndirectParam
See win32gui::CreateDialogIndirect 

EndDialog
Ends a dialog box. 

GetDlgItem
Retrieves the handle to a control in the specified dialog box. 

GetDlgItemInt
Returns the integer value of a dialog control 

SetDlgItemInt
Places an integer value in a dialog control 

GetDlgCtrlID
Retrieves the identifier of the specified control. 

GetDlgItemText
Returns the text of a dialog control 

SetDlgItemText
Sets the text for a window or control 

GetNextDlgTabItem
Retrieves a handle to the first control that has the WS_TABSTOP style that precedes (or follows) the specified control. 

GetNextDlgGroupItem
Retrieves a handle to the first control in a group of controls that precedes (or follows) the specified control in a dialog box. 

SetWindowText
Sets the window text. 

GetWindowText
Get the window text. 

InitCommonControls
Initializes the common controls. 

InitCommonControlsEx
Initializes specific common controls. 

LoadCursor
Loads a cursor. 

SetCursor
 

GetCursor
 

GetCursorInfo
Retrieves information about the global cursor. 

CreateAcceleratorTable
Creates an accelerator table 

DestroyAccleratorTable
Destroys an accelerator table 

LoadMenu
Loads a menu 

DestroyMenu
Destroys a previously loaded menu. 

SetMenu
Sets the menu for the specified window. 

GetMenu
Gets the menu for the specified window. 

LoadIcon
Loads an icon 

CopyIcon
Copies an icon 

DrawIcon
Draws an icon or cursor into the specified device context. To specify additional drawing options, use the win32gui::DrawIconEx function. 

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. 

CreateIconIndirect
Creates an icon or cursor from an ICONINFO structure. 

CreateIconFromResource
Creates an icon or cursor from resource bits describing the icon. 

LoadImage
Loads a bitmap, cursor or icon 

DeleteObject
Deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. After the object is deleted, the specified handle is no longer valid. 

BitBlt
Performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context. 

StretchBlt
Copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary 

PatBlt
Paints a rectangle by combining the current brush with existing colors 

SetStretchBltMode
Sets the stretching mode used by win32gui::StretchBlt 

GetStretchBltMode
Returns the stretching mode used by win32gui::StretchBlt 

TransparentBlt
Transfers color from one DC to another, with one color treated as transparent 

MaskBlt
Combines the color data for the source and destination bitmaps using the specified mask and raster operation. 

AlphaBlend
Transfers color information using alpha blending 

ImageList_Add
Adds an image or images to an image list. 

ImageList_Create
Create an image list 

ImageList_Destroy
Destroy an imagelist 

ImageList_Draw
Draw an image on an HDC 

ImageList_DrawEx
Draw an image on an HDC 

ImageList_GetIcon
Extract an icon from an imagelist 

ImageList_GetImageCount
Return count of images in imagelist 

ImageList_LoadImage
Loads bitmaps, cursors or icons, creates imagelist 

ImageList_LoadBitmap
Creates an image list from the specified bitmap resource. 

ImageList_Remove
Remove an image from an imagelist 

ImageList_Replace
Replace an image in an imagelist with a bitmap image 

ImageList_ReplaceIcon
Replace an image in an imagelist with an icon image 

ImageList_SetBkColor
Set the background color for the imagelist 

ImageList_SetOverlayImage
Adds a specified image to the list of images to be used as overlay masks. An image list can have up to four overlay masks in version 4.70 and earlier and up to 15 in version 4.71. The function assigns an overlay mask index to the specified image. 

MessageBox
Displays a message box 

MessageBeep
Plays a waveform sound. 

CreateWindow
Creates a new window. 

DestroyWindow
 

EnableWindow
Enables and disables keyboard and mouse input to a window 

FindWindow
Retrieves a handle to the top-level window whose class name and window name match the specified strings. 

FindWindowEx
Retrieves a handle to the top-level window whose class name and window name match the specified strings. 

DragAcceptFiles
Registers whether a window accepts dropped files. 

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. 

SetDoubleClickTime
 

GetDoubleClickTime
 

HideCaret
Hides the caret 

SetCaretPos
Changes the position of the caret 

GetCaretPos
Returns the current caret position 

ShowCaret
Shows the caret at its current position 

CascadeWindows
Cascade windows 

ShowWindow
Shows or hides a window and changes its state 

IsWindowVisible
Indicates if the window has the WS_VISIBLE style. 

IsWindowEnabled
Indicates if the window is enabled. 

SetFocus
Sets focus to the specified window. 

GetFocus
Returns the HWND of the window with focus. 

UpdateWindow
 

BringWindowToTop
 

SetActiveWindow
 

GetActiveWindow
 

SetForegroundWindow
 

GetForegroundWindow
 

GetClientRect
Returns the rectangle of the client area of a window, in client coordinates 

GetDC
Gets the device context for the window. 

SaveDC
Save the state of a device context 

RestoreDC
Restores a device context state 

DeleteDC
Deletes a DC 

CreateCompatibleDC
Creates a memory device context (DC) compatible with the specified device. 

CreateCompatibleBitmap
Creates a bitmap compatible with the device that is associated with the specified device context. 

CreateBitmap
Creates a bitmap 

SelectObject
Selects an object into the specified device context (DC). The new object replaces the previous object of the same type. 

GetCurrentObject
Retrieves currently selected object from a DC 

GetWindowRect
Returns the rectangle for a window in screen coordinates 

GetStockObject
Creates a handle to one of the standard system Gdi objects 

PostQuitMessage
 

WaitMessage
Waits for a message 

SetWindowPos
Sets the position and size of a window 

GetWindowPlacement
Returns placement information about the current window. 

SetWindowPlacement
Sets the windows placement 

RegisterClass
Registers a window class. 

UnregisterClass
Unregisters a window class created by win32gui::RegisterClass 

PumpMessages
Runs a message loop until a WM_QUIT message is received. 

PumpWaitingMessages
Pumps all waiting messages for the current thread. 

GetMessage
 

TranslateMessage
 

DispatchMessage
 

TranslateAccelerator
 

PeekMessage
 

Shell_NotifyIcon
Adds, removes or modifies a taskbar icon. 

GetSystemMenu
 

DrawMenuBar
 

MoveWindow
 

CloseWindow
 

DeleteMenu
 

RemoveMenu
 

CreateMenu
 

CreatePopupMenu
 

TrackPopupMenu
Display popup shortcut menu 

CommDlgExtendedError
 

ExtractIcon
 

ExtractIconEx
 

DestroyIcon
 

GetIconInfo
Returns parameters for an icon or cursor 

ScreenToClient
Convert screen coordinates to client coords 

ClientToScreen
Convert client coordinates to screen coords 

PaintDesktop
Fills a DC with the destop background 

RedrawWindow
Causes a portion of a window to be redrawn 

GetTextExtentPoint32
Computes the width and height of the specified string of text. 

GetTextMetrics
Returns info for the font selected into a DC 

GetTextCharacterExtra
Returns the space between characters 

SetTextCharacterExtra
Sets the spacing between characters 

GetTextAlign
Returns horizontal and vertical alignment for text in a device context 

SetTextAlign
Sets horizontal and vertical alignment for text in a device context 

GetTextFace
Retrieves the name of the font currently selected in a DC 

GetMapMode
Returns the method a device context uses to translate logical units to physical units 

SetMapMode
Sets the method used for translating logical units to device units 

GetGraphicsMode
Determines if advanced GDI features are enabled for a device context 

SetGraphicsMode
Enables or disables advanced graphics features for a DC 

GetLayout
Retrieves the layout mode of a device context 

SetLayout
Sets the layout for a device context 

GetPolyFillMode
Returns the polygon filling mode for a device context 

SetPolyFillMode
Sets the polygon filling mode for a device context 

GetWorldTransform
Retrieves a device context's coordinate space translation matrix 

SetWorldTransform
Transforms a device context's coordinate space 

ModifyWorldTransform
Combines a coordinate tranformation with device context's current transformation 

CombineTransform
Combines two coordinate space transformations 

GetWindowOrgEx
Retrievs the window origin for a DC 

SetWindowOrgEx
Changes the window origin for a DC 

GetViewportOrgEx
Retrievs the origin for a DC's viewport 

SetViewportOrgEx
Changes the viewport origin for a DC 

GetWindowExtEx
Retrieves the window extents for a DC 

SetWindowExtEx
Changes the window extents for a DC 

GetViewportExtEx
Retrieves the viewport extents for a DC 

SetViewportExtEx
Changes the viewport extents for a DC 

GradientFill
Shades triangles or rectangles by interpolating between vertex colors 

GetOpenFileName
Creates an Open dialog box that lets the user specify the drive, directory, and the name of a file or set of files to open. 

InsertMenuItem
Inserts a menu item 

SetMenuItemInfo
Sets menu information 

GetMenuItemInfo
Gets menu information 

GetMenuItemCount
 

GetMenuItemRect
 

GetMenuState
 

SetMenuDefaultItem
 

GetMenuDefaultItem
 

AppendMenu
 

InsertMenu
 

EnableMenuItem
 

CheckMenuItem
 

GetSubMenu
 

ModifyMenu
Changes an existing menu item. This function is used to specify the content, appearance, and behavior of the menu item. 

GetMenuItemID
Retrieves the menu item identifier of a menu item located at the specified position in a 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. 

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. 

SetMenuInfo
Sets information for a specified menu. 

GetMenuInfo
Gets information about a specified menu. 

DrawFocusRect
Draws a standard focus outline around a rectangle 

DrawText
Draws formatted text on a device context 

LineTo
Draw a line from current position to specified point 

Ellipse
Draws a filled ellipse on a device context 

Pie
Draws a section of an ellipse cut by 2 radials 

Arc
Draws an arc defined by an ellipse and 2 radials 

ArcTo
Draws an arc defined by an ellipse and 2 radials 

AngleArc
Draws a line from current pos and a section of a circle's arc 

Chord
Draws a chord defined by an ellipse and 2 radials 

ExtFloodFill
Fills an area with current brush 

SetPixel
Set the color of a single pixel 

GetPixel
Returns the RGB color of a single pixel 

GetROP2
Returns the foreground mixing mode of a DC 

SetROP2
Sets the foreground mixing mode of a DC 

SetPixelV
Sets the color of a single pixel to an approximation of specified color 

MoveToEx
Changes the current drawing position 

GetCurrentPositionEx
Returns a device context's current drawing position 

GetArcDirection
Returns the direction in which rectangles and arcs are drawn 

SetArcDirection
Sets the drawing direction for arcs and rectangles 

Polygon
Draws a closed filled polygon defined by a sequence of points 

Polyline
Connects a sequence of points using currently selected pen 

PolylineTo
Draws a series of lines starting from current position. Updates current position with end point. 

PolyBezier
Draws a series of Bezier curves starting from first point specified. 

PolyBezierTo
Draws a series of Bezier curves starting from current drawing position. 

PlgBlt
Copies color from a rectangle into a parallelogram 

CreatePolygonRgn
Creates a region from a sequence of vertices 

ExtTextOut
Writes text to a DC. 

GetTextColor
Returns the text color for a DC 

SetTextColor
Changes the text color for a device context 

GetBkMode
Returns the background mode for a device context 

SetBkMode
Sets the background mode for a device context 

GetBkColor
Returns the background color for a device context 

SetBkColor
Sets the background color for a device context 

DrawEdge
Draws edge(s) of a rectangle 

FillRect
Fills a rectangular area with specified brush 

FillRgn
Fills a region with specified brush 

PaintRgn
Paints a region with current brush 

FrameRgn
Draws a frame around a region 

InvertRgn
Inverts the colors in a region 

EqualRgn
Determines if 2 regions are equal 

PtInRegion
Determines if a region contains a point 

PtInRect
Determines if a rectangle contains a point 

RectInRegion
Determines if a region and rectangle overlap at any point 

SetRectRgn
Makes an existing region rectangular 

CombineRgn
Combines two regions 

DrawAnimatedRects
Animates a rectangle in the manner of minimizing, mazimizing, or opening 

CreateSolidBrush
Creates a solid brush of specified color 

CreatePatternBrush
Creates a brush using a bitmap as a pattern 

CreateHatchBrush
Creates a hatch brush with specified style and color 

CreatePen
Create a GDI pen 

GetSysColor
Returns the color of a window element 

GetSysColorBrush
Creates a handle to a system color brush 

ValidateRect
Validates the client area within a rectangle by removing the rectangle from the update region of the specified window. 

InvalidateRect
Invalidates a rectangular area of a window and adds it to the window's update region 

FrameRect
Draws an outline around a rectangle 

InvertRect
Inverts the colors in a regtangular region 

WindowFromDC
Finds the window associated with a device context 

GetUpdateRgn
Copies the update region of a window into an existing region 

GetWindowRgn
Copies the window region of a window into an existing region 

SetWindowRgn
Sets the visible region of a window 

GetWindowRgnBox
Returns the bounding box for a window's region 

ValidateRgn
Removes a region from a window's update region 

InvalidateRgn
Adds a region to a window's update region 

GetRgnBox
Calculates the bounding box of a region 

OffsetRgn
Relocates a region 

Rectangle
Creates a solid rectangle using currently selected pen and brush 

RoundRect
Draws a rectangle with elliptically rounded corners, filled using using current brush 

BeginPaint
 

EndPaint
 

BeginPath
Initializes a path in a DC 

EndPath
Finalizes a path begun by win32gui::BeginPath 

AbortPath
Cancels a path begun by win32gui::BeginPath 

CloseFigure
Closes a section of a path by connecting the beginning pos with the current pos 

FlattenPath
Flattens any curves in current path into a series of lines 

FillPath
Fills a path with currently selected brush 

WidenPath
Widens current path by amount it would increase by if drawn with currently selected pen 

StrokePath
Draws current path with currently selected pen 

StrokeAndFillPath
Combines operations of StrokePath and FillPath with no overlap 

GetMiterLimit
Retrieves the limit of miter joins for a DC 

SetMiterLimit
Set the limit of miter joins for a DC 

PathToRegion
Converts a closed path in a DC to a region 

GetPath
Returns a sequence of points that describe the current path 

CreateRoundRectRgn
Create a rectangular region with elliptically rounded corners, 

CreateRectRgnIndirect
Creates a rectangular region, 

CreateEllipticRgnIndirect
Creates an ellipse region, 

CreateWindowEx
Creates a new window with Extended Style. 

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

SetParent
changes the parent window of the specified child window. 

GetCursorPos
retrieves the cursor's position, in screen coordinates. 

GetDesktopWindow
returns the desktop window 

GetWindow
returns a window that has the specified relationship (Z order or owner) to the specified window. 

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. 

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

GetWindowDC
returns the device context (DC) for the entire window, including title bar, menus, and scroll bars. 

IsIconic
determines whether the specified window is minimized (iconic). 

IsWindow
determines whether the specified window handle identifies an existing window. 

IsChild
Tests whether a window is a child window or descendant window of a specified parent window 

ReleaseCapture
Releases the moust capture for a window. 

GetCapture
Returns the window with the mouse capture. 

SetCapture
Captures the mouse for the specified window. 

_TrackMouseEvent
Posts messages when the mouse pointer leaves a window or hovers over a window for a specified amount of time. 

ReleaseDC
Releases a device context. 

CreateCaret
Creates a new caret for a window 

DestroyCaret
Destroys caret for current task 

ScrollWindowEx
scrolls the content of the specified window's client area. 

SetScrollInfo
Sets information about a scroll-bar 

GetScrollInfo
Returns information about a scroll bar 

GetClassName
Retrieves the name of the class to which the specified window belongs. 

WindowFromPoint
Retrieves a handle to the window that contains the specified point. 

ChildWindowFromPoint
Determines which, if any, of the child windows belonging to a parent window contains the specified point. 

ChildWindowFromPoint
Determines which, if any, of the child windows belonging to a parent window contains the specified point. 

ListView_SortItems
Uses an application-defined comparison function to sort the items of a list view control. 

ListView_SortItemsEx
Uses an application-defined comparison function to sort the items of a list view control. 

CreateDC
Creates a device context for a printer or display device 

ResetDC
Resets a DC 

GetSaveFileNameW
Creates a dialog for user to specify location to save a file or files 

GetOpenFileNameW
Creates a dialog to allow user to select file(s) to open 

SystemParametersInfo
Queries or sets system-wide parameters. This function can also update the user profile while setting a parameter. 

SetLayeredWindowAttributes
Sets the opacity and transparency color key of a layered window. 

GetLayeredWindowAttributes
Retrieves the layering parameters of a window with the WS_EX_LAYERED extended style 

UpdateLayeredWindow
Updates the position, size, shape, content, and translucency of a layered window. 

AnimateWindow
Enables you to produce special effects when showing or hiding windows. There are three types of animation: roll, slide, and alpha-blended fade. 

CreateBrushIndirect
Creates a GDI brush from a LOGBRUSH struct 

ExtCreatePen
Creates a GDI pen object 

DrawTextW
Draws Unicode text on a device context. 

EnumPropsEx
Enumerates properties attached to a window. Each property is passed to a callback function, which receives 4 arguments:
Handle to the window, name of the property, handle to the property data, and Param object passed to this function 

RegisterDeviceNotification
Registers the device or type of device for which a window will receive notifications. 

UnregisterDeviceNotification
Unregisters a Device Notification handle. It is generally not necessary to call this function manually, but in some cases, handle values may be extracted via the struct module and need to be closed explicitly. 

RegisterHotKey
Registers a hotkey for a window