com

VB6 ActiveX DLL Running Slow On Terminal Server 2008

I have a VB6 ActiveX DLL that has run fine on all our machines for several years. Recently our IT manager setup several locations so they remote into Terminal Server 2008 and run the program that accesses my DLL on the Terminal Server so that their databases are local to the corporate network. My DLL runs very slowly on the terminal serv...

How to dispose of a NET COM interop object on Release()

I have a COM object written in managed code (C++/CLI). I am using that object in standard C++. How do I force my COM object's destructor to be called immediately when the COM object is released? If that's not possible, call I have Release() call a MyDispose() method on my COM object? My code to declare the object (C++/CLI): [Gui...

Failing to set COM+ ConstructorString on Win7 - CryptProtectData changes?

UPDATED I'm trying to programmatic-ally set a COM+ component's ConstructorString with a value for later initialization. The code in question works fine on WinXP, Win2k3, Vista and Win2k8. I'm failing on Win7 - Home Premium version. I've determined by trial and error that there seems to be a size limit on the constructor string - if t...

WebBrowser control from ATL to c#

Hi, In ATL if I create webbrowser control using IWebBrowser2, it works great in Windows Mobile. I am able to visit all sites, progress bar comes, everything is fine.. rest of UI content I can't do in ATL, since it's time consuming. I would like to go for c#. can any one suggest me how to make ATL activex control and use it in c#. Thank...

Why does BEGIN_COM_MAP contain a DEBUG_QI_ENTRY?

In ATL there's a BEGIN_COM_MAP macro for declaring a table that controls how the QueryInterface() behaves when called on the corresponding class object. Inside it has the following line: static const _ATL_INTMAP_ENTRY _entries[] = { DEBUG_QI_ENTRY(x) which means that the first table entry will be DEBUG_QI_ENTRY which expands as f...

What's the purpose of IUnknown member functions in END_COM_MAP?

ATL END_COM_MAP macro is defined as follows: #define END_COM_MAP() \ __if_exists(_GetAttrEntries) {{NULL, (DWORD_PTR)_GetAttrEntries, _ChainAttr }, }\ {NULL, 0, 0}}; return _entries;} \ virtual ULONG STDMETHODCALLTYPE AddRef( void) throw() = 0; \ virtual ULONG STDMETHODCALLTYPE Release( void) throw() = 0; \ STDMETHOD...

Getting a byte array from out of process C++ COM to C#

What's the best way to get a chunk of memory (i.e. void*) from a COM server to C#? We have been using an IStream (using CreateStreamOnHGlobal) and passing that back, which worked. However when we tried this on x64 CLR with x32 C++ COM it blows up. The COM has to be x32 because it uses external 32 bit DLLs. The C# could be forced to r...

ATL/COM: Can I have the same function in two different interfaces of the same object?

I have an ATL/COM-based DLL, written in VC++ 6.0. Until recently, there was a one-to-one correspondence between my COM interfaces and classes. For example, let's say there was a ICar interface; then there was also a CCar class which implemented it, and no class other than CCar implemented ICar, and CCar implemented no interface (of min...

property or method by DISPID

Is it possible to know if a given DISPID (result of GetIDsOfNames) is either a method, a property getter or setter ? ...

IThumbnailProvider and IInitializeWithItem

I am trying to develop an IThumbnailProvider for use in Windows 7. Since this particular thumbnail would also be dependant on some other files in the same directory, I need to use something other than IInitializeWithStream to a path to work with, this being IInitializeWithItem. (Alternatively, I could use IInitializeWithFile, but that is...

Can multiple ProgIDs point to the same ClsID?

I am working on a set of what are essentially plugins, which are COM servers. Each plugin has a set of configuration data which is managed by another component, the primary key to the configuration data is the plug-in's ProgID. When the plugin needs to access a configuration item, it makes a call and passes in its ProgID and the name of ...

MFC COM or ATL COM (ActiveX)

I have some MFC code (custom CWnd controls and some classes to expose) that I need to make into an activex / COM object with interfaces. Is it easier to make an ATL project with MFC support and make my ActiveX that way or make an MFC ActiveX control? When doing an activeX control, is doing dual interfaces (like that explained in ACDual ...

Why does ATL COM map scanning code expect the first entry to be of _ATL_SIMPLEMAPENTRY type?

ATL provides a bunch of macros for creating so-called COM maps - chains of rules of how the QueryInterface() call behaves on a given object. The map begins with BEGIN_COM_MAP and ends with END_COM_MAP. In between the the following can be used (among others): COM_INTERFACE_ENTRY, COM_INTERFACE_ENTRY2 - to ask C++ to simply cast this cla...

When implementing several COM interfaces at once how do I upcast to IUnknown?

Suppose my COM object implements two or more COM interfaces: class CMyClass : public IPersistFile, public IPersistStream { }; when implementing QueryInterface() I need to be able to return an IUnknown* pointer. Since both base interfaces are derived from IUnknown I cannot upcast implicitly - such upcast would be umbiguous. To upcast e...

Why exactly do I need an explicit upcast when implementing QueryInterface() in an object with multiple interfaces()

Assume I have a class implementing two or more COM interfaces: class CMyClass : public IInterface1, public IInterface2 { }; Almost every document I saw suggests that when I implement QueryInterface() for IUnknown I explicitly upcast this pointer to one of the interfaces: if( iid == __uuidof( IUnknown ) ) { *ppv = static_cast<IIn...

RegisterClassObjects() Doesn't Find Classes To Register

I'm in the process of converting an application from Visual Studio C++ 6.0 to Visual Studio 2008 and am running into problems with ATL. I've been having a whole host of issues, but this is the first call that differs in return values between the two different compilers. The following line, when compiled with VC++ 6.0, returns S-OK. Wh...

Why use CComBSTR instead of just passing a WCHAR*?

I'm new to COM. What exactly is the advantage of replacing: L"String" with CComBSTR(L"String") I can see a changelist in the COM part of my .NET application where all strings are replaced in this way. Would like to know what is the need for this. ...

What are the frequently encountered causes for COM memory leaks

What are the most frequently encountered causes for COM memory leaks? I have read that passing the address of an initialized CComBSTR to a function as an [out] parameter causes leak. I'm looking to enumerate other common programming mistakes like this. ...

Hunting memory leaks

I'm finding leaked heap blocks by using the following command in WinDbg !heap –l With each leaked heap block I get, I'm running to following to get the stack trace. !heap -p -a leakedheapblock The following is the result of this command: address 1c841cc0 found in _HEAP @ 3930000 HEAP_ENTRY Size Prev Flags UserPtr UserSize - s...

callback/event management with COM/Ole/ActiveX

I am writing a native COM/Ole/ActiveX wrapper for a scripting language. I need some advices to implement events/callback (like onreadystatechange from Microsoft.XMLHTTP object) I noticed that some COM objects can call my custom object through an IDispatch interface. Is it the only way to manage events ? ...