Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
| Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 30th, 2005, 08:45 AM
Registered User
 
Join Date: Aug 2005
Location: , Texas, .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Get running Instance of a Process not in ROT?

Anyone,

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...

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

if ( ustationProcesses.Length == 0 )
    {
     app = new MicroStationDGN.Application();
    }
else
    {
     app = (MicroStationDGN.Application)System.Runtime.Intero pServices.Marshal.GetActiveObject("MicroStationDGN .Application");
    }
     return(app);
}
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...
Daren....
 
Old February 20th, 2018, 01:06 PM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2018
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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?




Similar Threads
Thread Thread Starter Forum Replies Last Post
process.startinfo opens new instance of process Anypond General .NET 0 August 28th, 2008 05:35 AM
Finding commandline arguments of a running process EddyT C# 4 July 1st, 2007 10:07 AM
Know about a running process for a given resource baburman General .NET 2 October 13th, 2005 03:04 AM
Check Multiple running Instance of DTS Package greenash SQL Server DTS 0 January 3rd, 2005 09:33 AM
Running VS 2002 & 2003 sharing one instance of MSD kevin777 VS.NET 2002/2003 8 October 24th, 2004 11:43 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.