为什么不能在Python中运行DestroyWindow函数

为什么不能在Python中运行DestroyWindow函数,python,win32gui,Python,Win32gui,我编写了一个程序,可以打开一个特定的文件,即Flash文件,将其定位在特定的位置,然后关闭它,而不是最小化,而是退出 第一个第二个目标通过os.startfile'file.swf'可以,通过win32gui.FindWindowNone,file.swf找到它的hwnd,并通过win32gui.MoveWindowhwnd定位它。0,0800600,True,但是,win32gui.DestroyWindowhwnd不能工作,我不知道为什么 以下是错误消息: Traceback (most r

我编写了一个程序,可以打开一个特定的文件,即Flash文件,将其定位在特定的位置,然后关闭它,而不是最小化,而是退出

第一个第二个目标通过os.startfile'file.swf'可以,通过win32gui.FindWindowNone,file.swf找到它的hwnd,并通过win32gui.MoveWindowhwnd定位它。0,0800600,True,但是,win32gui.DestroyWindowhwnd不能工作,我不知道为什么

以下是错误消息:

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')

错误5是错误的。只能由创建窗口的线程调用。发布或发送消息。

您能展示一些您正在做的事情的代码吗?
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
"""