View Single Post
 
Old 03-01-2017, 10:26 AM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 255
Default Make a customized form visible on screen

I made a customized form with out a title area

procedure THeadlessForm.CreateParams(var Params: TCreateParams);
begin
Params.Style := Params.Style or WS_THICKFRAME;
end;

Now I want to display it on the screen with a StringGrid

procedure TForm1.FormCreate(Sender: TObject);
begin
HeadlessForm := THeadlessForm.Create(nil); // not linked to application
Grid := TStringGrid.Create(HeadlessForm);
Grid.Parent := HeadlessForm;
HeadlessForm.ActiveControl := Grid;
HeadlessForm.Visible := True;
SetWindowPos(HeadlessForm.Handle, Form1.Handle, Form1.Top -5, Form1.Left -5,
Form1.Width -5, Form1.Height -5, HWND_TOPMOST);
BringWindowToTop(HeadlessForm.Handle);
SetForegroundWindow(HeadlessForm.Handle);
B := IsWindowVisible(HeadlessForm.Handle);
Form1.Visible := b; // main form stays visible but no HeadlessForm
end;

what am I doing wrong? as I cannot get it to display the HeadlessForm
Reply With Quote