atl

How to free member (i.e BSTR, SAFEARRAY, VARIANT) of an IDL User Defined Structure which is encapsulated in a VARIANT?

Hi, I have a structure defined in IDL. This structure has following members: { BSTR m_sFirst; BSTR m_sSecond; VARIANT m_vChildStruct; //This member encapsulate a sub structure SAFEARRAY __RPC_FAR * m_saArray; }CustomINFO; I am allocating the memory for the structs using CoTaskMemAlloc and encapsulating it in Varian...

atlbase.h not found when using Visual C++ Express 2010

So I tried moving my project to Visual C++ Express 2010 on Windows 7 from a previous version on Windows XP. I got all sorts of errors where atlbase.h was not found. This isn't so much a question but I wanted to document what my resolution was for others. Copied the following PlatformSDK files from my previous install and put them on m...

How to Set ActiveX Control name and link on the install window of Internet Explorer?

I created a ActiveX control using ATL, already package it with signature. I want to use it on the webpage, but at the install window the name is MyActiveX.cab with no link. the MyActiveX.cab name can be changed by modifying the html page's tag codebase attribute. but the name is still format like "XXX.cab" with no hyperlink. I find a a...

Advice when using COM Object/CComPtr and the STL

Hello, I am doing some COM related things with directshow such as: typedef CComPtr<IBaseFilter> AutoIBaseFilterPtr; map<CString, AutoIBaseFilterPtr> _filterMap; To store a list of directShow related com objects and their friendly name. After finding this article (See:Problem 2) on how changes in VC10 compiler might effect previous...

How do I pass an array of structs (containing std:string or BSTR) from ATL to C#. SafeArray? Variant? COM interface question.

Hi, I have an ATL COM object that I am using from C#. The interface currently looks like: interface ICHASCom : IDispatch{ [id(1), helpstring("method Start")] HRESULT Start([in] BSTR name, [out,retval] VARIANT_BOOL* result); ... [id(4), helpstring("method GetCount")] HRESULT GetCount([out,retval] LONG* numPorts); ... [id(7)...

How to make WebBrowser control with transparent background?

Hi all. I try to make my WebBrowser control transparent, so if the HTML loaded into it has no background, the underlying window should be visible. I`ve broke my head trying different ways. There is a transparent background in Microsoft Sidebar application. In gadget`s HTML <g:background> tag can be used, but this tag is not available i...

How to use visual leak detecter ( vld ) for com/atl dll projects?

I included vld.h file in my activex dll project. when i try to compile my project from visual studio 2008.I am getting the following error, 1>Registering output... 1>Project : error PRJ0050: Failed to register output. Please ensure you have the appropriate permissions to modify the registry. How to use visual leak detecter for com/act...

Outlook Addin: DispEventAdvise exception.

I want to creating an addin that captures when a {contact, calendar, task, note} is {created, edited, removed}. I have the following code, to make it shorter I removed all the code but the related to contact, since all types will be the same I guess. AutoSync.h class ATL_NO_VTABLE AutoSync : public wxPanel, public IDispEventSimpleIm...

CComPtr CoCreateInstance returns 0x80070582 (Class already exists.)

I have a StartComObjects function called when the user presses the Login button and a StopComObjects function called when the user presses the Cancel button. The StartComObjects function uses CComPtr.CoCreateInstance to create the COM object and sets up some connection points using AfxConnectionAdvise. When the user presses the Cancel ...

IE status bar. I need to add a clickable icon to the status bar.

My bho (Browser Helper Object) is a sidebar (right-sided iframe) that needs to be opened/closed by clicking the status bar icon in IE (IE8). I didn't find any informations for clickable icons. Anyone knows wich interface to use to do that. Thank you. (I'm using ATL: Active Template Library). If anyone need precisions, please ask. I'll be...

IE Address bar search. I need to grab what the user types to offer him added results.

Is there a way to grab (in real time, like a onKeyPressed, return what is pressed) what the user types in the address bar. Currently in IE, it offers you a matching list from history depending of what you type. I'm looking for a way to get some sort of handle to the address bar and then listen to what the user is typing. I'm doing a BHO(...

How to call interface API from within COM server

I have one com server with some interfaces exposing some API's COM class looks like below class ATL_NO_VTABLE CTask : public CComObjectRootEx<CComSingleThreadModel>, public CComCoClass<CTask, &CLSID_Task>, public ITask { public: STDMETHOD (Task)(); STDMETHOD (ABC)(); ... } Now this com server also contains one more cla...

Problem catching OnClick event using HTMLDocumentEvents2 in a BHO

I am running a BHO and i am trying to catch OnClick events using HTMLDocumentEvents2 however, the events never seem to reach the handler this is what i am doing: class ATL_NO_VTABLE CBlastBhoBHO : public CComObjectRootEx<CComSingleThreadModel>, public CComCoClass<CBlastBhoBHO, &CLSID_BlastBhoBHO>, public IObjectWithSiteImpl<CBlas...

Connection point Iplemetation in Javascript

Hi All, I need to use activeX control with connection point events in html page.I saw some sodes in different sites and most of tham says use this below code <script for="Cntrl1" event="UploadProgress(Data)"> alert(Data); </script> But This is not working. I got this below code from How to handle an ActiveX event in Javascript (Sta...

CoGetClassObject gives many First-chance exceptions in ATL project. Should I worry?

Hello, I have written a COM object that in turn uses a thrid party ActiveX control. In my FinalConstruct() for my COM object, I instantiate the ActiveX control with the follow code: HRESULT hRes; LPCLASSFACTORY2 pClassFactory; hRes = CoInitializeEx(NULL,COINIT_APARTMENTTHREADED); bool bTest = SUCCEEDED(hRes); if (!bTest) r...

C++; Using an array of derived objects as an array of base objects when the sizes are the same (CComVariant/VARIANT)

I'm using code that treats an array of derived objects as an array of base objects. The size of both objects is the same. I'm wondering: Is this safe in practice, bearing in mind that the code will only ever be compiled on Microsoft compilers? Here's my example: BOOST_STATIC_ASSERT(sizeof(VARIANT)==sizeof(CComVariant)); //auto_arra...

Question about making Asynchronous call in C# (WPF) to COM object

Hi, Sorry to ask such a basic question but I seem to have a brain freeze on this one! I'm calling a COM (ATL) object from my WPF project. The COM method might take a long time to complete. I thought I'd try and call it asychronously. I have a few demo lines that show the problem. private void checkBox1_Checked(object sender, Routed...

ATL "Implement interface wizard"

I created ATL COM-server in VC++ 2005. I want to realize some interface defined in some library (*.olb). I know I will see the interface if I #import this olb (in .tlh.tli). But I cannot create stub realization for the interface with "Implement interface wizard" because this interface is absent in "Interfaces" list (both for "Registry" a...

error C2065: 'CComQIPtr' : undeclared identifier

I'm still feeling my way around C++, and am a complete ATL newbie, so I apologize if this is a basic question. I'm starting with an existing VC++ executable project that has functionality I'd like to expose as an ActiveX object (while sharing as much of the source as possible between the two projects). I've approached this by adding ...

How to return an [out] variant with VT = VT_RECORD without creating memory leak in ole32.dll?

Hi, Purify is pointing memory leak in ole32.dll while returning a Variant with VT set to VT_RECORD as OUT parameter. I am using User Marshalling by generating proxy/stub dll from IDL. Can you suggest how to avoid this memory leak? Struct defined in IDL: { BSTR m_sFirst; BSTR m_sSecond; VARIANT m_vChildStruct; //This member encapsulate...