functions.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:grid 作者: russelg 项目源码 文件源码
def get_actual_rect(hwnd):
    """Gets correct dimensions of a DWM controlled window

    "Retrieves the extended frame bounds rectangle in screen space".
    Windows 10 reports (technically) incorrect window dimensions,
    so this is used to obtain the correct window dimensions.

    Args:
        hwnd: The handle to the window from which the attribute data is retrieved.

    Returns:
        A windows RECT structure of the correct window dimensions.
    """
    rect = RECT()
    DWMWA_EXTENDED_FRAME_BOUNDS = 9
    dwmapi.DwmGetWindowAttribute(HWND(hwnd),
                                 DWORD(DWMWA_EXTENDED_FRAME_BOUNDS),
                                 ctypes.byref(rect),
                                 ctypes.sizeof(rect))
    # actual_x1 = rect.left
    # actual_y1 = rect.top
    # actual_x2 = rect.right
    # actual_y2 = rect.bottom
    # return [actual_x1, actual_y1, actual_x2, actual_y2]
    return rect
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号