I pass some arguments from WPF app to WinForm apps like this.
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();
But in other application I cannot see any args.
[STAThread]
static void Main()
{
// Get start arguments
var process = Process.GetCurrentProcess();
var args = process.StartInfo.Arguments; // It is empty. Why is it??
Any clue?
Process.GetCurrentProcess()
Returns
A new Process component associated with the process resource that is running the calling application.
This new component will have an empty startinfo member. Just use
Environment.GetCommandLineArgs()
Instead.