This code sample shows how to turn user to the monitor`s screen by flashing the icon of an application in the Windows taskbar. There are several other ways of alerting the user using various visual effects:
- Flashing caption of a VFP application in the Windows task bar using FlashWindowEx
- Shaking VFP form controls
- Placing On-screen Alert on top of all windows
DO decl
LOCAL hWindow
hWindow = GetActiveWindow()
* minimizing the main VFP window
_SCREEN.WindowState = 1
* making the window flashing on the Windows taskbar
* while staying minimized
DO WHILE _SCREEN.WindowState = 1
* setting to the flashed state
= FlashWindow (hWindow, 1)
= Sleep (500) && keep for a moment
* setting to the original state
= FlashWindow (hWindow, 0)
= Sleep (500) && keep for a moment
ENDDO
* clearing the flashing state
* when the WindowState returned to normal
= FlashWindow (hWindow, 0)
PROCEDURE decl
DECLARE Sleep IN kernel32 INTEGER dwMilliseconds
DECLARE INTEGER GetActiveWindow IN user32
DECLARE INTEGER FlashWindow IN user32;
INTEGER hWnd, INTEGER bInvert FlashWindow
GetActiveWindow
Sleep
The FlashWindowEx provides more options. it is not supported by earlier Windows versions.
Home