// Define FLASHWINFO structure as record type type FLASHWINFO = record cbSize: UINT;
hWnd: HWND;
dwFlags: DWORD;
uCount: UINT;
dwTimeOut: DWORD; end;
TFlashWInfo = FLASHWINFO;
// Function declaration for WinAPI call function FlashWindowEx(var pfwi: FLASHWINFO): BOOL; stdcall;
{...}
implementation
{...}
// Import external function from 'USER32.DLL' with the same name function FlashWindowEx; external user32 Name 'FlashWindowEx';
procedure TForm1.FormCreate(Sender: TObject); begin // Check for API function's availability if not Assigned(@FlashWindowEx) then
begin ShowMessage('API Function FlashWindowEx is not present... Exit program!');
Application.Terminate; end
else // Set default parameters with FWInfo do
begin cbSize := SizeOf(FWInfo); // Size of structure in bytes hWnd := Form1.Handle; // Main's form handle dwFlags := FLASHW_ALL; // Flash both caption & task bar uCount := 10; // Flash 10 times dwTimeOut := 100; // Timeout is 1/10 second apart end; end;
procedure TForm1.Button1Click(Sender: TObject); begin // Flash on normal state FlashWindowEx(FWInfo); end;
procedure TForm1.Button2Click(Sender: TObject); begin // Flash on minimized state WindowState := wsMinimized; // Application.Minimize; FlashWindowEx(FWInfo); end;