当前位置:首页 科普知识 GetWindowRect

GetWindowRect

发布时间:2023-09-14 00:53:35

GetWindowRect是一个Windows API函数。该函数返回指定窗口的边框矩形的大小,函数原型为void GetWindowRect(LPRECT lpRect) const。

GetWindowRect介绍

GetWindowRect是一个Windows API函数。该函数返回指定窗口的边框矩形的大小,函数原型为void GetWindowRect(LPRECT lpRect) const。

GetWindowRect

GetWindowRect函数功能

该函数返回指定窗口的边框矩形的尺寸。该尺寸以相对于屏幕坐标左上角的屏幕坐标给出。

GetWindowRect函数原型

BOOL GetWindowRect(HWND hWnd,LPRECT lpRect);

在Visual Studio 2005中,函数原型为void GetWindowRect(LPRECT lpRect) const;

是属于CWnd类的函数.

GetWindowRect参数

hWnd:窗口句柄。

lpRect:指向一个RECT结构的指针,该结构接收窗口的左上角和右下角的屏幕坐标。

GetWindowRect变量

left ;top; right;bottom;

GetWindowRect

分别表示该窗口的/左侧/顶部/右侧/底部坐标

GetWindowRect返回值

如果函数成功,返回值为非零:如果函数失败,返回值为零。若想获得更多错误信息,请调用GetLastError函数。

GetWindowRect速查

Windows NT:3.1以上版本:Windows:95以上版本;Windows CE:

1.0以上版本;头文件:Windows.h;库文件:User32.lib。

GetWindowRect声明

VB.NET 声明

Public Declare Function GetWindowRect Lib "user32.dll" (ByVal hwnd As IntPtr, <MarshalAs(UnmanagedType.LPStruct)>ByRef lpRect As RECT) As <MarshalAs(UnmanagedType.I4)>Boolean

Public Structure RECT

<MarshalAs(UnmanagedType.I4)> Public left As Integer

GetWindowRect

<MarshalAs(UnmanagedType.I4)> Public top As Integer

<MarshalAs(UnmanagedType.I4)> Public right As Integer

<MarshalAs(UnmanagedType.I4)> Public bottom As Integer

End Structure

温馨提示:
本文【GetWindowRect】由作者 爱百科 转载提供。 该文观点仅代表作者本人, 自学教育网 信息发布平台,仅提供信息存储空间服务, 若存在侵权问题,请及时联系管理员或作者进行删除。
(c)2008-2025 自学教育网 All Rights Reserved 汕头市灵创科技有限公司
粤ICP备2024240640号-6