有什么方法可以检测然后覆盖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.
更多推荐
以最小化的应用程序启动程序
发布评论