以最小化的应用程序启动程序

编程入门 行业动态 更新时间:2024-10-24 22:22:06
本文介绍了以最小化的应用程序启动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有什么方法可以检测然后覆盖Windows快捷方式参数运行最小化? 我想检测快捷方式是否要最小化启动程序,然后稍后再处理最小化/最大化/正常调整大小。

Is there any way to detect then override the Windows Shortcut param run Minimized? I want to detect if the shortcut is wanting to start the program minimized then handle the Minimize/maximize/normal sizing myself later.

我有一个启动画面我使用

I have a splash screen that I create using

Form_Splash := TForm_Splash.Create(Application);

我稍后会使用

Application.CreateForm(TForm_main, Form_main);

在显示主表单后,我销毁了form_Splash,当时我想最小化/最大化/正常大小,取决于Windows快捷方式的要求。

after the main form is displayed I destroy the form_Splash and at that time I want to minimize/maximize/normal size the form_main based on what the windows shortcut requested.

感谢您的帮助。 史蒂夫...

Thanks for any help. Steve...

推荐答案

您可以使用 GetStartupInfo API调用以获取 STARTUPINFO 传递给创建时的过程(在Delphi中为 TStartupInfo )。 wShowWindow 成员包含所需的初始显示状态。

You can use the GetStartupInfo API call to get the STARTUPINFO passed to your process on creation (TStartupInfo in Delphi). The wShowWindow member contains the desired initial show state.

总要知道的是:

对于GUI进程,首次调用ShowWindow时,将忽略其nCmdShow 参数wShowWindow指定默认值。在随后的对ShowWindow的调用中,如果ShowWindow的 nCmdShow参数设置为SW_SHOWDEFAULT,则使用wShowWindow成员。

For GUI processes, the first time ShowWindow is called, its nCmdShow parameter is ignored wShowWindow specifies the default value. In subsequent calls to ShowWindow, the wShowWindow member is used if the nCmdShow parameter of ShowWindow is set to SW_SHOWDEFAULT.

因此对于任何窗口 ShowWindow ,将使用启动信息记录中指定的值。这可能会影响您的启动屏幕。

So for whatever window ShowWindow is first called, the value specified in the startup info record will be used. This could affect your splash screen.

但是在任何情况下,您都可以使用 STARTUPINFO 中的值

But in any case - you can use the value from the STARTUPINFO to have your main form acting accordingly.

我个人讨厌当我希望启动它最小化时向我显示启动屏幕的应用程序。通常这些应用程序还会窃取我的输入焦点,这使我发疯。

Personally I would hate the application showing me the splash screen when I want it to start minimized. Usually these applications also steal my input focus which drives me mad.

更多推荐

以最小化的应用程序启动程序

本文发布于:2023-11-04 05:22:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1557058.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:最小化   应用程序   程序

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!