com

WinForm and mixed COM Objects: STA/MTA

I'm trying to build a WinForm application with two COM Objects. However, one of the objects only works when using [MTAThread] and the other only works with [STAThread]. What would the recommended solution be? ...

Why is the .TLB not being re-compiled by MIDL?

In my main project directory, there is a .TLB file. It has old information in it, and it is compiled into the binary -- which I can tell from looking at the compiled binary in a hex editor. What's weird is that I updated my .IDL in the main VC++ directory and that's compiled into a .TLB in the project build directory (\Debug), but it's ...

Creating your own HRESULT?

I already have a project that uses alot of COM, and HRESULTS. ANyways i was wondering if its possible to define your own HRESULT, AND be able to use the FormatMessage() for our own HRESULT? I dug around and cant find anything. Any ideas? EDIT Basically i want to define a set of my own HRESULT's instead of just returning E_FAIL. Or one...

Com error when trying to auto close browser sometimes

I try to close my browser in C# using the following code: private void KillIE() { ShellWindows winShells = new ShellWindowsClass(); foreach (InternetExplorer Browser in winShells ) { Browser.Quit(); } } Sometimes its works but today it doesn't and I cant get it to work. Now all I get...

How should I go about moving Component Services to a new server?

We're moving our test server onto a new box, and I need to migrate all of our components that are in Component Services to the new box. We have all of the COM dll files located in sub folders in a COM directory on the server, and we want to copy that entire directory and register all the applications in Component Services just like they ...

VB.NET COM Server implementing Excel UDF not callable with optional Excel.Range

Versions Excel 2007 (12.0.6425.1000) SP2, Visual Studio 2008 with VB.NET, Windows Vista The windup I have an Excel UDF written in VB.NET that has this signature: Public Function NonExcelName(ByVal A As Integer, _ ByRef B As Range, ByRef C As Range, _ Optional ByVal D As Integer = 1, _ ...

Absolute COM Confusion - C# interop with early-binding

I've been battling with VStudio, Google and various other tools and websites all day and found no solution - HELP!! I have two COM interfaces (pure COM, no ATL): IMyClassFactory and IMyClass with corresponding implementations I want to use them from C# BUT without registering the COM server with regsvr32. I expose the Class Factory wi...

Insert OLE object into WPF canvas?

Hi Folks! I'm getting stuck to a problem now for quite a long time. I want to use MathType (www.dessci.com) for my own application. Thats why i have to insert an ole object into a System.Windows.Controls.Canvas derived control. I searched the internet for quite a long time, not with real success. I found out that I probably have to use o...

How to marshal .NET string to variant for COM call

I'm using a third-party COM library from C#. There are get/set methods that take a parameter of type VARIANT (type VT_BSTR). In the .NET wrapper, these parameters appear as type object, i.e. object getValue(); void setValue( object val ); The getValue method works ok, I perform a simple cast of the object to type string: string str ...

What is the need of registering a COM component?

I am a .NET developer new to COM. I'd like to know what is the need of registering a COM component? What happens during registration. ...

Handling a SAFEARRAY returned from C# server.

Hi, I need to return an array of structure (classes) from a C# library to an unmanaged C++ client. This is the function in the C# library: [ComVisible(true)] [Serializable] public sealed class RetrieverProxy : IRetrieverProxy { public IMyRecord[] RetrieveMyRecords(long[] ids) { IList<IMyRecord> result = new List<IMyReco...

Create Outlook task with Java.

I have a requirement to have a new task appear in a user's task list in Outlook. The catch is that the source of the task will be generated in a Java environment. Does anyone know how I can create an Outlook task using Java? Thanks. ...

C# console application with COM introp support

Hi, I want to create COM server which should be lanunched as a process using C#. I tried console application with COM interop support, client can able to create COM object of my server and call COM objects's method. But my server not launched as process (like out process server), also my server application's main() function not called. ...

VB6 GUI not working in multithreaded COM environment

I have a VB6 COM client that makes calls to an inprocess STA ATL/COM server. One of the Server methods, X, can take a while to finish so I need to be able to cancel it. What I tried was to run the method code in a new thread and include another method, Y, that does a timed WaitForSinleObject. So the client first calls X then goes into a ...

How to marshall COM object on the server side in visual c++?

I have a out-of-process COM server with an ATL Simple Object which creates another thread. The new thread will need to make calls to ATL Simple object. Since ATL Simple Object and new thread are created different apartments, ATL Simple Object needs to be marshalled in the new thread, otherwise error 0x8001010e will be generated. How do...

Does a wrapper class calling a COM component through C# need to implement the Dispose pattern?

I have a class written in c# which is acting as a wrapper around a COM component. The COM component is early bound and the RCW has been generated by Visual Studio. Should I implement a dispose pattern in my wrapper class to clean up the COM reference, or should I just let the GC handle it, as it already has a RCW? ...

Embedded objects in MS Office documents using Python?

How could I create embedded objects in an MS office document using Python? I don't need anything fancy, just what one used to do in the first version of OLE: doing a copy-paste from my application into e.g. MS Word should give me an object embedded in the Word document, which I can then double-click to open a copy of my application a...

com interop: how to consume c# from Excel or Access

I see plenty on the web about VSTO and automating excel from c#, but very little to get started on wiring up a c# assembly to make it visible from Excel. Can someone point me to some very basic info explaining how to create a COM interface, GUIDS, ComVisible etc? ...

C# - Hook into existing COM object

Say we have an existing process (or application) that calls a COM object from an ocx file such as "MyCOMLibrary.ocx". Is there a way to write a C# library to exactly replicate the ocx file? So that the original application can call your C# code rather than the original COM object? You would, of course, have to use identical CLSID and ...

Com Error on server

Yesterday i started getting server too busy errors on some websites we are hosting. So I logged on the server and took a look at the event viewer about 4 time / minutes im getting this error : Log Name : Application Source : Complus Event ID : 4689 error Msg : The run-time environment has detected an inconsistency in its internal st...