p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   C# (http://p2p.wrox.com/forumdisplay.php?f=22)
-   -   Get running Instance of a Process not in ROT? (http://p2p.wrox.com/showthread.php?t=32993)

scando August 30th, 2005 08:45 AM

Get running Instance of a Process not in ROT?

I am using C# code to start and interact with Microstation and have run into a small problem that I can't figure out.

The following code gets the running machine processes and if "ustation" is not already running starts Microstation.
This works great!

If "ustation" is already running, the following code tries to obtain a running instance of Microstation by looking the application up in the Running Object Table.
This fails because Microstation does not register itself in the ROT.

How do I return an object.type (comparable to the return type of GetActiveObject) that is attached to a running process not in the ROT?

Here is the code I am using...

{ Process[] ustationProcesses = Process.GetProcessesByName("ustation");

if ( ustationProcesses.Length == 0 )
     app = new MicroStationDGN.Application();
     app = (MicroStationDGN.Application)System.Runtime.Intero pServices.Marshal.GetActiveObject("MicroStationDGN .Application");
catch (System.Exception ex)
MessageBox.Show("Starting Microstation generated the following exception:\n"+ex.ToString());

BTW, the code works for AutoCAD; It registers itself in the ROT.

Thanks in advance for any input...

JED38 February 20th, 2018 01:06 PM

did you ever figure anything out
I know this is a really old post. but I have the same problem.
did you ever figure out another way to do this?

All times are GMT -4. The time now is 06:22 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.