【发布时间】:2013-12-04 03:32:09
【问题描述】:
我编写了一个程序,可以打开特定文件,即 Flash 文件,将其定位到特定位置并关闭它(不是最小化而是退出)。
第一个第二个目标通过os.startfile('file.swf') ok,通过win32gui.FindWindow(None, file.swf)找到它的hwnd,通过win32gui.MoveWindow(hwnd,0,0,800,600,True)定位),但是 win32gui.DestroyWindow(hwnd) 不能工作,我不知道为什么。
下面是错误信息:
Traceback (most recent call last):
File "<pyshell#30>", line 1, in <module>
win32gui.DestroyWindow(hwnd1)
error: (5, 'DestroyWindow', '\xa6s\xa8\xfa\xb3Q\xa9\xda\xa1C')
它有什么问题?如何解决?
编辑:
我的代码是:
import win32gui
import os
"""
monitoring a folder which will be updated per one miniute
if the temperature changed the program will open a particular file to display
"""
FLASH_PATH="santa"
PIC_PATH=""
TEMP_PATH="Temperatures/"
file_name="led_20.swf"
filePath=os.path.join(FLASH_PATH,file_name)
os.startfile(filePath)
hwnd=win32gui.FindWindow(None,file_name)
win32gui.MoveWindow(hwnd,0,0,800,600,True)
"""
display it for a few minute and close it
"""
【问题讨论】:
-
你能显示一些关于你在做什么的代码吗?