我像这样将一些参数从WPF应用程序传递给WinForm应用程序。
int processID = Process.GetCurrentProcess().Id;
Process p = new Process();
p.StartInfo.FileName = FileManager.AppDirectoryName + "\\" + winformApp;
p.StartInfo.Arguments = string.Format("Param1={0}", processID );
p.Start();
但是在其他应用程序中,我看不到任何参数。
[STAThread]
static void Main()
{
// Get start arguments
var process = Process.GetCurrentProcess();
var args = process.StartInfo.Arguments; // It is empty. Why is it??
有什么线索吗?
Process.GetCurrentProcess()
退货
与正在运行调用应用程序的流程资源关联的新流程组件。
此新组件将具有一个空的startinfo成员。只需使用
Environment.GetCommandLineArgs()
反而。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句