Главная страница | назад





Article #15924: How can I prevent the user from moving or sizing my form?

 Question and Answer Database
FAQ924D.txt How can I prevent the user from moving or sizing my form?
Category :Object Pascal
Platform :All
Product :All 32 bit
Question:
How can I prevent the user from moving or sizing my form?
Answer:
Trap the Windows WM_WINDOWPOSCHANGING message and "or" the flags of
the WindowPos structure passed in the message's lparam parameter with
the predefined constants SWP_NOMOVE and SWP_NOSIZE.
Example:
type
TForm1 = class(TForm)
private
{ Private declarations }
procedure WMPosChange(var Message: TWMWINDOWPOSCHANGING);
message WM_WINDOWPOSCHANGING;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure Tform1.WMPosChange(var Message: TWMWINDOWPOSCHANGING);
begin
PWindowPos(TMessage(Message).lParam).Flags :=
PWindowPos(TMessage(Message).lParam).Flags or
SWP_NOMOVE or
SWP_NOSIZE;
end;
7/16/98 4:31:28 PM

Last Modified: 01-SEP-99