How to get ATL support into an existing Windows application
Asked Answered
L

1

6

I'm building an application using Qt 5.3.1 in Visual Studio 2012. I also want to use a hardware library which requires me to add a simple ATL object to the project. This can be done by using a Visual Studio wizard. The wizard complains that my project is neither an MFC executable nor an MFC DLL with full ATL support.

My question is: How can I add this support to my application? In the project properties I configured the project to link to the ATL and use the MFC. It did not work. Both statically and dynamically.

If there's another solution in order to add a simple ATL object to the project, please let me know.

Lepage answered 6/8, 2014 at 15:13 Comment(3)
What do you mean by "which requires me to add a simple ATL object to the project"?Montagu
@SimonMourier I need to use COM objects. The software documentation tells me that I should use an ATL object in order to receive events from the hardware interface.Lepage
ATL is not required to use COM. It is merely a convenience. Since Qt is extremely hostile to other libraries you might want to evaluate the possibility to use COM without a helper library.Wilburwilburn
S
6

The wizard which adds ATL support works on source code of the C++ project, including both checking if the current code is already ATL project, whether the project is okay for adding ATL support to, and code modification per se.

If the wizard "does not like" something in your project it displays an error which basically means that the wizard does know how to safely modify your source code. It does not however mean that adding ATL support is impossible. And enabling an option in project settings is insufficient since source code needs some explicit initialization stuff.

The best you can do to add ATL support without thinking too much about it, is to create a new empty project that matches the project type you currently have, e.g. MFC application. Then take a snapshot of source code, then add ATL support using the wizard. Then compare changes and duplicate them on your real project. The same applies to next step of adding ATL Simple Object using Visual Studio wizard.

Some relevant links (even though the method above looks the easiest to me):

Simmons answered 6/8, 2014 at 15:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.