2013/10/5 silvioprog
Show quoted text 23 lines
uses
unit2;
procedure TForm1.Button1Click(Sender: TObject);
begin
Form2 := TForm2.Create(Self);
Form2.ShowModal;
Form2.Free;
end;
---
uses
Windows;
procedure TForm2.FormShow(Sender: TObject);
begin
SetWindowLong(Handle, GWL_STYLE,
GetWindowLong(Handle, GWL_STYLE) and (not WS_CAPTION));
SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0,
SWP_DRAWFRAME or SWP_NOMOVE or SWP_NOSIZE);
end;
In mainform:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Windows, Forms;
type
{ TForm1 }
TForm1 = class(TForm)
procedure FormShow(Sender: TObject);
private
procedure WMNCHitTest(var Msg: TMessage); message WM_NCHITTEST;
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
procedure TForm1.FormShow(Sender: TObject);
begin
SetWindowLong(Handle, GWL_STYLE, WS_OVERLAPPEDWINDOW and (not
WS_CAPTION));
SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_DRAWFRAME or
SWP_NOMOVE or SWP_NOSIZE);
end;
procedure TForm1.WMNCHitTest(var Msg: TMessage);
begin
inherited;
case Msg.Result of
HTTOP: Msg.Result := HTCLIENT;
HTTOPLEFT: Msg.Result := HTCLIENT;
HTTOPRIGHT: Msg.Result := HTCLIENT;
HTBOTTOM: Msg.Result := HTCLIENT;
HTBOTTOMLEFT: Msg.Result := HTCLIENT;
HTBOTTOMRIGHT: Msg.Result := HTCLIENT;
HTLEFT: Msg.Result := HTCLIENT;
HTRIGHT: Msg.Result := HTCLIENT;
end;
end;
end.