2011-11-28 53 views
1

天兒真好,
在他的鏈接http://docs.activestate.com/activepython/2.7/pywin32/win32gui__FlashWindowEx_meth.html有用於win32gui.FlashWindowEx(),這是我所管理的文檔,以獲取有關的Python - win32con.FLASHW_ *標誌

import win32gui as w 
a = w.GetForegroundWindow() #just get the handler/ID for the current window 
w.FlashWindowEx(a,0,5,1000) #many variations of the 5,1000 have been tried 

工作,但所有的事在Windows 7的任務欄是圖標獲取金色背景,而不是閃爍,所以我的問題是,有沒有人知道win32con.FLASHW_ *標誌的文件提及,也許是關於它們的更多信息的鏈接?
Cheers

回答

1

參考:http://guangboo.org/2013/05/14/wxpython-flashwindow-using-win32api

from ctypes import * 
import win32con 
import win32gui as w 
cur_window = w.GetForegroundWindow() #just get the handler/ID for the current window 

class FLASHWINFO(Structure): 
     _fields_ = [('cbSize', c_uint), 
       ('hwnd', c_uint), 
       ('dwFlags', c_uint), 
       ('uCount', c_uint), 
       ('dwTimeout', c_uint)] 

def flash(hwnd): 
     '''Flash a window with caption and tray.''' 
     info = FLASHWINFO(0, hwnd, win32con.FLASHW_ALL | win32con.FLASHW_TIMERNOFG, 0, 0) 
     info.cbSize = sizeof(info) 
     FlashWindowEx(byref(info)) 

flash(cur_window)