Mr_Kraut

Hi all,

I have a serious problem with C#:

There is a very old program used to manage CAD-files.

I need to tell this old thing to execute a certain script.


The problem now:
in Visual Basic I can use:

Code Snippet

Dim myOldServer as Object

Try

myOldServer = GetObject( , "OldServer.Application")

myOldServer.ExecuteTclScript("myscript", myParameterPairs)

Catch ex as Exception

....

But in C# I didn't find a similar method, only System.Runtime.InteropServices.Marshal.GetActiveObject, but this points to the Running Objects Table, and there my server is not found.

So, is there a simple command like in Visual Basic

Thanks to all who try to help me!

Best regards

Chris




Re: Visual C# Express Edition Accessing a running process...

Derek Smyth

Hi,

This might be what your looking for.

http://www.codeproject.com/csharp/CSGetObject.asp






Re: Visual C# Express Edition Accessing a running process...

Mr_Kraut

Hello Derek,

thanks for that link, but this was not what I was looking for.

To specify my problem:

I need to get this "OldServer.Application" into an object to use its methods to work for me.

It is an instance of an old (really old) ole-based serverprocess that provides identifiers for CAD-data such as assemblies or drawings.

I need to access this running process and tell it to load and uncheck a certain number...

As said before, Visual basic gets it via GetObject. But C#... well I don't think it might be so easy, I found nothing about this theme.






Re: Visual C# Express Edition Accessing a running process...

nobugz

Yes, you do have a problem. You are using late binding in the VB.NET code, C# doesn't support it. Short from trying to do what the VB.NET compiler does (which is *not* easy, I tried), I'd recommend you simply create a VB.NET assembly that works with the COM interface. Add a reference to that VB.NET assembly in your C# project.






Re: Visual C# Express Edition Accessing a running process...

Mr_Kraut

Thanks nobugz!

This is indeed not the most proper way, but I see that I do not have another chance to get this old stuff running.

By the way: Had the same problem with an old version of Microsoft Excel, because there is no library to include for early bindings...

Regards

Chris