Mega Code Archive

 
Categories / Delphi / VCL
 

Showing two forms allowing the first to retain focus

Question: Is it possible to show a form, but allow the form showing before it to remain focused, and still positioned behind the newly shown form? Answer: The follow code demonstrates showing a non auto-created form without changing the focus of the original form. uses Unit2; procedure TForm1.Button1Click(Sender: TObject); begin Form2 := TForm2.Create(Application); Form2.Visible := FALSE; ShowWindow(Form2.Handle, SW_SHOWNA); end;