Win32Dialogs

BOOL AddButton(
    HWND hWnd,
    INT iX,
    INT iY,
    INT iWidth,
    INT iHeight,
    INT iID,
    const _TCHAR * ptcText,
    const _TCHAR * ptcActionHandler)


Adds a button to the specified window. When pressed, the script function ptcActionHandler will be called.
    ptcActionHandler must be in format:
        VOID [function]( HWND hOwner, HWND hButton )

    Standard dimensions are 75×23.


BOOL AddCheck(
    HWND hWnd,
    INT iX,
    INT iY,
    INT iWidth,
    INT iHeight,
    INT iID,
    const _TCHAR * ptcText,
    const _TCHAR * ptcActionHandler)


Adds a check button to the specified window. When pressed, the script function ptcActionHandler will be called, along with a parameter indicating whether the button is checked or unchecked as a result of the press. You can also use IsDlgButtonChecked() to obtain the checked state of the button at any given time.
    ptcActionHandler must be in format:
        VOID [function]( HWND hOwner, HWND hCheck, BOOL bChecked )

    Standard height is 16.


BOOL AddComboItem(
    HWND hWnd,
    const _TCHAR * ptcText,
    DWORD dwData)


Adds a string with related data to the combo box specified by hWnd.


BOOL AddDropCombo(
    HWND hWnd,
    INT iX,
    INT iY,
    INT iWidth,
    INT iHeight,
    INT iID,
    const _TCHAR * ptcSelectionHandler)


Adds a drop-list combo box to the specified window. A drop-list combo box has specific items the user must select, and the user can not enter text into it. ptcSelectionHandler defines the script function that will be called when an item from the combo box is selected.
Use SetWindowText() to set the initial selection after using AddComboItem() to fill it with items the user can select.
    ptcActionHandler must be in format:
        VOID [function]( HWND hOwner, HWND hCombo, const _TCHAR * ptcText, DWORD dwData )
    Standard height is 21.


BOOL AddEdit(
    HWND hWnd,
    INT iX,
    INT iY,
    INT iWidth,
    INT iHeight,
    INT iID,
    const _TCHAR * ptcActionHandler)


Adds an edit box to the specified window. When the text in the edit box changes, the script function ptcActionHandler will be called.
    ptcActionHandler must be in format:
        VOID [function]( HWND hOwner, HWND hEdit )
    Standard height is 20.


BOOL AddLabel(
    HWND hWnd,
    INT iX,
    INT iY,
    INT iWidth,
    INT iHeight,
    INT iID,
    const _TCHAR * ptcText)


Adds a label to the specified window. Same as AddStatic().
    Standard height is 13.


BOOL AddStatic(
    HWND hWnd,
    INT iX,
    INT iY,
    INT iWidth,
    INT iHeight,
    INT iID,
    const _TCHAR * ptcText)


Adds a label to the specified window. Same as AddLabel().
    Standard height is 13.


BOOL AddUpDown(
    HWND hWnd,
    INT iX,
    INT iY,
    INT iWidth,
    INT iHeight,
    INT iID,
    INT iLow,
    INT iHigh,
    INT iPos,
    const _TCHAR * ptcActionHandler)


Adds an Up/Down control to the specified window. An Up/Down control allows users to press up/down buttons to increment and decrement a value or selection inside a combo box. ptcActionHandler defines the script function that will be called when the user presses an arrow in the Up/Down control. Inside this function, return WIN_ALLOW to allow the change or WIN_DISALLOW to prevent the change. This function allows you to specify the range of the control and a starting position.


BOOL AddUpDown(
    HWND hWnd,
    INT iX,
    INT iY,
    INT iWidth,
    INT iHeight,
    INT iID,
    INT iPos,
    const _TCHAR * ptcActionHandler)


Adds an Up/Down control to the specified window. An Up/Down control allows users to press up/down buttons to increment and decrement a value or selection inside a combo box. ptcActionHandler defines the script function that will be called when the user presses an arrow in the Up/Down control. Inside this function, return WIN_ALLOW to allow the change or WIN_DISALLOW to prevent the change. This function allows you to specify a starting position.


BOOL AddUpDown(
    HWND hWnd,
    INT iX,
    INT iY,
    INT iWidth,
    INT iHeight,
    INT iID,
    const _TCHAR * ptcActionHandler)


