Welcome Ninjas. Have you heard of the Active Template Library? Are you curious to learn more about it? Are you confused about the resources? Well, you are at the right place. In this blog, we will begin with the introduction of ATL and then look into the debugging tips for the same. Let us get started!
The active Template library is developed by Microsoft, and it comprises template-based C++ classes ATL simplifies the programming of COM - Component Object Model. ATL can create dialog boxes, Internet explorer controls, etc.
Whenever we find an error in our code, what do we do? Do we sit around and wait for it to resolve itself suddenly? No, instead, we Debug it.
When a program is not functioning correctly or throws up some errors and exceptions, we need to find those errors and fix them so that the program can run. Finding and fixing errors or bugs that we might find in the source codes is called Debugging.
Debugging Tips for ATL
In this blog section, we will look into some common debugging tips for ATL. We have the following main methods used for it:
Using Task Manager
Displaying Assertions
Running the program as a Local Server
Using Task Manager
This is the simplest way to debug an ATL service. Let us see how to do it.
Start the task manager while the ATL service is still running.
Click the Processes Tab.
Then, right-click on the name of EXE and click on the Debug option, which launches Visual C++ corresponding to the running process.
Select Break on the Debug menu to set breakpoints in the code, and then click Run to run your breakpoints.
Displaying Assertions
Next up is Displaying Assertions.
Sometimes, the client connected to the Service stops responding, and the Service asserts and displays a message box, but it may not be visible. Confirm this by using the Visual Studio debugger.
We must follow a series of steps to determine the message that is not visible.
Firstly, open the Service Control Panel Application.
From there, select the option Service, click on Startup and then select the option - Allow Service to interact with the Desktop.
This option allows the message by the Service to be displayed on the Desktop.
Running the program as a Local Server
Instead of running your program as a service, you can temporarily run it on a local server by changing its registry.
Rename the LocalService value to _LocalService under the AppID.
Ensure that the LocalServer32 key under the CLSID is correct.
On Startup, Running your program as a local server takes a little time.
Note that the call to StartServiceCtrlDispatcher in CAtlServiceModuleT::Start takes a few seconds before it fails.
Debugging tool represents a computer program that helps in testing and debugging programs. WinDbg is an example of the same.
What is the difference between Testing and Debugging?
Testing is the process of finding out whether a program is working correctly. While testing, we may come across some errors or bugs. Debugging is what starts next. Once we have encountered bugs or errors, the process of resolving them is known as debugging.
What are breakpoints?
Breakpoints are set while debugging the programs. We set a breakpoint wherever we need to stop or pause the debugger execution. They help in speeding up the debugging process.
Conclusion
Firstly, We hope the blog was easy to understand. This blog discussed the growing template library ATL, followed by the debugging tips.