Hide the window caption

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
);

This entry was posted in Forms. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please copy the string BTIbvv to the field below: