Joni_78 Posted November 26, 2012 Share Posted November 26, 2012 My JavaScript sends a selected path, for example C:\files to com ActiveX, I catch it on C# like this: [ComVisible(true)] public string MyParam { get { return myParam; } set { myParam = value; } }[/CODE] I then launch a program like this: [CODE][ComVisible(true)] public void LaunchPlayer() { Process.Start("wmplayer.exe", "ANYFOLDER"); }[/CODE] The problem is that how do I launch the program so that it uses the current value on myparam on "anyfolder"? Link to comment https://www.neowin.net/forum/topic/1122150-c-processstart-with-current-path/ Share on other sites More sharing options...
0 ffMathy Posted November 26, 2012 Share Posted November 26, 2012 My JavaScript sends a selected path, for example C:\files to com ActiveX, I catch it on C# like this: [ComVisible(true)] public string MyParam { get { return myParam; } set { myParam = value; } }[/CODE] I then launch a program like this: [CODE][ComVisible(true)] public void LaunchPlayer() { Process.Start("wmplayer.exe", "ANYFOLDER"); }[/CODE] The problem is that how do I launch the program so that it uses the current value on myparam on "anyfolder"? Wicked. Do people still use ActiveX? I have no experience in that what so ever. Have you tried Stackoverflow? Link to comment https://www.neowin.net/forum/topic/1122150-c-processstart-with-current-path/#findComment-595349684 Share on other sites More sharing options...
0 stumper66 Posted November 26, 2012 Share Posted November 26, 2012 public void LaunchPlayer() { System.Diagnostics.ProcessStartInfo PSI = new System.Diagnostics.ProcessStartInfo(); PSI.FileName = "wmplayer.exe"; PSI.WorkingDirectory = "C:\\MyDirectory"; System.Diagnostics.Process.Start(PSI); }[/CODE] Link to comment https://www.neowin.net/forum/topic/1122150-c-processstart-with-current-path/#findComment-595349922 Share on other sites More sharing options...
0 georgevella Posted November 26, 2012 Share Posted November 26, 2012 Unless I understood the OP's question incorrectly, this should do the trick: Process.Start("wmplayer.exe", myParam);[/CODE] The second parameter specifies the arguments passed to the executable. If you want to launch the executable with a different working directory, you should follow stumper66's suggestion above and set the WorkingDirectory property accordingly. Link to comment https://www.neowin.net/forum/topic/1122150-c-processstart-with-current-path/#findComment-595349936 Share on other sites More sharing options...
0 Joni_78 Posted November 26, 2012 Author Share Posted November 26, 2012 Thanks. Link to comment https://www.neowin.net/forum/topic/1122150-c-processstart-with-current-path/#findComment-595350652 Share on other sites More sharing options...
0 Joni_78 Posted November 27, 2012 Author Share Posted November 27, 2012 Wicked. Do people still use ActiveX? I have no experience in that what so ever. Have you tried Stackoverflow? Is there anything better that I can use? I use ActiveX so that I can send parameters from javascript to methods in .dll. Link to comment https://www.neowin.net/forum/topic/1122150-c-processstart-with-current-path/#findComment-595351830 Share on other sites More sharing options...
0 georgevella Posted November 27, 2012 Share Posted November 27, 2012 Is there anything better that I can use? I use ActiveX so that I can send parameters from javascript to methods in .dll. From the way you are using it, doubt there is another way other than COM (am I wrong to assume you are actually using COM and not ActiveX which is a variant of COM/OLE and used primarily for shared UI controls?) Link to comment https://www.neowin.net/forum/topic/1122150-c-processstart-with-current-path/#findComment-595351854 Share on other sites More sharing options...
0 +Majesticmerc MVC Posted November 27, 2012 MVC Share Posted November 27, 2012 Out of curiousity, why are you using JavaScript in the first place? Link to comment https://www.neowin.net/forum/topic/1122150-c-processstart-with-current-path/#findComment-595352038 Share on other sites More sharing options...
Question
Joni_78
My JavaScript sends a selected path, for example C:\files to com ActiveX, I catch it on C# like this:
I then launch a program like this:
[ComVisible(true)]
public void LaunchPlayer()
{
Process.Start("wmplayer.exe", "ANYFOLDER");
}
[/CODE]
The problem is that how do I launch the program so that it uses the current value on myparam on "anyfolder"?
Link to comment
https://www.neowin.net/forum/topic/1122150-c-processstart-with-current-path/Share on other sites
7 answers to this question
Recommended Posts