开发者

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.Hi开发者_如何转开发de; 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.


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.


Try settings the state of the form to fsAlwaysOnTop.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