atl

Why the option to use attributes in new ATL projects was removed from Visual Studio 2008?

This is the text from MSDN comment: "According to the book ATL Internals (2ed) the use of attributes is deprecated and should not be used in new ATL projects." But WHY?!! ...

Under what circumstances does Internet Explorer fail to properly unload an ActiveX control?

I'm running into a perplexing problem with an ActiveX control I'm writing - sometimes, Internet Explorer appears to fail to properly unload the control on process shutdown. This results in the control instance's destructor not being called. The control is written in C++, uses ATL and it's compiled using Visual Studio 2005. The control i...

How to add WTL and ATL to visual studio c++ express 2008

I start using the visual studio c++ express 2008 at home but there is no ATL in it. How can I add ATL to visual studio c++ express 2008? ...

Firing COM events in C++ - Synchronous or asynchronous?

I have an ActiveX control written using the MS ATL library and I am firing events via pDispatch->Invoke(..., DISPATCH_METHOD). The control will be used by a .NET client and my question is this - is the firing of the event a synchronous or asynchronous call? My concern is that, if synchronous, the application that handles the event coul...

How do I write a for loop that iterates over a CAtlMap selectively deleting elements as it goes?

I'm trying to do the following without too much special case code to deal with invalidated POSITIONs etc: What's the best way to fill in the blanks? void DeleteUnreferencedRecords(CAtlMap<Record>& records) { for(____;____;____) { if( NotReferencedElsewhere(record) ) { // Delete record _______; } ...

Does ATL/WTL still require the use of a global _Module variable?

I'm just starting up a new ATL/WTL project and I was wondering if the global _Module variable is still required? Back a few years when I started working with WTL it was required (at least for ATL 3.0) that you define a global variable such as: CAppModule _Module; To get ATL to work correctly. But recently I've read somewhere that th...

Code for checking write-permissions for directories in Win2K/XP

Greetings! I am trying to check directory write-permissions from within a Windows MFC/ATL program using C++. My first guess is to use the C-standard _access function, e.g.: if (_access("C:\mydir", 2) == -1) // Directory is not writable. But apparently on Windows 2000 and XP, _access can't determine directory permissions. (i.e. the...

Why can't I find a Control ID in my Resource file in ATL?

Since I need to do some checks depending on which control is on focus in my app, I am getting the focused control ID like this: HWND controlOnFocus = ::GetFocus(); int controlID = ::GetDlgCtrlID(controlOnFocus); I am getting consistent IDs, but I can't find them in the resource file! Can I rely on the IDs I am getting or what? Any he...

calling Axis2 web service from ATL C++ client

I have a simple POJO web service published with Axis2 on Tomcat5.5 I try to consume it with ATL C++ client and it fails. Doing the same with a C# client works. The problem is that ATL client sends soap body which looks like <soap:Body>< xmlns="http://fa.test.com/xsd"&gt;&lt;/&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt; Notice the in...

How to get a DIB implemented in a C++/COM library into a .NET client using that COM object

We have a COM object implemented with C++/ATL that includes a method which will return a DIB. We are also writing a .NET application that will use this COM object. Since we are writing both, we have the liberty of deciding how best to return this DIB from the COM object. To clarify, would it be best to return a native windows handle t...

Atl service not registering

I'm trying to register an atl service using ExeName.exe /service as described here: http://msdn.microsoft.com/en-us/library/74y2334x(VS.80).aspx After doing so though, it's not appearing in my services control panel (the one that I get to by typing Services in the start box on vista). I've tried to dig through the atl code to see whe...

How to prevent a new window from opening in hosted Internet Explorer

I'm hosting an Internet Explorer instance (the Web Control) in an CAxWindow ATL class. How do I prevent that a website could open a new window from the hosted IE? I'm already setting an implementation of IDocHostUIHandlerDispatch to disable the context menu. ...

How to make an ATL COM class derived from a base class?

The "ATL simple object" wizard doesn't provide a way to specify that a new class is derived from an existing coclass and its interface. In Visual Studio 2008, how do I make a new ATL COM class derived from an existing one (i.e. Base implements IBase, and I want to make a new Derived class derived from Base that implements IDerived, where...

In what situations is the ATL CSimpleArray a better choice than CAtlArray

The documentation says that CSimpleArray is for dealing with small numbers of objects. What is small in this context? Is CSimpleArray ever a good choice or should I always use a different collection class such as CAtlArray? ...

BEGIN_MSG_MAP_EX breaks Visual Studio 2005 intellisense?

I have a C++ application using WTL/ATL BEGIN_MSG_MAP_EX macros for message handling. I use some macros from atlcrack.h. When we upgraded the projects to Visual Studio 2005, intellisense acts crazy. I've tracked the behavior down to the BEGIN_MSG_MAP_EX macro not behaving correctly with intellisense. However, I can not find a way to cont...

Windows service shut down

I use VS6 and ATL with CServiceModule to implement a custom windows service. In case of a fatal error service should shut itself down. Since CServiceModule is available via _Module variable in all files I thought of something like this to cause CServiceModule::Run to stop pumping messages and shut itself down PostThreadMessage(_Module.d...

Why is my WM_UNICHAR handler never called?

I have an ATL control that I want to be Unicode-aware. I added a message handler for WM_UNICHAR: MESSAGE_HANDLER( WM_UNICHAR, OnUniChar ) But, for some reason, the OnUniChar handler is never called. According to the documentation, the handler should first be called with "UNICODE_NOCHAR", on which the handler should return TRUE if you...

How do I get the HWND for an ActiveX control after the control has been initialised/activated?

I am creating an ATL 8.0 based ActiveX control in C++ using Visual Studio 2008. I need to create a sub-window and attach it to the ActiveX control. How do I get access to the HWND that is owned by the ActiveX control? Which ATL function can I override in order to use the HWND after the control's window has been created? ...

C++ ATL Member Variable access help

I am not familiar with this, and can use a kick start. I am using ATL (unmanaged C++) user control and would like to use the ShockWave ActiveX object. I need to know how to declare it so that I can set a property or call a method. For instance, if I could assign a variable to it, then I would like to call 'variable->LoadMovie()' I kno...

Client won't talk to ATL Service

I'm having a problem with an ATL Service that exports a COM object. It works running as a local service, but when running as a Windows Service, I can't connect. The service starts correctly and runs, but my client (code below) always fails with the error "Failed to start service". So we're looking at the same thing, I've put together a ...