type
TPanelEx =
class(TPanel)
public
constructor Create(AOwner: TComponent);
override;
procedure CreateParams(
var Params: TCreateParams);
override;
end;
{ TPanelEx }
constructor TPanelEx.Create(AOwner: TComponent);
begin
inherited;
SetWindowLong(
handle, GWL_EXSTYLE,GetWindowLong(
handle, GWL_EXSTYLE)
or WS_EX_NOACTIVATE);
SetWindowPos(
Handle, HWND_NOTOPMOST + WORD(true), 0, 0, 0, 0, SWP_NOMOVE
or SWP_NOSIZE
or SWP_NOACTIVATE);
end;
procedure TPanelEx.CreateParams(
var Params: TCreateParams);
begin
inherited;
with Params
do
begin
Style := WS_POPUP
or WS_BORDER;
WindowClass.Style := WindowClass.Style
or CS_SAVEBITS;
if NewStyleControls
then
ExStyle := WS_EX_TOOLWINDOW;
if NewStyleControls
then ExStyle := WS_EX_TOOLWINDOW;
AddBiDiModeExStyle(ExStyle);
ParentWindow := GetDesktopWindow;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Panel: TPanelEx;
begin
Panel := TPanelEx.Create(
nil);
ShowWindow(Panel.Handle, SW_SHOW);
end;