如何将WindowState从桌面快捷方式传递到WPF应用程序? [英] How to pass WindowState from desktop shortcut into WPF app?

查看:107
本文介绍了如何将WindowState从桌面快捷方式传递到WPF应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过桌面快捷方式控制WPF主窗口的初始WindowState(正常,最小化,最大化)?

How can I control the initial WindowState (Normal, Minimized, Maximized) of a WPF main window from a desktop shortcut?

快捷方式属性对话框的运行:"组合框让我在常规窗口",最小化"和最大化"之间进行选择.但是WPF应用似乎完全忽略了此选项.使用WinForms可以自动支持此功能,而无需其他代码.

The "Run:" combobox of the shortcut's properties dialog let's me choose between "Normal window", "Minimized" and "Maximized". But this option seems to be completely ignored by WPF apps. With WinForms this was automatically supported with no additional code.

是否有一种方法可以从已启动的WPF流程中访问此选项?我知道我可以在启动新进程时指定ProcessStartInfo.WindowStyle属性.但是如何从正在启动的进程中访问此选项?

Is there a way to access this option from the launched WPF process? I know I can specify the ProcessStartInfo.WindowStyle property when launching new processes. But how can I access this option from the process being launched?

推荐答案

System.Diagnostics.Process.GetCurrentProcess().StartInfo.WindowStyle

这篇关于如何将WindowState从桌面快捷方式传递到WPF应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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