atl

IDL in ATL/COM: Can I publish a const of a complex type?

I know how to publish a const of a simple type in IDL, for example: const long blah = 37 But I want to publish consts of complex types, with methods, or at least readable struct-like member fields. For example, perhaps a type called CarType, which has accessor fields like "get_Make", "get_Model", "get_Year", "get_BasePrice", et ceter...

ATL, focus/activation and CDialogImpl

I'm trying to create a date-picker-like control using ATL which derives from a combobox. The idea being that I trap the CBN_DROPDOWN message and display a dialog containing (among other things) a calendar control. The dialog class is derived from CDialogImpl and just uses a dialog resource, e.g. IDD_DIALOG1 DIALOGEX 0, 0, 112, 94 STYLE ...

Warning C4251 when building a DLL that exports a class containing an ATL::CString member

I am converting an ATL-based static library to a DLL and am getting the following warning on any exported classes that use the ATL CString class (found in atlstr.h): warning C4251: 'Foo::str_' : class 'ATL::CStringT' needs to have dll-interface to be used by clients of class 'Foo' I am correctly declaring the Foo class as exp...

How do I add MFC ActiveX control to an existing activex project.

In visual studio 2008 I can create an MFC activex project and it presents a wizard to create a single activex control. I now want to create new controls within this project. I can't find any way to do this. ...

Creating an ATL COM object that implements a specific interface

I need to implement a simple ATL COM object that implements a specific interface for which I have been given both a .tlb file and a .idl file. The interface is very simple and only consists of a single method. I have created many ATL objects in the past but never one that has to implement a specific interface. What do I need to achiev...

Non-Admin registration of ActiveX Controls

Hi according to Non-Admin ActiveX Controls, it is possible to register activeX under current user (that will not require admin right during the installation). I have crated ATL project (VS2008, native) and added some ATL Control that does nothing. I created an inf file: [version] signature="$CHICAGO$" AdvancedINF=2.0 [Add...

Provide COM objects for JScript

Hello, I need to access a component in JScript. I found the Wcript.CreateObject(progid) as well as "new ActiveXObject(progid)" would create an instance of the component. The component should draw graphics in a own window to show, what the JScript script is doing. The operation systems supported must include Windows XP 32 bit as well a...

Ellipsis do not work for static text in ATL project

Hey folks, I am currently working on an ATL project with a simple UI. In this UI I have a couple of static text controls and I want them to have ellipsis at the end when the text is to long. So I set the word ellipsis property in the designer to true (which also triggers end ellipsis and path ellipsis to true). However during run-time t...

Using STL inside ATL

hi, I need to use tree structure inside a ATL COM server. I thought of using stl::map<> for this purpose as follows. BaseMap[k1,NextLevelMap[k2, NextLevelMap[k3, Value]]] But I need to know, whether using such a structure inside ATL is safe and possibility of debugging support with maps. Thank you ...

CComVariant vs. _variant_t, CComBSTR vs. _bstr_t

I am using ATL (VS2008, so ATL9 IIRC) to create COM objects and have been using the CComVariant class (defined in atlcomcli.h) to manage VARIANT types. However, there is also another VARIANT wrapper called _variant_t. Is there any difference between CComVariant and _variant_t and which one should I be using? Similarly, there are two B...

Dynamic array of COM objects

I have an ATL COM object which needs to expose a collection of other COM objects, so clients can find out how many objects are in the collection (via a simple Count property which I can provide) and access the objects using its index. This collection of objects is dynamic - the count is not fixed - and I don't know how many there will b...

Why is my DCOM client locking on a call to SendMessage?

Running on XP. I have a client that calls calls CoInitializeEx(NULL, COINIT_MULTITHREADED), loads a (local) DCOM object, and attaches an event interface so the DCOM object can send back events. The client looks a lot like notepad with a multi-line textbox covering the client area to display event messages. Here are the calls that create ...

Convert IDispatch* to a string?

I am converting an old VB COM object (which I didn't write) to C++ using ATL. One of the methods, according to the IDL, takes an IDispatch* as a parameter and the documentation and samples for this method claim that you can pass either a string (which is the progid of an object that will be created and used by the control) or an IDispat...

COM deployment dependencies

I have been running in to an issue where a COM dll that I am distributing with my application fails to register because the atl.dll is not registered on the machine. The quick fix is to have the run regsvr32 on the dll, but I want something a little cleaner then that. I don't have much experience with deployment and I was wondering if...

CComSafeArray: Are Indices Really Reversed for MultiDimSetAt and MultiDimGetAt?

In the MSDN documentation for CComSafeArray::MultiDimSetAt, alIndex is documented as follows: Pointer to a vector of indexes for each dimension in the array. The rightmost (least significant) dimension is alIndex[0]. In the documentation for CComSafeArray::MultiDimGetAt, alIndex is documented differently: Pointer to a vector of...

Does CComSafeArray MultiDimSetAt Make a Copy of the Referenced Element?

The CComSafeArray::SetAt method provides a parameter to control whether the referenced variable is copied: HRESULT SetAt( LONG lIndex, const T& t, BOOL bCopy = TRUE ); ... but the CComSafeArray::MultiDimSetAt method does not offer the same parameter: HRESULT MultiDimSetAt( const LONG * alIndex, const T& t ); Two questions: 1.) Is...

error C2065: 'AfxBeginThread' : undeclared identifier

I have a simple ATL Service in which I have included the following statement. AfxBeginThread(WorkerThread, this, THREAD_PRIORITY_NORMAL, 0, 0); But the compiler complains that error C2065: 'AfxBeginThread' : undeclared identifier But in MSDN i found that AfxBeginThread is found in AFXWIN.H If I include AFXWIN.H, the compiler...

How to get HWND of a windowless ATL control?

I created a ATL windows less control and the class definition is like this: class ATL_NO_VTABLE CRSPClient : public IObjectSafetyImpl<CRSPClient, INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACESAFE_FOR_UNTRUSTED_DATA>, public CComObjectRootEx<CComSingleThreadModel>, public IDispatchImpl<IRSPClient, &IID_IRSPClient, &LIBID_a...

How to pass UDT as a parameter with ATL event

hi, I'm trying to pass a UDT as a parameter to a ATL event. IProxy_MyInterface::OnMyATLEvent ([in] MyUDT* pVal); I used the ATL wizard for generating code for the Event. However, in the generated code, the "pVal" is simply assign to a CComVariant. Also, when I compile the code, it shows a warning : warning C4800: 'MyUDT *' : forcin...

Can't call activex methods when the activex is in the same page as flash player

I created a customized ActiveX control and exposed a method called "getDesktopWindows". Then I use the following javascript to call it: var plugin = document.getElementById("myPlugin"); var wins = plugin.getDesktopWindows(); So far everything works just fine. Then I wrapped the code into a javascript function and use a flex application...