簡體   English   中英

為什么不能在Python中運行DestroyWindow函數

[英]Why can't run DestroyWindow function in Python

我編寫了一個程序,該程序可以打開特定文件(即Flash文件),將其放置在特定位置並關閉(而不是最小化但退出)。

第一個第二個目標可以通過os.startfile('file.swf')確定,通過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
"""

錯誤5是ERROR_ACCESS_DENIED DestroyWindow()只能由創建窗口的線程調用。 而是發布或發送WM_DESTROY消息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM