If you want to prevent the user to move a window you have to hide the caption. This is done by changing the window attributes in the FormCreate event. Its also possible to set the property BorderStyle to ‘bsNone’, but than the window has no frame at all.
procedure TForm1.FormCreate(Sender: TObject);
begin
SetWindowLong(Handle, GWL_STYLE, GetWindowLong(Handle,GWL_STYLE) AND
NOT WS_CAPTION);
ClientHeight := Height;
Refresh;
end;
This code is disableing the flag WS_CAPTION in the window attributes.
The SetWindowLong function changes an attribute of the specified window. The function also sets a 32-bit (long) value at the specified offset into the extra window memory of a window.
LONG SetWindowLong(
HWND hWnd, // handle of window
int nIndex, // offset of value to set
LONG dwNewLong // new value
);
|