com

How to use IGlobalInterfaceTable to pass an interface pointer?

Without: MFC ATL Question: What are the steps involved, to use IGlobalInterfaceTable, when passing a particular interface pointer to several threads using CreateThread? ...

How to Manage COM Objects in .Net Web Application

A legacy c++ applications with sometimes notorious memory leak issues has to be called from a .Net server based windows application. .Net garbage collection times are not determinable and sometime the c++ object are destroyed or not destroyed "on time" producing unpredictable results and generally crashing the c# web app. What is the b...

Using a COM DLL in delphi - Access violation in MSVCR80D.dll error

I need to use a DLL created using .NET framework. This DLL is made COM visible. I want to use this DLL in an application created using Delphi 2006. I have followed following steps: Registered the DLL using regscr32. Imported the type library using Delphi IDE. It created _TLB.pas file. Following signature was created in TLB file. fun...

Pass an element from C type string array to a COM object as BSTR? (in C++)

I am writing a C++ DLL that is called by an external program. 1.) I take an array of strings (as char *var) as an argument from this program. 2.) I want to iterate through this array and call a COM function on each element of the string array. The COM function must take a BSTR: DLL_EXPORT(void) runUnitModel(char *rateMaterialTypeName...

Why can't I connect to my COM objects events after creation?

I have written a COM object using C++. Creating the object and connecting to its events works fine if I do them both at the same time (Javascript): var obj = WScript.CreateObject("SomeCOMClass.Object", "event_"); However the following generates this error (msdn): http://msdn.microsoft.com/en-us/library/a7tya2wc(VS.85).aspx. var obj ...

.NET framework based windows service and COM callbacks (connection points)

Hi! I'm currently developing on application that uses legacy COM-based object. This object resides in standalone executable and have COM connection point defined on it. When I subscribe on this connection point within WinForms application everything is ok - all callbacks received smoothly. When using same code from NET framework based Wi...

On-the-fly upgrading a COM object used in a .NET application

We have a large, deployed, 3-tier .NET application which for good business reasons can't be upgraded at present. The client makes use of a number of classic c++ ActiveX controls through the usual interop mechanism. We have fixed some critical bugs in one of the ActiveX controls and need to deploy the fixes to a number of customers with...

how to handle exceptions in C# DLL loaded by C++

I have a DLL that is created in C# for the purpose of providing a COM interface to a third-party C# library. I have a C++ program that uses that COM interface so that it can communicate with the C# library. Sometimes, exceptions get thrown on the C# side and all I get back on the C++ side is an HRESULT from the COM invocation that says...

How can I add an editable ComboBox to Vista's Common Item Dialog?

Vista introduced the new Common Item Dialogs for opening and saving files that supersede the old Common File Dialogs. Custom controls can be added by utilizing the simple IFileDialogCustomize interface. One of them is a standard ComboBox which is non-editable. Is there any way to create an editable ComboBox or modify an existing one (by ...

COM basic sample

I've been reading Essential COM, it is a very good book, very instructive and simple to understand. Now I want to speed things up and implement a simple COM object, compile it into a .dll and finally use it from a client application. I would really appreciate if anybody could show the most basic sample of how to do that? I've been tryi...

Get a list of Com Objects in ASP.

a task at my hand requires me to move an ASP application from one server to another. For this, I need two command line tool like stuff to know the following info. Get the list of com objects used in this asp project. Get the list of registered com objects in my existing server. Any Idea ? ...

How do I get the mdTypeRef for a System.Byte for use with IMetaDataEmit?

I just getting started using IMetaDataEmit to write some .NET IL. I'm having trouble getting the mdTypeRef for a System.Byte (which I would like to use to declare a byte array on the stack). Here is my attempt. metaDataEmit->DefineTypeRefByName(NULL, L"System.Byte", &byteToken); This throws an error message that says "Could not load...

Why do I get E_NOINTERFACE when creating an object that supports that interface?

Note: Using CoGetClassObject, to create multiple objects through a class object for which there is a CLSID in the system registry Single threaded apartment For instance: hresult = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); IClassFactory *pIClassFactory; hresult = CoGetClassObject (clsid, CLSCTX_LOCAL_SERVER, NULL, IID_IClassF...

How to find what objects a given CLSID supports

Question: Based on a CLSID, how can I find out what objects (or interfaces) it supports for IClassFactory::CreateInstance Note: Currently using CLSIDFromProgID to obtain CLSID ...

may COM server reallocate ([in, out] CACLSID * arg) ?

With a COM interface method declared as this: [ object, uuid(....), ] interface IFoo : IUnknown { HRESULT Foo([in, out] CACLSID * items); } With regards to marshalling, is the server allowed to reallocate the counted array? (I think it is, but I am not sure anymore) Its current implementation only replaces the existing ID's, but...

Reflection Terminal Emulator - Integration with IE

I'm trying to implement some integration between a legacy app running in the Reflection Terminal Emulator and a browser-based app running in IE. I'm using Host Initiated Scripts so that maintenance and deployment issues are isolated to the legacy app. All scripts will be generated in the legacy app and transmitted to Reflection using e...

Is there an equivalent to out-of-process COM EXE in .NET?

One of the nice things about COM/ActiveX was the out-of-process EXE. You could have an EXE which exposed methods and properties in a form usable by both other processes, including VBScript and JScript. At the same time the EXE could have its own functionality, related or unrelated to that exposed by its type library. What is the .NET eq...

How to convert char * to BSTR?

Hi, How can I pass a char * from C dll to VB Here is sample code: void Cfunc(char *buffer,int len) { BSTR buf_bstr = SysAllocString((BSTR)buffer); VBptr.VBfunc(buf_bstr,len); } This function is not working, In actual some other values are sent to the VB rather than the actual value. Can Anyone .. tell me how the solution for ...

Convert VARIANT to...?

Note: Attempting to invoke a method of an interface, of which the return type is _variant_t Code: _variant_t resultsDataString; _bstr_t simObjectNames; simObjectNames = SysAllocString (L"TEST example 3"); resultsDataString = pis8->GetSimObject (simObjectNames); inline function illustrated below, contained in .tli FILE: inline ...

Fastest way to call a COM objects method without using a RCW

I'm trying to find the cleanest and fastest way for calling a COM objects methods. I was using a RCW for the object but every time a new version of the third party COM object comes out its GUID changes which then renders the RCW useless, so I had to change and start using Type mytype = Type.GetTypeFromProgID("MyCOMApp.Application");...