December 18th, 2004, 11:13 AM
Visual C++ Debugging: How do I debug my ActiveX/COM component?
Q: I have developed an COM component/ActiveX control in VC++. Now I want to Debug this component/control. How can I do this?
A: If you have an ActiveX control, it can be tested in its container application (ActiveX Test Container, Visual Basic...). But if you want to debug it as you do any other normal application in VC++, you need to debug the executable (an EXE).
There are several ways (specific to VC6):
Now the container application (VB6.EXE) is being debugged by VS6 (including other binary loads, DLLs, OCXs...).
- Start the container application (for instance Visual Basic).
- Open Visual Studio, Load your project (ActiveX, COM or any other DLL project you want to debug).
- Place the necessay breakpoints in your project. You can also place DebugBreak API or 'ASSERT(FALSE)' macro to the place from where you want debugging.
- Launch 'Attach to Process' dialog box through 'Build ->Start Debug -> Attach to Process' menu option.
- Here select the container application you started, in which you want to test your object. (VB6.EXE, as per example case I mentioned).
- Now in container application, place the ActiveX control or create the instance of COM object, if it is not ActiveX control.
- Test the control by running application. (The form application, if VB used).
For the DLL you want to debug, set the container application's EXE path (in which you'll be using your component) to 'Executable for Debug Session' in 'Linker' settings.
Last edited by Andreas Masur; July 25th, 2005 at 02:18 AM.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.