was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

34 Visitors Online


 
...ein Fenster mehrere Male blinken lasssen?
Autor: Thai Huynh
[ Tip ausdrucken ]  

Tip Bewertung (10):  
     


// Define FLASHWINFO structure as record type
type
  
FLASHWINFO = record
    
cbSize: UINT;
    hWnd: HWND;
    dwFlags: DWORD;
    uCount: UINT;
    dwTimeOut: DWORD;
  end;
  TFlashWInfo = FLASHWINFO;

  // Define dwFlags constants
const
  
FLASHW_STOP = 0;
  FLASHW_CAPTION = 1;
  FLASHW_TRAY = 2;
  FLASHW_ALL = FLASHW_CAPTION or FLASHW_TRAY;
  FLASHW_TIMER = 4;
  FLASHW_TIMERNOFG = 12;

var
  
Form1: TForm1;
  FWInfo: TFlashWInfo;

  // 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;


 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners