Flash Application window or/and Taskbar button
Sometimes it's necessary to attract a user attention to an application that is currently not active. Such application can utilize FlashWindowEx Function. The Windows API support class
is used to handle Windows API structures.
$SAMPLECODE$
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 #DEFINE FLASHW_STOP 0 && Stop flashing. The system restores the window to its original state. #DEFINE FLASHW_CAPTION 1 && Flash the window caption. #DEFINE FLASHW_TRAY 2 && Flash the taskbar button. #DEFINE FLASHW_ALL FLASHW_CAPTION + FLASHW_TRAY && Flash both #DEFINE FLASHW_TIMER 4 && Flash continuously, until the FLASHW_STOP flag is set. #DEFINE FLASHW_TIMERNOFG 12 && Flash continuously until the window comes to the foreground. * Flash the window caption and the taskbar button 3 times with default timeout *= FlashAppWindow(_VFP.HWnd, FLASHW_ALL, 3, 0) * Flash the window caption and the taskbar button 4 times with 300ms interval *= FlashAppWindow(_VFP.HWnd, FLASHW_ALL, 3, 300) * Flash the window caption for 5 secons and than stop *= FlashAppWindow(_VFP.HWnd, FLASHW_CAPTION + FLASHW_TIMER , 0, 0) *= INKEY(5) *= FlashAppWindow(_VFP.HWnd, FLASHW_STOP , 0, 0) _SCREEN.WINDOWSTATE = 1 * Flash the taskbar button until the window comes to the foreground = FlashAppWindow(_VFP.HWnd, FLASHW_TRAY + FLASHW_TIMERNOFG, 0, 0) RETURN FUNCTION FlashAppWindow(thWnd, tnFlags, tnFlashCount, tnTimeout) LOCAL loWas, lcPwfi loWas = NEWOBJECT ( "WinApiSupport" , "WinApiSupport.fxp" ) WITH loWas lcPwfi = .Num2Long(20) + .Num2Long(thWnd) + .Num2Long(tnFlags) + ; .Num2Long(tnFlashCount) + .Num2Long(tnTimeout) ENDWITH = FlashWindowEx(lcPwfi) RETURN ENDFUNC FUNCTION FlashWindowEx(tcPfwi) DECLARE Short FlashWindowEx IN WIN32API String pfwi RETURN FlashWindowEx(tcPfwi)
Comments