Flashing your window


horizontal rule

Back Home Next

Author Aart Onkenhout
Date 28-09-2000

When a user switches to another application while your application is doing a time-consuming action, then you probably
want to notify the user that the action has ended. In Windows it's possible to let the taskbar-icon of your applcation flash.

Therefore you must declare two local external functions:

Function uLong FlashWindow( uLong hWnd, Boolean bInvert ) Library "user32.dll"
Function uLong GetForegroundWindow() Library "user32.dll"


Put the next code in the Timer-event of your MDI- or mainwindow.

FlashWindow( Handle( this ), True )

In the activate-event of your MDI:

Timer( 0 )


When resetting the timer, it's possible that taskbar icon just 'blued up', so by calling FlasWindow with    False, you make it inactive.


FlashWindow( Handle( this ), False )


Add also a function to your MDI- or Main-Window and call it (e.g.) of_IsActive()


public function Boolean of_IsActive()

Return ( Handle( this ) = GetForegroundWindow() )

Put code in the RetrieveEnd-event of your datawindow to start timer-event, so:

If Not w_Frame.of_IsActive() Then w_frame.Timer( 0.5 )