atl

Modifying decorated names - VS6.0 to VS2005 migration

After a number of hours Googling, I think it's time to ask the experts. We have a legacy module (MS Visual C++ 6.0) that we are trying to port to VS 2005. A number of calling applications exist, so we're trying, if possible, to keep these backward-compatible. Code-wise, this turned out pretty straightforward and a few hours of develop...

Shut down a ATL application cleanly

Hi all, I am a complete newbie to C++ so bear with me ;-) I have developed a console ATL application and want to trap the close?, exit?, terminate? event so that I can close log files and perform a general cleanup on exit. How can I trap the 'terminate' event that would result from someone ending the .exe in the task manager? Appreci...

How do I use OLE-DB to access a dbf file in an COM/C++ ATL application?

I need to access the data contained in a dbf file in COM/C++ application (created via ATL). How would I do that? I've been reading tons of msdn articles very instructive about the OLE-DB provider-consumer model. However, what I need now is a quick tutorial or code sample. Note: I am by no means no expert in COM/ATL programming :) Than...

Pre-registering an ATL window class

I am using a combination of the ATL and WTL for a project and have derived my own class from CWindowImpl, which looks something like this: class CMyControl : public CWindowImpl<CMyControl> { public: DECLARE_WND_CLASS(_T("MyClassName")) ... BEGIN_MSG_MAP(CMyControl) ... END_MSG_MAP() }; This is all good, and if ...

ATL Collection of non-trivial objects

I would like to expose an ATL COM collection of CMainClass objects such that it can be accessed by a C#, VB, or C++ client. I don't have a problem setting up the collection itself, but I don't know how to allow the COM clients access to classes A, B, and C. Should I make A, B, & C COM objects with the ones containing a std::list<> each ...

How to work-around "Object required" error when adding a variable in an ATL Dialog

I'm using Visual Studio .NET 2003 to develop a COM ATL application in unmanaged Visual C++. I've created a ATL Dialag and whenever I try to add a variable for a control the wizard thorws the message "Object required". I've tried the following alternatives: Right click in the control to call "Add variable" from there: this way the wiz...

How to know when the work is done with CThreadPool?

I recently discovered ATL's CThreadPool class and was very happy with this find. It's a neat little class that will take care of the syncronization semantics of having multiple worker threads to process some queue of taks to do. The tasks are fed to the CThreadPool object, by some extrnal process. While being very neat an clean, there d...

What is the best way to transfer error information from worker threads under CThreadPool?

I recently discovered ATL's CThreadPool class and was very happy with this find. It's a neat little class that will take care of the syncronization semantics of having multiple worker threads to process some queue of taks to do. The tasks are fed to the CThreadPool object, by some extrnal process. Now suppose one of the worker threads e...

How to read an XML file in a Visual C++ application?

How to read an XML file in a Visual C++ application? I need to read an XML file in a Visual Studio 2003 C++ COM ATL application - unmanaged code. What library should I use: msxml, xmllite, other? I need to check that the xml satisfies its xsd I've defined and then read it. Sample code welcomed ;) Thanks in advance. ...

_bstr_t to UTF-8 possible?

I have a _bstr_t string which contains Japanese text. I want to convert this string to a UTF-8 string which is defined as a char *. Can I convert the _bstr_t string to char * (UTF-8) string without loosing the Japanese characters? ...

ATL simple object wizard - "Object Xxx already exists" error

I am attempting to create a new COM object in my DLL using the ATL Simple Object Wizard in Visual Studio 2005. I enter the short name for the object, and all of the other fields are derived. However, when I click Next in the wizard, the following error message comes up: Object 'IXxxInterfaceName' already exists I have searched my en...

Internet Explorer crashes when MSXML2::IXMLDOMDocumentPtr -> Release() is called

I am creating a shell extension in C++ (ATL 9) using Visual Studio 2008. The Shell Extension creates a global MSXML2::IXMLDOMDocumentPtr object m_XmlDoc in the module class. This m_XmlDoc is then used in the extension by all classes to read xml document. The problem that I am facing is with Internet explorer. When the Shell Extension is...

How to embed Windows Form in unmanaged ATL GUI?

I have a Windows form user control that is made COM visible. Now I want to embed that control into an ATL dialog GUI. The ATL project (unmanaged C++) shall only get the progID of the winform and dynamically create and embed it at runtime. Is this possible and if so, how do I do it? ...

Returning an object as a property in ATL

I am creating a COM object using Visual Studio 2008 and ATL. Adding simple properties and methods is easy enough but now I want to do something more complicated. I want to give access to a C++ object via a property of my COM object, so I can do something like: // Pseudo-code var obj = CreateObject("progid"); obj.aProperty.anotherPrope...

CBlobCache usage - ATL Server Library

Someone may have an example of use for CBlobCache? ...

Why can't I enter text in Winform hosted in ATL dialog?

I am working on embedding winform controls into an ATL dialog (see here for how I did so far). Now I have encountered a rather strange problem. For some reason, the text fields in my winforms display fine, but I am unable to change the text in them by typing on the keyboard. However, I can copy and paste text from elsewhere into the te...

Finding Container Ancestors from ActiveX control in CComCompositeControl/CAxHostWindow

How can an ActiveX control, created for a CComCompositeControl as part of a resource (.rc) dialog definition, gain reference to the container of the CComCompositeControl? The ActiveX control created in this way is actually contained in a CAxHostWindow instance per this article. I have observed this to be true and have encountered the p...

How do I use WTL in a DLL?

I'm trying to use WTL within an in-process COM server DLL (an IE BHO), but am struggling with _Module. My DLL needs CMyModule derived from CAtlDllModuleT<>: class CMyModule : public CAtlDllModuleT< CMyModule > { public: DECLARE_LIBID(LIBID_MyLib) DECLARE_REGISTRY_APPID_RESOURCEID(IDR_MYPROJ, "{...}") }; CMyModule _Module; ext...

Can't get SAFEARRAY to work with Interop

I have an ATL COM Server, where the method for the interface is STDMETHODIMP CWrapper::RUN(long iDataSize, SAFEARRAY** iData) and the MIDL for this function looks like [id(1), helpstring("method RUN")] HRESULT RUN([in] long nSize, [in, size_is(nSize)] SAFEARRAY(_MyDataType*)* iData); I import the tlb from this project using tlbimp...

DCOM server debug

Hi, I'm learning DCOM and I need to debug a class that I have created, how can I do this? ...