cancel
Showing results for 
Search instead for 
Did you mean: 

launch unmanaged code from managed code?

Experimenter
Experimenter

I have a NXOpen application written in VB.net and I would like to launch another NXOpen application written in C++ (unmanaged code) from the VB.net application. Is there a command to do this? I have found a command to launch grip programs theSession.ExecuteGrip() and a command to launch other managed code theSession.Execute(). Any help would be appreciated.

 

2 REPLIES

Re: launch unmanaged code from managed code?

Siemens Phenom Siemens Phenom
Siemens Phenom

Do you want to call some function in the unmanaged C++ code, or do you actually want to launch the program?

 

To call a function in unmanaged code from managed code, you should use the Platform Invoke (P/Invoke) technology. This is not too hard, as long as the arguments of the called function are fairly simple.

 

Generally, to launch an app (regardless of whether it is written using managed or unmanaged code), you would use the System.Diagnostics.Process.Start function. But I have no experience with doing this, and I'm not sure that it would interact nicely with NX.

山田
yamada

Re: launch unmanaged code from managed code?

Siemens Phenom Siemens Phenom
Siemens Phenom

 

Doug,

 

If you open the Programming Tools docs in NX9, and search for this string:

 

"The example below shows how VB .NET makes calls to unmanaged C."

 

There is a small example that demonstrates how you can do this.

 

Regards,

 

Steve