Adds an Up/Down control to the specified window. An Up/Down control allows users to press up/down buttons to increment and decrement a value or selection inside a combo box. ptcActionHandler defines the script function that will be called when the user presses an arrow in the Up/Down control. Inside this function, return WIN_ALLOW to allow the change or WIN_DISALLOW to prevent the change.


HDC BeginPaint(
    HWND hWnd,
    LPPAINTSTRUCT lpPaint)


Prepares the specified window for painting and fills a PAINTSTRUCT structure with information about the painting. Returns the HDC for the specified window, or NULL for error.
    Call EndPaint() when you are done painting the window.


BOOL CheckDlgButton(
    HWND hWnd,
    INT iID,
    UINT uiCheck)


Changes the check state of a check-button control.
uiCheck can be one of the following values:
    BST_CHECKED: Sets the button state to checked.
    BST_INDETERMINATE: Sets the button state to grayed, indicating an indeterminate state.
    BST_UNCHECKED: Sets the button state to cleared


BOOL ClipCursor(
    const RECT * lpRect)


Confines the cursor to a rectangular area on the screen. If a subsequent cursor position (set by the SetCursorPos function or the mouse) lies outside the rectangle, the system automatically adjusts the position to keep the cursor inside the rectangular area.


BOOL CloseWindow(
    HWND hWnd)


Minimizes (but does not destroy) the specified window. To destroy a window, the script must use the DestroyWindow() function.


HWND CreateDialog(
    HWND hOwner,
    const CHAR * pcTitle,
    INT iX,
    INT iY,
    INT iWidth,
    INT iHeight,
    const TCHAR * ptcHandler)


Creates a dialog window at the specified position with the specified width, height, and name. ptcHandler identifies the script-defined function for handling the window’s messages.


HWND CreateWindow(
    const CHAR * pcTitle,
    INT iX,
    INT iY,
    INT iWidth,
    INT iHeight,
    const TCHAR * ptcHandler)


Creates a window at the specified position with the specified width, height, and name. ptcHandler identifies the script-defined function for handling the window’s messages.


BOOL DestroyWindow(
    HWND hWnd)


Destroys the specified window. The function sends WM_DESTROY and WM_NCDESTROY messages to the window.
    This function can only be used to destroy windows created via scripts.


BOOL DrawCaption(
    HWND hWnd,
    HDC hDC,
    LPCRECT lpRC,
    UINT uiFlags)


Draws a window caption. uiFlags can be 0 or any of the following flags combined with the logical OR (|) operator:
    DC_ACTIVE: The function uses the colors that denote an active caption.
    DC_BUTTONS: If set, the function draws the buttons in the caption bar (to minimize, restore, or close an application).
    DC_GRADIENT: Uses the system settings to apply a gradient to the caption.
    DC_ICON: The function draws the icon when drawing the caption text.
    DC_INBUTTON: The function draws the caption as a button.
    DC_SMALLCAP: The function draws a small caption, using the current small caption font.
    DC_TEXT: The function draws the caption text when drawing the caption.


BOOL DrawLine(
    HDC hDC,
    COLORREF crColor,
    INT iX1,
    INT iY1,
    INT iX2,
    INT iY2)


Draws a line from the starting point up to, but not including, the end point, using the specified color


BOOL DrawLine(
    HDC hDC,
    COLORREF crColor,
    LPPOINT lpStart,
    LPPOINT lpEnd)


Draws a line from the starting point up to, but not including, the end point, using the specified color


BOOL DrawLine(
    HDC hDC,
    INT iX1,
    INT iY1,
    INT iX2,
    INT iY2)


Draws a line from the starting point up to, but not including, the end point. The line is drawn by using the current pen and, if the pen is a geometric pen, the current brush.


BOOL DrawLine(
    HDC hDC,
    LPPOINT lpStart,
    LPPOINT lpEnd)


Draws a line from the starting point up to, but not including, the end point. The line is drawn by using the current pen and, if the pen is a geometric pen, the current brush.


BOOL DrawRect(
    HDC hDC,
    COLORREF crOutter,
    COLORREF crInner,
    INT iLeft,
    INT iTop,
    INT iRight,
    INT iBottom)


