Movie #6 - Hiding the form Caption

Movie

Here we have a look at one technique for hiding the caption for a form.  I've fixed the sound quality for this one and have some branding - one day I may even look professional.

Click Here to watch on YouTube.

Here is the code that I'm using to show and hide the caption

procedure TForm1.HideCaption;
var
OldStyle : integer;
begin
OldStyle := GetWindowLong(Handle, GWL_STYLE);
if (OldStyle and WS_CAPTION) = WS_CAPTION then
begin
LockWindowUpdate(handle);
SetWindowLong(Handle, GWL_STYLE, OldStyle and not WS_CAPTION);
Height := Height - getSystemMetrics(SM_CYCAPTION) - 2 * getSystemMetrics(SM_CYBORDER);
Width := Width - 2 * getSystemMetrics(SM_CXBORDER);
Top := Top + getSystemMetrics(SM_CYCAPTION) + getSystemMetrics(SM_CYBORDER);
Left := Left + getSystemMetrics(SM_CXBORDER);
LockWindowUpdate(0);
end;
end;

procedure TForm1.ShowCaption;
var
OldStyle : integer;
begin
OldStyle := GetWindowLong(Handle, GWL_STYLE);
if (OldStyle and WS_CAPTION) <> WS_CAPTION then
begin
LockWindowUpdate(Handle);
SetWindowLong(Handle, GWL_STYLE, OldStyle or WS_CAPTION);
Height := Height + GetSystemMetrics(SM_CYCAPTION) + 2 * GetSystemMetrics(SM_CYBORDER);
Width := Width + 2 * GetSystemMetrics(SM_CXBORDER);
Top := Top - getSystemMetrics(SM_CYCAPTION) - GetSystemMetrics(SM_CYBORDER);
Left := Left - getSystemMetrics(SM_CXBORDER);
LockWindowUpdate(0);
end;
end;