SirThornberry hat Recht, in der
VCL machen die wirklich so etwas (der Code ist jetzt nicht unbedingt Copyrightgefährdet, also poste ich ihn einfach mal):
Delphi-Quellcode:
function GetAnimation: Boolean;
var
Info: TAnimationInfo;
begin
Info.cbSize := SizeOf(TAnimationInfo);
if SystemParametersInfo(SPI_GETANIMATION, SizeOf(Info), @Info, 0) then
Result := Info.iMinAnimate <> 0 else
Result := False;
end;
procedure SetAnimation(Value: Boolean);
var
Info: TAnimationInfo;
begin
Info.cbSize := SizeOf(TAnimationInfo);
BOOL(Info.iMinAnimate) := Value;
SystemParametersInfo(SPI_SETANIMATION, SizeOf(Info), @Info, 0);
end;
procedure CreateFormNoAnimate(Class: TComponentClass; var Reference);
var
Animation: Boolean;
Instance: TComponent;
begin
Animation := GetAnimation;
try
if Animation then
SetAnimation(False);
Instance := TComponent(InstanceClass.NewInstance);
TComponent(Reference) := Instance;
try
Instance.Create(Application);
except
TComponent(Reference) := nil;
raise;
end;
finally
if Animation then
SetAnimation(True);
end;
end;
... oder ohne Erzeugen halt so:
Delphi-Quellcode:
procedure WindowStateNoAnimate(Form: TCustomForm; State: TWindowState);
var
Animation: Boolean;
begin
Animation := GetAnimation;
try
if Animation then
SetAnimation(False);
Form.WindowState := State;
finally
if Animation then
SetAnimation(True);
end;
end;