Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent main form from appearing when showing another form

I am trying to bring my secondary form to the Foreground, however when I do

MyForm.Show; // It may be hidden, therefore show it first
SetForegroundWindow(MyForm.Handle);

my Main Form appears aswell. The only way I can prevent that is to do MainForm.Hide; but I got to avoid that.

The idea is to have my secondary form appear on top of another application, without my Main Form having to do so as well.

like image 267
Jeff Avatar asked Dec 19 '25 21:12

Jeff


1 Answers

If you consider to make another application for this functionality, then you may also consider the following compromise: minimize the MainForm to the taskbar (rather than hiding it) to prevent it popping up when activating another form.

If so, then try this answer. It does add an extra icon to your taskbar for the secondary form, but I guess that'll be no problem since a different application would either. However, if the MainForm is nót minimized but obfuscated by other windows, activating the secondary form wíll also popup the MainForm, just like you are experiencing now.

And for the completeness of this answer's sake, but not by any means meant as advice: this answer describes a (somewhat experimental) construction to make fully independent windows. The little time I tested that solution, it seemed to work, but be prepared not counting any longer on the full/default functionality of the VCL.

like image 84
NGLN Avatar answered Dec 22 '25 13:12

NGLN



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!