Jump to content

8 posts in this topic

Posted

My JavaScript sends a selected path, for example C:\files to com ActiveX, I catch it on C# like this:
[CODE]
[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"?

Share this post


Link to post
Share on other sites

Posted

[quote name='Joni_78' timestamp='1353920916' post='595349678']
My JavaScript sends a selected path, for example C:\files to com ActiveX, I catch it on C# like this:
[CODE]
[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"?
[/quote]
Wicked. Do people still use ActiveX? I have no experience in that what so ever. Have you tried Stackoverflow?

Share this post


Link to post
Share on other sites

Posted

[CODE]
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]

Share this post


Link to post
Share on other sites

Posted

Unless I understood the OP's question incorrectly, this should do the trick:


[CODE]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.

Share this post


Link to post
Share on other sites

Posted

Thanks.

Share this post


Link to post
Share on other sites

Posted

[quote name='ffMathy' timestamp='1353921780' post='595349684']
Wicked. Do people still use ActiveX? I have no experience in that what so ever. Have you tried Stackoverflow?
[/quote]

Is there anything better that I can use? I use ActiveX so that I can send parameters from javascript to methods in .dll.

Share this post


Link to post
Share on other sites

Posted

[quote name='Joni_78' timestamp='1354013020' post='595351830']
Is there anything better that I can use? I use ActiveX so that I can send parameters from javascript to methods in .dll.
[/quote]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?)

Share this post


Link to post
Share on other sites

Posted

Out of curiousity, why are you using JavaScript in the first place?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.