[英]How to programmatically resize process windows in Windows 10?
如果要像我一样使用Popen子过程方法,则必须删除p.wait(),因为它将在运行结束代码之前等待视频结束(它将过程放入队列而不是线程化)。
在martineau的帮助下,他提供了答案,我使用了以下内容(在为python 3.5安装pywin32之后):
import pywintypes
import win32gui
displays = [[-10,0,980,530],
[954,0,980,530],
[-10,515,980,530],
[954,515,980,530]] #these are the x1,y1,x2,y2 to corner all 4 videos on my res (1920x1080)
def enumHandler(hwnd, lParam):
if win32gui.IsWindowVisible(hwnd):
print(win32gui.GetWindowText(hwnd)) #this will print all the processes title
if name in win32gui.GetWindowText(hwnd): #it checks if the process I'm looking for is running
win32gui.MoveWindow(hwnd,i0,i1,i2,i3,True) #resizes and moves the process
win32gui.EnumWindows(enumHandler, None) #this is how to run enumHandler
x1,y1,x2,y2对于您的进程可能有所不同,但是对于vlc媒体播放器来说,它们工作得很好。 我希望我已经足够清楚了,但是如果您没有完成任务,那么您一定要检查martineau提供的答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.