0
$\begingroup$

Hello so i was wandering for my addon https://blenderartists.org/t/floating-windows-the-missing-feature-of-blender-2-8/1163493 how to resize, move, and modify the always on top status of the active window.

this is how.

$\endgroup$
0
$\begingroup$
import ctypes
from ctypes import wintypes

#Get Active  #https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getactivewindow
#Set win     #https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setwindowpos

#SetWindowPos FUNCTION
SetWindowPos = ctypes.windll.user32.SetWindowPos
SetWindowPos.restype = wintypes.BOOL
SetWindowPos.argtypes = [
    wintypes.HWND, #hWnd
    wintypes.HWND, #hWndInsertAfter
    ctypes.c_int,  #X #pos
    ctypes.c_int,  #Y #pos
    ctypes.c_int,  #cx #new width
    ctypes.c_int,  #cy #new height
    ctypes.c_uint, #uFlags
]
#HANDLE
Active_W = ctypes.windll.user32.GetActiveWindow()

#FLAGS
SWP_HIDEWINDOW = 0x80 #HIDE 
SWP_SHOWWINDOW = 0x40 #SHOW
SWP_NOMOVE     = 0x0002 #NO MOVE
SWP_NOSIZE     = 0x0001 #NO SIZE


#EXAMPLE ON TOP -> because -> -1
#SetWindowPos(Active_W, -1, 0, 0, 0, 0,SWP_NOMOVE|SWP_NOSIZE )

#EXAMPLE ON TOP CANCEL -> because -> -2
#SetWindowPos(Active_W, -2, 0, 0, 0, 0,SWP_NOMOVE|SWP_NOSIZE )

#EXEMPLE DEPLACE     
#SetWindowPos(Active_W, 0, 2550, 0, 0, 0, SWP_NOSIZE )

#EXEMPLE RESIZE #column size
#SetWindowPos(Active_W, 0, 0, 0, 100, 1000, SWP_NOMOVE)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.