在 Delphi 2009 应用程序中隐藏主窗体 [英] Hide the Main Form in a Delphi 2009 Application

查看:25
本文介绍了在 Delphi 2009 应用程序中隐藏主窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码在 Delphi 7 中工作正常.但是,在 Delphi 2009 中,表单确实保持隐藏状态,但任务栏上的按钮现在出现了.

The following code works fine in Delphi 7. However, in Delphi 2009 the form does remain hidden but the button on the taskbar is now appearing.

ShowWindow(Handle, SW_HIDE);
SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW );
ShowWindow(Handle, SW_SHOW);

上面的代码是在FormCreate方法中调用的.

The above code is called in the FormCreate method.

推荐答案

原来我们在任务栏上看到应用程序窗口的原因是一个简单的设置,类似于 stukelly 的回答,但不完全相同.

Turns out the reason we were seeing the Application window on the taskbar was a simple setting similar to stukelly's answer but not quite.

要使主窗体出现在任务栏上并隐藏您应用的应用程序菜单:

To get the main form to appear on the task bar and hide the application menu you apply:

Application.MainFormOnTaskbar := True;
Application.ShowMainForm := False;

表单创建背后没有代码或任何需要的东西.

No code behind the form create or anything required.

这篇关于在 Delphi 2009 应用程序中隐藏主窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