com

Internet Explorer 6 Window Title bar corrupts after ActiveX object initializes.

I have an old application I'm trying to track down a bug in. The problem is that after the ActiveX object loads, the title bar of IE6 corrupts. It goes from displaying what the title was in the html to showing random text, usually a bunch of boxes and ?'s. The ActiveX control is making no attempts to set the window title, and under IE7 a...

How write C# code being safe both under x86 and x64 when accessing COM? Typical traps?

We use an open source library written in C# wrapping Windows BITS COM component. However, the code is only safe to run it in x86 mode. I would like to contribute to the library by making it safe for both x86 and x64, however I have no deep knowledge in this field. Could you please list here good/bad practices, typical issues, maybe pri...

Change interface guids of COM DLL (ressource patch)

I have to build OEM versions of a COM library (DLL). Does anyone know a tool (ressource hacker) which may replace some of my interface guids after build time? I just want to build and test one DLL and generate the OEM versions afterwards. ...

How to suppress DISPPARAMS warnings in msbuild?

I have bunch of COM dependencies and my build script emits tons of following warnings: c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets : warning : The type library importer could not convert the signature for the member 'DISPPARAMS.rgvarg'. c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets :...

accessing a static property via COM

is it possible to access a static property of a COM object without creating an instance of the object? my situation is this: i have an unmanaged application (written in delphi). this application exposes a COM-based plugininterface. until now i only wrote managed plugins in c#. plugins provide their info (name, author, ..) via a static p...

Intro to COM DLL

Before you tell me "google it" - hear me out. I come from C++ & Perl/Python (on Linux) background but I have a few projects coming up where I have to jump in to Windows development. Specifically creating some COM DLLs (not .Net). BTW, after reading some resources, I do have basic idea of what COM & what DLL is. I tried to search on Goog...

Is this a good way to manage initializations of COM?

Hello everyone :) I'm very new to anything involving Component Object Model, and I'm wondering if this method of managing calls to CoInitalize/CoUninitalize makes sense: COM.hpp: #pragma once namespace WindowsAPI { namespace ComponentObjectModel { class COM { COM(); ~COM(); public: static void Setup(); }; }} COM.cpp: ...

Will this make the object thread-safe?

I have a native Visual C++ COM object and I need to make it completely thread-safe to be able to legally mark it as "free-threaded" in th system registry. Specifically I need to make sure that no more than one thread ever accesses any member variable of the object simultaneously. The catch is I'm almost sure that no sane consumer of my ...

Get process id of process started with CreateObject in .NET

Hi! I'm using VB.NET for a web-application that starts some process using CreateObject, like this: Dim AVObject = CreateObject("avwin.application") After all is done everything get closed down en stopped using the proper release functions, however, for some reason the process remains. Is there some way in which I can get the proces...

How to get function name against function address by reading co-classs'es vtable?

Hello, I need to call the co-class function by reading its address from vtable of COM exposed interface methods. I need some generic way to read addresses. Now I need to call the function, which would have specific address(NOT KNOWN) arguments(parameters) which I have collected from TLB, and name as well. How that address corresponds t...

Drag and Drop text - What am I missing?

I am trying to add drag-and-drop text to my Doc-View App. I added the COleDropTarget variable to the view class, registered it in OnCreate(). I added OnDragEnter(), OnDragOver(), OnDragLeave() and OnDrop() to that class as virtual overrides, but none of them are ever called. I previously had added m_pMainWnd->DragAcceptFiles(TRUE); to my...

How can I automatically elevate a COM interface used for automation?

I have a Windows service built with ATL to expose a LocalServer32 COM interface for a set of admin commands used for configuring the service, and these can be used from VBScript for example: Set myObj = WScript.CreateObject("MySvc.Administrator") myObj.DoSomething() I want DoSomething to run elevated, and I would like the UAC prompt t...

Can a CLSID be different for the same program installed on two different machines?

I am using comtypes to generate wrappers for a certain com library. I am having certain issues with a few things, that are not being generated properly. I can get around this by doing the missing work, manually. However can i depend on the fact that CLSID's will not change? Lets say: I install a program with the com library Foo 1.0, no...

.NET Compact COM interoperability

I have the following code in a full .NET framework solution: public delegate int CreateObjectDelegate( [In] ref Guid classID, [In] ref Guid interfaceID, [MarshalAs(UnmanagedType.Interface)] out object outObject); ... var createObject = (NativeMethods.CreateObjectDelegate) Marshal.GetDelegateFo...

How can I destroy COM objects in C#?

What are the methods to destroy Excel COM Interop objects in C#, besides these: object_instance = null; System.GC.collect(); & System.Runtime.InteropServices.Marshal.ReleaseComObject(object); Please suggest only inbuilt techniques, not other tools like bigcannon, etc. ...

Delphi 6 OleServer.pas Invoke memory leak

There's a bug in delphi 6 which you can find some reference online for when you import a tlb the order of the parameters in an event invocation is reversed. It is reversed once in the imported header and once in TServerEventDIspatch.Invoke. you can find more information about it here: http://cc.embarcadero.com/Item/16496 somewhat rela...

Visual Studio 2010 64-bit COM Interop Issue

I am trying to add a VC6 COM DLL to our VS2010RC C# solution. The DLL was compiled with the VC6 tools to create an x86 version and was compiled with the VC7 Cross-platform tools to generate a VC7 DLL. The x86 version of the assembly works fine as long as the consuming C# project's platform is set to x86. It doesn't matter whether the x6...

Loose coupling of COM in C# or How to avoid COMException 0x80040154

I have a .Net 2 C# application I am developing which uses a VB 6 generated COM DLL. The VB DLL is updated frequently any my application crashes with a System.Runtime.InteropServices.COMException (0x80040154). The part of the COM DLL I use does not change but the version (and CLSID) will. The "Specific Version" option for the reference ...

Using DLL that using COM in C#

I have been writing DLL on C++, that will be use in C#. DLL have some function, where I call hres = CoInitializeEx(NULL, COINIT_MULTITHREADED); and next call hres = CoInitializeSecurity( NULL, -1, // COM authentication NULL, // Authentication services ...

Interface Marshalling in Delphi

I want to send Interface Ref of IVApplication from Visio Add-in to my other one COM server. But I have Ole exception. Now i do that: Code in Visio Add-in: var IStrm: IStream; hres: HResult; rhglobal: HGLOBAL; VisioAppl: IVApplication; begin hres := CreateStreamOnHGlobal(0, TRUE, IStrm); if Succeeded(hres) then ...