unit RuAnimate;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.ComCtrls,
Vcl.ShellAnimations,
Vcl.ExtCtrls;
type
TFrmRuAnimate =
class(TForm)
ShellResources1: TShellResources;
Panel1: TPanel;
Animate1: TAnimate;
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
procedure RuAnimate_Open(ACaption:
string);
function RuAnimate_Update(ACaption:
string): boolean;
procedure RuAnimate_Close;
implementation
{$R *.dfm}
procedure SwitchToThisWindow(h1: hWnd; x: bool);
stdcall;
external user32
Name '
SwitchToThisWindow';
procedure RuAnimate_Open(ACaption:
string);
begin
if not RuAnimate_Update(ACaption)
then with TFrmRuAnimate.Create(Application)
do begin
Caption := ACaption;
Show;
end;
Application.ProcessMessages;
end;
function RuAnimate_Update(ACaption:
string): boolean;
var
HandleFrmRuAnimate: THandle;
begin
HandleFrmRuAnimate := FindWindow(PChar('
TFrmRuAnimate'),
nil);
Result := HandleFrmRuAnimate > 0;
if Result
then begin
if IsIconic(HandleFrmRuAnimate)
then SendMessage(HandleFrmRuAnimate, WM_SYSCOMMAND, SC_RESTORE, 0 );
SwitchToThisWindow(HandleFrmRuAnimate, TRUE);
SetForegroundWindow(HandleFrmRuAnimate);
SendMessage (HandleFrmRuAnimate, WM_SETTEXT, 255, Integer(PChar(ACaption)));
end;
Application.ProcessMessages;
end;
procedure RuAnimate_Close;
var
HandleFrmRuAnimate: THandle;
begin
HandleFrmRuAnimate := FindWindow(PChar('
TFrmRuAnimate'),
nil);
if HandleFrmRuAnimate > 0
then SendMessage (HandleFrmRuAnimate, WM_CLOSE,0,0);
Application.ProcessMessages;
end;
procedure TFrmRuAnimate.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action := caFree;
end;
end.