Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# .NET WPF argument Process
I am trying to invoke one wpf application from another wpf application. The invoking wpf application makes the call
ProcessStartInfo BOM = new ProcessStartInfo();
BOM.FileName = @"D:\WPFAPPLICATION.exe";
BOM.Arguments = temp;
Now in the invoked application, I try to retrieve the argument passed using
  string arguments =Process.GetCurrentProcess().StartInfo.Arguments;
However the arguments are not passed. why is this??
I also tried an alternative method where in:
 public partial class App : Application
    public static String[] mArgs;
    private void Application_Startup(object sender, StartupEventArgs e)
        if (e.Args.Length > 0)
            mArgs = e.Args;
I have also tried:
string[] args = Environment.GetCommandLineArgs
However this did not work either!!! Please HELP!!
Posted 16-May-12 18:02pm
Edited 16-May-12 18:55pm
Member 10290238 at 11-Oct-13 22:56pm
Process.Start("http://localhost:50613/IAlert%20Website/User/readmore.aspx?artid=id&usid=userid");is it correct?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I found a web page that showed a version that was converted from C# to VB.Net[^]
Ive tried this in VB.Net and it works
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim psnfo As String
        Dim strbuilder As New StringBuilder
        Dim arg As String
        For Each arg In Environment.GetCommandLineArgs()
        psnfo = strbuilder.ToString
        TextBox1.Text = "Args: " & psnfo.ToString
    End Sub
The code returns:
Args: C:\Testapp1.exe
It will return both args passed to it.
your code does not appear to treat the args as an array or group of items.
Hope this helps some.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 CPallini 550
1 Sergey Alexandrovich Kryukov 420
2 George Jonsson 288
3 Pheonyx 218
4 OriginalGriff 200
0 OriginalGriff 4,813
1 CPallini 3,850
2 Sergey Alexandrovich Kryukov 3,224
3 George Jonsson 2,552
4 Gihan Liyanage 2,186

Advertise | Privacy | Mobile
Web01 | 2.8.140905.1 | Last Updated 17 May 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100