Skip to content

Latest commit

 

History

History
62 lines (42 loc) · 1.61 KB

sample_228.md

File metadata and controls

62 lines (42 loc) · 1.61 KB

Home

How to make the caption of a VFP application flashing in the Windows task bar

Before you begin:

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:


Code:

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  

Listed functions:

FlashWindow
GetActiveWindow
Sleep

Comment:

The FlashWindowEx provides more options. it is not supported by earlier Windows versions.