G'day,
At his link http://docs.activestate.com/activepython/2.7/pywin32/win32gui__FlashWindowEx_meth.html there is the documentation for win32gui.FlashWindowEx(), which I have managed to get working with

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

but all that happens in the Windows 7 taskbar is the icon gets the golden background, not flashing, so my question is, does anyone know about the win32con.FLASHW_* flags the documentation makes mention of, perhaps a link to more info about them?
Cheers

有帮助吗?

解决方案

There's more information on the Visual Basic version of the FlashWindowEx function available on Microsoft's support side at "How to use FlashWindowEx to Notify a User from Visual Basic".

That page includes a list of the FLASHW_* flags.

其他提示

refer: 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)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top