Mega Code Archive

 
Categories / Delphi / Forms
 

Hide the window caption

Title: Hide the window caption Question: How to hide the caption of a window with the API function SetWindowLong Answer: If you want to prevent the user to move a window you have to hide the caption. This is done by changeing 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.