Showing results for 
Search instead for 
Do you mean 

launch unmanaged code from managed code?

I have a NXOpen application written in and I would like to launch another NXOpen application written in C++ (unmanaged code) from the 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.



Re: launch unmanaged code from managed code?

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.


Re: launch unmanaged code from managed code?




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.