这个问题我已回答过我次,好像应该这样做:
Public
procedure Createparams(Var Params:TCreateParams);override;
...
procedure TFormDrop.Createparams(var Params:TCreateParams);
begin
Inherited CreateParams(Params);
With Params do
begin
EXStyle:=ExStyle or WS_EX_TOPMOST OR WS_EX_ACCEPTFILES or WS_DLGFRAME
wndParnet:=GetDesktopWindow; //关键一行,用SetParent都不行!!
end;
end;
procedure SetFormOnTop ( Form : TForm ; const bFlag : Boolean );
begin
if bFlag then
SetWindowPos ( Form . handle , HWND_TOPMOST , 0 , 0 , 0 , 0 , swp_nomove or swp_nosize )
else
SetWindowPos ( Form . handle , HWND_NOTOPMOST , 0 , 0 , 0 , 0 , swp_nomove or swp_nosize );
end ;