我注意到,如果CreateNoWindow = FALSE确实当文件名指向一个Windows可执行文件,如果你有机会到winform应用程序的源代码,绝对没有,那么你或许可以提供一个命令
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form1 form1 = new Form1();
form1.Load += new EventHandler((s,o) =>
{
//check if the form should be shown based on command line arg
if (args.Contains("dontShowWindow"))
{
//hide it
form1.ShowInTaskbar = false;
form1.Visible = form1.ShowInTaskbar = false;
}
}
);
Application.Run(form1);
}
在你调用代码,您现在可以指定“dontShowWindow”作为一个过程参数:
控制形式的默认知名度,做这样的事情在winform应用程序的启动代码行参数
ProcessStartInfo info = new ProcessStartInfo
{
CreateNoWindow = false,
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
FileName = @"C:\temp\testWinForm.exe",
Arguments = "dontShowWindow"
};
Process.Start(info);
希望这有助于
可能会帮助告诉我们您尝试运行的过程。 – Noldorin 2009-07-12 01:19:11
什么,什么都不开始或窗口显示?如果没有开始,那是因为你忘了process.Start()... – 2009-07-12 01:20:52
是的,你有一个process.Start()调用是否属于这个?我没有看到你分配进程和命令行参数的地方。 – jjxtra 2009-07-12 01:23:16