Draws a rectangle using the specified colors.


BOOL DrawRect(
    HDC hDC,
    COLORREF crOutter,
    COLORREF crInner,
    LPCRECT lpcRect)


Draws a rectangle using the specified colors.


BOOL DrawRect(
    HDC hDC,
    INT iLeft,
    INT iTop,
    INT iRight,
    INT iBottom)


Draws a rectangle using the current brush (fill) and pen (outline).


BOOL DrawRect(
    HDC hDC,
    LPCRECT lpcRect)


Draws a rectangle using the current brush (fill) and pen (outline).


BOOL EndPaint(
    HWND hWnd,
    const PAINTSTRUCT * lpPaint)


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.


BOOL FindWindow(
    LPCTSTR lpClassName,
    LPCTSTR lpWindowName)


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.


BOOL FindWindow(
    LPCTSTR lpWindowName)


Retrieves a handle to the top-level window whose window name matches the specified string. 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.


BOOL FindWindowEx(
    HWND hWnd,
    HWND hwndChildAfter,
    LPCTSTR lpClassName,
    LPCTSTR lpWindowName)


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.


HWND GetActiveWindow()


Retrieves the window handle to the active window attached to the calling thread’s message queue.


COLORREF GetBkColor(
    HDC hDC)


Returns the current background color for the specified device context. If hDC is invalid, it returns CLR_INVALID.


BOOL GetClientHeight(
    HWND hWnd)


Gets the height of the specified window’s client area.


BOOL GetClientRect(
    HWND hWnd,
    LPRECT lpRect)


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


BOOL GetClientWidth(
    HWND hWnd)


Gets the width of the specified window’s client area.


BOOL GetCursorPos(
    LPPOINT lpPoint)


Retrieves the cursor’s position, in screen coordinates.


HWND GetDlgItem(
    HWND hWnd,
    INT iID)


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


HWND GetFocus()


Retrieves the handle to the window that has the keyboard focus, if the window is attached to the calling thread’s message queue.


HWND GetForegroundWindow()


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


COLORREF GetPixel(
    HDC hDC,
    INT nXPos,
    INT nYPos)


Retrieves the red, green, blue (RGB) color value of the pixel at the specified coordinates.


COLORREF GetTextColor(
    HDC hDC)


Retrieves the current text color for the specified device context. If hDC is invalid, it returns CLR_INVALID.


HDC GetWindowDC(
    HWND hWnd)


Retrieves the device context (DC) for the entire window, including title bar, menus, and scroll bars. A window device context permits painting anywhere in a window, because the origin of the device context is the upper-left corner of the window instead of the client area.
    Call ReleaseDC() to release the device context when you are done with it.


BOOL GetWindowHeight(
    HWND hWnd)


Gets the height of the specified window.


BOOL GetWindowPos(
    HWND hWnd,
    INT * piX,
    INT * piY)


Gets the position of the specified window.


BOOL GetWindowRect(
    HWND hWnd,
    LPRECT lpRect)


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.


BOOL GetWindowSize(
    HWND hWnd,
    INT * piWidth,
    INT * piHeight)


Gets the width and height of the specified window.


BOOL GetWindowText(
    HWND hWnd,
    LPTSTR lpString,
    int nMaxCount)


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.


INT GetWindowTextLength(
    HWND hWnd)


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.


BOOL GetWindowWidth(
    HWND hWnd)


Gets the width of the specified window.


BOOL HIWORD(
    DWORD dwParam)


Gets the upper 16 bits from the specified value.


BOOL IsDlgButtonChecked(
    HWND hWnd,
    INT iID)


Whether a check-button control has a check mark next to it or whether a three-state button control is grayed, checked, or neither.


BOOL IsWindow(
    HWND hWnd)


Determines whether the specified window handle identifies an existing window.


BOOL IsWindowEnabled(
    HWND hWnd)


Determines whether the specified window is enabled for mouse and keyboard input.


BOOL IsWindowVisible(
    HWND hWnd)


Retrieves the visibility state of the specified window.


BOOL LOWORD(
    DWORD dwParam)


Gets the lower 16 bits from the specified value.


DWORD MAKELONG(
    WORD wLow,
    WORD wHigh)


