I want to create a window that will be the main window and that Windows itself recognizes as a main application window. However, when I make my window borderless, and witho
The following gets the job done:
hWnd = CreateWindow(...);
SetWindowLong(hWnd, GWL_STYLE, WS_POPUP | WS_MINIMIZEBOX);
SetWindowLong(hWnd, GWL_EXSTYLE, 0);
ShowWindow(hWnd, ...);
You were probably missing WS_MINIMIZEBOX
.
A bit icky, but you can set the window region by putting this in YourForm.OnShow event:
var
r: TRect;
begin
r := ClientRect;
OffsetRect(r, 0, GetSystemMetrics(SM_CYCAPTION));
OffsetRect(r, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME));
SetWindowRgn(Handle,
CreateRectRgn(
r.Left, r.Top,
ClientWidth + r.Left, ClientHeight + r.Top), True);
You need to override TForm.CreateParams and set or remove any style that you are interest in
procedure TYourForm.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.Style := Params.Style and
Params.ExStyle := Params.ExStyle or ;
end;