Windows API user32.dll

Source: Internet
Author: User

If you don't want your ownProgramIt is closed from the window popped up by CTRL + ALT + DEL,
This section describes an unpublished API function for Windows:

Registerserviceprocess (processid: Long, type: Long)
This function exists in kernal32.dll.
Process indicates the process ID. type indicates whether to register the process with the system. The value is 1 and no 0.
========================================================== ========================================
Getclientrect
Function: This function obtains the coordinates of the client area of the window. The customer zone coordinate specifies the upper left corner and lower right corner of the customer zone. Because the customer zone coordinates are relative to the upper left corner of the subwindow customer zone, the upper left corner coordinates are (0, 0)
Function prototype: bool getclientrect (hwnd, lprect );
Parameters:
Getlasterror function.
Note: Windows CE: The command bar is included in the customer zone.
Quick query: Windows NT: 3.1 or later: Windows: 95 or later: Windows CE: 1.0 or later: header file: winuser. h; library file: user32.lib
========================================================== ========================================
Getasktopwindow
Function: return the handle of the desktop window. The desktop window overwrites the entire screen. A desktop window is the area on which all icons and other windows are to be drawn.
Function prototype: hwnd get1_topwindow (void)
Parameter: none.
Return Value: the handle of the desktop window returned by the function.
Quick query: Windows NT: 3.1 or later; windows: 95 or later: Windows CE: not supported; header file: winuser. h; library file: user32.lib.
========================================================== ========================================
Getforegroundwindow
Function: This function returns to the front-end window (the window currently used by the user ). The system assigns a higher priority to the thread that generates the foreground window.
Function prototype: hwnd getforegroundwindow (void)
Parameter: none.
Return Value: The handle returned by the function in the foreground window.
Quick query: Windows NT: 3.1 or later; windows: 95 or later: Windows CE: 1.0 or later: header file: winuser. h; library file: user32.lib.
========================================================== ========================================
Getlastactivepopup
Function: This function determines which pop-up window in the specified window is the most recently active window.
Function prototype: hwnd getlastactivepopup (hwnd );
Parameters:
Hwnd: the owner's window handle.
Return Value: the return value identifies the handle of the recent pop-up window. If any of the following conditions is met
Same: Windows specified by hwnd are recently active: Windows specified by hwnd do not have any pop-up windows; Windows specified by hwnd are not top-level windows or belong to other windows.
Quick query: Windows: 3.1 or later; windows: 95 or later: Windows CE: not supported; header file: winuser. h;
Library File: user32.lib.
========================================================== ========================================
Getnextwindow
Function: This function returns the handle of the previous or next window in the Z sequence. The next window is under the specified window, and the previous window is above. If the specified window is a top window, the function returns the handle of the top window of the next (or the previous. If the specified window is a top-level window, the function returns the handle of the next (or previous) Top-level window. If the function is a subwindow, the function searches for the handle of the next or previous subwindow.
Function prototype: hwnd getnextwindow (hwnd, unit wcmd );
Parameters:
Hwnd: the handle of a window. The window handle obtained based on the wcmd parameter is relative to the window handle.
Wcmd: Specifies whether the window returns the handle of the previous window or the handle of the next window. This parameter can be one of the following two values:
GW hwnonext: return the handle of the window below the given window.
Gw_hwndprev: return the handle of the window above the given window.
Return Value: If the function succeeds, the return value is the handle of the previous window (or the next window. If the front and back windows do not exist, the return value is null. To obtain more error information, call the getlasterror function.
Note: When the gw_hwndnext or gw_getprev flag is set, the call to this function is the same as to call the getwindow function.
Quick query: Windows NT: 3.1 or later; windows: 95 or later: Windows CE: not supported: header file: winuer. h; library file: user32.lib.
========================================================== ========================================
Getparent
Function: This function obtains the parent window handle of a specified subwindow.
Function prototype: hwnd getparent (hwnd );
Parameters:
Hwnd: the Child Window handle. The function needs to obtain the parent window handle of the Child Window.
Return Value: If the function succeeds, the return value is the parent window handle. If the window has no parent window, the function returns NULL. To obtain more error information, call the getlasterror function.
Note: Windows ce1.0 does not support subwindows except the dialog box.
Quick query: Windows NT: 3.1 or later, Windows: 95 or later, Windows CE: 1.0 or later, header file: winuser. h: library file: user32.lib.
========================================================== ========================================
Gettopwindow
Function: This function checks the subwindow Z sequence associated with a specific parent window and returns the handle of the subwindow at the top of the Z sequence.
Function prototype: hwnd gettopwindow (hwnd );
Parameters:
Hwnd: handle of the parent window in the queried order. If this parameter is null, the function returns the window handle at the top of the Z sequence.
Return Value; if the function succeeds, the return value is the sub-window handle at the top of the Z sequence. If the specified window has no child window, the return value is null.
To obtain more error information, call the getlasterror function.
Quick query: Windows NT: 3.1 or later; windows: 95 or later: Windows CE: not supported; header file: winuser. h: library file; user32.lib.
========================================================== ========================================
Getwindow
Function: This function returns a window handle that has a specific relationship with a specified window (such as Z-order or owner.
Function prototype: hwnd getwindow (hwnd, unit ncmd );
Parameters:
Hwnd: Window handle. The window handle to be obtained is based on the handle of the ncmd parameter value relative to this window.
Ncmd: indicates the relationship between the specified window and the window to obtain the handle. This parameter value can be one of the following:
Gw_child: if the specified window is a parent window, the handle of the Child window at the top of the Z sequence is obtained. Otherwise, it is null. The function only checks the Child Window of the specified parent window, and does not check the inheritance window.
Gw_enabledpoup :( WindowsNT 5.0) the returned handle identifies the Enable pop-up window that belongs to the specified window (the first window found by gw_hwndnext that meets the preceding conditions is used for retrieval ); if no window is available, the obtained handle is the same as the specified window.
Gw_hwndfirst: The returned handle identifies windows of the same type at the top end of the Z sequence. If the specified window is the highest-end window, the handle identifies the highest-end window in the Z sequence. If the specified window is a top-level window, the handle identifies the top-level window at the top end of the Z sequence. If the specified window is a subwindow, the handle identifies the same window at the top end of the Z sequence.
Gw_hwndlast: The returned handle identifies windows of the same type at the lowest end of the Z sequence. If the specified window is the highest-end window, the handle identifies the highest-end window at the lowest end of the Z sequence. If the specified window is a top-level window, the handle identifies the top-level window at the lowest end of the Z sequence. If the specified window is a subwindow, the handle identifies the same window at the lowest end of the Z sequence.
Gw_hwndnext: The returned handle identifies windows of the same type in the specified window in Z sequence. If the specified window is the highest-end window, the handle identifies the highest-end window in the specified window. If the specified window is a top-level window, the handle identifies the top-level window in the specified window. If the specified window is a subwindow, the handle identifies the same window in the specified window.
GW hwndprev: The returned handle identifies windows of the same type on the specified window in Z sequence. If the specified window is the highest-end window, the handle identifies the highest-end window in the specified window. If the specified window is a top-level window, the handle identifies the top-level window in the specified window. If the specified window is a subwindow, the handle identifies the same window in the specified window.
Gw_owner: The returned handle identifies the owner window of the specified window (if any ).
Return Value: If the function succeeds, the return value is the window handle. If the window with a specific relationship with the specified window does not exist, the return value is null.
To obtain more error information, call the getlasterror function.
Note: calling the enumchildwindow function in the loop body is more reliable than calling the getwindow function. The application that calls the getwindow function to implement the task may be in an endless loop or return a destroyed window handle.
Quick query: Windows NT: 3.1 or later; windows: 95 or later; Windows CE: 1.0 or later; header file: winuser. h; library file: user32.lib.
========================================================== ========================================
Getwindowplacement
Function: This function returns the display status of the specified window and the restored, maximized, and minimized window position.
Function prototype: bool getwindowplacement (hwnd, windowplacement★Lpwndpl );
Parameters:
Hwnd: window-day handle.
Lpwndpl: pointer to the windowplacement structure, which stores the status and position information.
Before calling the getwindowplacement function, set the length of the windowplacement structure
Sizeof (widnowplacement ). If lpwndpl-> length is set incorrectly, the getwindowplacement function fails.
Return value. If the function succeeds, the return value is non-zero. If the function fails, the return value is zero. To obtain more error information, call the getlasterror function.
Note: The total flags in the windowplacement structure obtained by this function are 0. If the hwnd window is maximized, The showcmd element is showmzaxmized. If the window is minimized, the showcmd element is showminimized. In addition, the shownormn element and the windowplacement length unit must be set to sizeof (windowplacement ), if the parameter settings are incorrect, the function returns false. View the correct information for setting the window position coordinates. For more information, see windowplacement.
Quick query: Windows NT: 3.1 or a later version: Windows: 95 or a later version; Windows CE: not supported; header file: winuser. h; library file: user32.lib.
========================================================== ========================================
Getwindowrect
Function: returns the size of the border rectangle of the specified window. This dimension is given relative to the screen coordinate in the upper left corner of the screen coordinate.
Function prototype: bool getwindowrect (hwnd, lprectlprect );
Parameters:
Hwnd: Window handle.
Lprect: a pointer to a rect structure that receives screen coordinates in the upper left and lower right corner of the window.
Return Value: If the function succeeds, the return value is non-zero. If the function fails, the return value is zero. To obtain more error information, call the getlasterror function.
Quick query: Windows NT: 3.1 or later: Windows: 95 or later; Windows CE: 1.0 or later; header file: winuser. h; library file: user32.lib.
========================================================== ========================================
Getwindowtext
Function: This function copies the title text (if any) of the specified window to a cache area. If the specified window is a control, copy the control text. However, getwindowtext cannot receive control text in other applications.
Function prototype: int getwindowtext (hwnd, lptstr lpstring, int nmaxcount );
Parameters:
Hwnd: A window with text or a control handle.
Ipstring: pointer to the buffer of the received text.
Nmaxcount: specifies the maximum number of characters to be stored in the buffer, which contains null characters. If the text exceeds the limit, it is truncated.
Return Value: If the function succeeds, the return value is the number of characters of the copied string, excluding the empty characters that are interrupted. If the window does not have a title bar or text, or the title bar is empty, or the window or control handle is invalid, the return value is zero. To obtain more error information, call the getlasterror function.
The function cannot return the edited text in other applications.
Note: If the target window belongs to the current process, the getwindowtext function sends the wm_gettext message to the specified window or control. If the target window belongs to another process and has a window title, getwindowtext returns the title text of the window. If the window does not have a title, the function returns an empty string.
Quick query: Windows NT: 3.1 or later; windows: 95 or later: Windows CE: 1.0 or later; header file: winuser. h. Library File: user32.lib: UNICODE: the Unicode and ANSI versions are implemented on Windows NT.
========================================================== ========================================
Ischild
Function: This function tests whether a window is a child window or a child window of a specified parent window. If the parent window is on the linked list of the parent window, the Child Window specifies the direct descendant of the parent window. The parent window linked list is connected to the Child window from the original cascade window or the pop-up window.
Function prototype: bool ischild (hwnd hwndparant, hwnd );
Parameters:
Hwndparant: the parent window handle.
Hwnd: The Window handle to be tested.
Return Value: if the window is a child window or Child Window of the specified window, the return value is non-zero. If the window is not a child or child window of the specified window, the return value is zero.
Quick query: Windows NT: 3.1 or later: Windows: 95 or later; Windows CE: 1.0 or later; header file: winuser. h; library file: user32.iib.
========================================================== ========================================
Getwindowtextlent
Function: returns the length of the title text (if any) of the specified window. If the specified window is a control, the function returns the length of the control text. However, the getwindowtextlength function cannot return the length of text controlled in other applications.
Function prototype: nit getwindowtextlent (hwnd );
Parameters:
Hwnd: window or control handle.
Return Value: If the function succeeds, the return value is the length of the text. Under certain conditions, the returned value may be longer than the actual text length. See the description. If the window has no text, the return value is zero. To obtain more error information, call the getlasterror function.
Note: If the target window belongs to the current process, the getwindowtextlength function sends the wm_gettext message to the specified window or control.
Under certain conditions, the return value of the getwindowtextlength function may be larger than the actual text length. This is because the combination of ANSI and unlcode and the system allows DBCS characters to exist in the text, but the function return value must be at least equal to the actual length of the text, therefore, this can be used to guide the distribution of cache areas. When an application uses both the ANSI function and Unicode normal dialog box, there will be a cache allocation problem. Similarly, when the application uses the ANSI getwindowtextlength function in a unicode window, or when the Unicode getwindowtextlength function is used in an ANSI window, there is also a cache allocation problem. To view the ANSI and vnicode functions, refer to the wind32 functions prototypes.
To obtain the actual length of the text, use the wm_gettext, lb_gettext, cb_getlbtbtext message, or getwindowtext function.
Quick query: Windows NT: 3.1 or later: Windows: 95 or later: Windows CE: 1.0 or later; header file: winuser. h; library file: user32.lib; UNICODE: the Unicode and ANSI versions are implemented on Windows NT.
========================================================== ========================================
Getwindowthreadprocessld
Function: This function returns the ID of the process that creates the specified window thread and the process that creates the window. The last one is optional.
Function prototype; DWORD getwindowthreadprocessld (hwnd, lpdword lpdwprocessld );
Parameters:
Hwnd: Window handle.
Lpdwprocessld: the address that receives the 32-bit value of the Process Identity. If this parameter is not null, getwindwthreadprocessld copies the process identifier to the 32-bit value. Otherwise, the process identifier is not copied.
Return Value: the return value is the thread ID of the window to be created.
Quick query: Windows NT: 3.1 or later; windows: 95 or later; Windows CE: 1.0 or later; header file: winuser. h; library file; user32.lib.
========================================================== ========================================
Isiconic
Function: This function determines whether the given window is a minimized (icon-based) window.
Function prototype: bool isiconic (hwnd );
Parameters:
Hwnd: handle of the tested window.
Return Value: if the window has been converted to icons, the return value is non-zero. If the window is not converted to icons, the return value is zero.
Quick query: Windows NT: 3.1 or later; windows: 95 or later; Windows CE: not supported; header file: winuser. h;
Library File: user32.iib.
========================================================== ========================================
Iswindow
Function: determines whether the given window handle identifies an existing window.
Factor prototype: bool iswindow (hwnd );
Parameters:
Hwnd: handle of the tested window.
Return Value: if the window handle identifies an existing window, the return value is non-zero. If the window handle does not identify an existing window, the return value is zero.
Quick query: Windows NT: 3.1 or later; windows: 95 or later; Windows CE: 1.0 or later; header file: winuserhs; library file: user32.lib.
========================================================== ========================================
Lswindowunicode
Function: This function determines whether the specified window is a local Unicode window.
Function prototype: bool lswindowunicode (hwnd hwndj;
Parameters:
Hwnd: handle of the tested window.
Return Value: if the window is a local Unicode window, the return value is non-zero. If the window is not a local Unicode window, the return value is zero, indicating that the window is an ANSI window.
Note: The character set of a window is determined by the regosterclass function. If the window class is registered with the ANSI version of registerclass (regjsterclassa), the window character set is ANSI. If the window class is registered with the Unicode version of registerclass (registerclassw, the window character set is Unicode.
The system automatically performs Unicode and ANSI bidirectional translation for window messages. For example, if an ANSI window message is measured in a window using the Unicode Character Set, the system converts the message to a unicode message before calling the window. The system calls the lswindowunicode function to determine whether to translate messages.
Quick query: Windows NT: 3.1 or later; windows: 95 or later; Windows CE: not supported; header file: winuser. h; library file: user32.lib.
========================================================== ========================================
Iswindowvisible
Function: This function obtains the visible state of a given window .;
Function prototype: bool iswindowvisible (hwnd );
Parameters;
Hwnd: handle of the tested window.
Return Value: if the specified window and its parent window have the ws_visible style, the return value is non-zero. If the specified window and its parent window do not have the ws_visible style, the return value is zero. The return value indicates whether the window has the ws_visible style. Therefore, the return value of the function is non-zero even if the window is overwritten by other windows.
Note: The visible status of the window is indicated by the ws_visible bit. When the ws_visible bit is set, the window can be displayed. As long as the window has the ws_visible style, any information drawn in the window will be displayed.
Quick query: Windows NT: 3.1 or later; windows: 95 or later; Windows CE: 1.0 or later; header file: winuser. h; library file: user32.lib.
========================================================== ========================================
Iszoomed
Function: determines whether the window is maximized.
Function prototype: bool iszoomed (hwnd );
Parameters:
Hwnd: handle of the tested window.
Return Value: if the window is maximized, the return value is non-zero. If the window is not maximized, the return value is zero.
Quick query: Windows NT: 3.1 or later; windows: 95 or later; Windows CE: not supported; header file: winuer. h; library file: user32.iib.
========================================================== ========================================
Movewindow
Function: This function changes the position and size of a specified window. For the top-level window, the position and size are relative to the upper-left corner of the screen: For the child window, the position and size are relative to the upper-left corner coordinate of the parent window customer area.
Function prototype: bool movewindow (hwnd hwnd.int x.int y, int nwidth, int nheight, bool brepaint );
Parameters:
Hwnd: Window handle.
X: Specifies the left boundary of the new position of the window.
Y: Specifies the top boundary of the new position of the window.
Nwidth: Specify the new width of the window.
Nhaight: Specifies the new height of the window.
Brepaint: determines whether the window is refreshed. If this parameter is set to true, the window receives a wm_paint message. If this parameter is set to false, no refresh action is performed. It is applicable to the customer area, non-customer area (including the title bar and scroll bar), and the parent window area exposed by moving the Child Window. If the parameter is false, the application must explicitly invalidate the window or redraw the window and the parent window to be refreshed.
Return Value: If the function succeeds, the return value is non-zero. If the function fails, the return value is zero. To obtain more error information, call the getlasterror function.
NOTE: If brepaint is true, the system immediately sends the wm_paint message to the window process after the window is moved (that is, the movewindow function calls the updatewindow function ). If brepaint is set to false, the system places the wm_paint message in the message queue of the window. A message cycle sends a wm_paint message only when other messages in the message queue are sent.
Movewindow sends wm_wfnowposchanging, wm_windowposchanged, wm_move, wm_size, and wm_nccalcsize messages to the window,
Quick query: Windows NT: 3.1 or later: Windows: 95 or later; Windows CE: 1.0 or later: header file: winuser. h; library file: user32.lib.
========================================================== ========================================
Openlcon
Function: Restores a minimum window to its original position and size and activates the window.
Function prototype: bool openlcon (hwndhwnd );
Parameters:
Hwnd: the handle of the restored and activated window.
Return Value: If the function succeeds, the return value is non-zero. If the function fails, the return value is zero. To obtain more error information, call the getlasterror function.
Note: openlcon sends the wm_queryopen message to the given window.
Quick query: Windows NT: 3.1 or later; windows: 95 or later; Windows CE: not supported: header file: winuser. h; library file: user32.lib.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.