Creates a DWORD value by concatenating the specified values.


WORD MAKEWORD(
    BYTE bLow,
    BYTE bHigh)


Creates a WORD value by concatenating the specified values.


BOOL PostMessage(
    HWND hWnd,
    UINT Msg,
    WPARAM wParam,
    LPARAM lParam)


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.


COLORREF RGB(
    DWORD dwR,
    DWORD dwG,
    DWORD dwB)


Converts the specified red, green, and blue values to a COLORREF type.


INT ReleaseDC(
    HWND hWnd,
    HDC hDC)


Releases a device context (DC), freeing it for use by other applications.


LRESULT SendDlgItemMessage(
    HWND hDlg,
    INT nIDDlgItem,
    UINT Msg,
    WPARAM wParam,
    LPARAM lParam)


sends a message to the specified control in a dialog box. The SendDlgItemMessage() function does not return until the message has been processed.


BOOL SendMessage(
    HWND hWnd,
    UINT Msg,
    WPARAM wParam,
    LPARAM lParam)


Sends the specified message to a window or windows. It calls the window procedure for the specified window and does not return until the window procedure has processed the message.


HWND SetActiveWindow(
    HWND hWnd)


Activates a window. The window must be attached to the calling thread’s message queue.


COLORREF SetBkColor(
    HDC hDC,
    COLORREF crColor)


Sets the current background color to the specified color value, or to the nearest physical color if the device cannot represent the specified color value. The return value specifies the previous background color as a COLORREF value.


BOOL SetCursorPos(
    INT iX,
    INT iY)


Moves the cursor to the specified screen coordinates. If the new coordinates are not within the screen rectangle set by the most recent ClipCursor function call, the system automatically adjusts the coordinates so that the cursor stays within the rectangle.


HWND SetFocus(
    HWND hWnd)


Sets the keyboard focus to the specified window. The window must be attached to the calling thread’s message queue.


BOOL SetForegroundWindow(
    HWND hWnd)


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


COLORREF SetPixel(
    HDC hDC,
    INT nXPos,
    INT nYPos,
    COLORREF crColor)


Sets the pixel at the specified coordinates to the specified color.


COLORREF SetTextColor(
    HDC hDC,
    COLORREF crColor)


Sets the text color for the specified device context to the specified color. The return value specifies the previous text color as a COLORREF value.


BOOL SetWindowPos(
    HWND hWnd,
    INT iX,
    INT iY)


Sets the position of the specified window.


BOOL SetWindowSize(
    HWND hWnd,
    INT iWidth,
    INT iHeight)


Sets the width and height of the specified window.


BOOL SetWindowText(
    HWND hWnd,
    LPCTSTR lpString)


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.


BOOL ShowWindow(
    HWND hWnd,
    INT nCmdShow)


Sets the specified window’s show state.
    nCmdShow can be one of the following:
        SW_FORCEMINIMIZE: Minimizes a window, even if the thread that owns the window is not responding. This flag should only be used when minimizing windows from a different thread.
        SW_HIDE: Hides the window and activates another window.
        SW_MAXIMIZE: Maximizes the specified window.
        SW_MINIMIZE: Minimizes the specified window and activates the next top-level window in the Z order.
        SW_RESTORE: Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.
        SW_SHOW: Activates the window and displays it in its current size and position.
        SW_SHOWDEFAULT: Sets the show state based on the SW_ value specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application.
        SW_SHOWMAXIMIZED: Activates the window and displays it as a maximized window.
        SW_SHOWMINIMIZED: Activates the window and displays it as a minimized window.
        SW_SHOWMINNOACTIVE: Displays the window as a minimized window. This value is similar to SW_SHOWMINIMIZED, except the window is not activated.
        SW_SHOWNA: Displays the window in its current size and position. This value is similar to SW_SHOW, except the window is not activated.
        SW_SHOWNOACTIVATE: Displays a window in its most recent size and position. This value is similar to SW_SHOWNORMAL, except the window is not actived.
        SW_SHOWNORMAL: Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.


BOOL ShowWindowAsync(
    HWND hWnd,
    INT nCmdShow)


Sets the show state of a window created by a different thread. nCmdShow is the same as in ShowWindow().


Copyright © 2006 Shawn (L. Spiro) Wilcoxen