Skip to content Skip to sidebar Skip to footer

Win32gui Movewindow() Not Aligned With Left Edge Of Screen

I am using win32gui to move a Notepad window to the origin of the screen (0, 0) with width and height equal to 500. The result is that the window is not moved to the true left bord

Solution 1:

Windows 10 has an invisible border of 7 pixels. (Totaling to 8 pixels if you include the visible 1 pixel window border.) It is the border for resizing windows which is on the left, right and bottom edge of the window.

Notice how the resizing cursor reacts with the top edge. There is no invisible border there.

An easy fix is to just offset the x in MoveWindow.

win32gui.MoveWindow(hwnd, -7, 0, 500, 500, True)

Or make a new function to do that:

defmove_window(hwnd, x, y, n_width, n_height, b_repaint):
    win32gui.MoveWindow(hwnd, x - 7, y, n_width, n_height, b_repaint)

Post a Comment for "Win32gui Movewindow() Not Aligned With Left Edge Of Screen"