0
votes

I have an OCX control written in C++ and built with VS2010. The host application for the control is a VB6 ActiveX EXE. I am trying to figure out how to debug the OCX control in VS2010. Normally to debug an OCX control you put in the host application that embeds the control into the OCX control's Properties:Debugging:Command field. When I enter the VB6 Host program's EXE and try to start debugging it gives me the following alert boxerror alert

I'm suspecting that the VB6 debug information is not compatible with VS2010. I don't actually need to debug the VB6 ActiveX EXE in this case. (I can do that from VB6 dev enviroment). But I've tried clicking yes to the above dialog and the OCX control runs outside the debugger as it ignores any breakpoints I've set. How do I get the OCX control to run under the debugger?

I've looked at this similar question but it seems a slightly different scenario as it sounds like all the OCX controls this case were in VB6. It talks about setting "Binary Compatibility" for the OCX control but I believe that only applies to VB6 environment and not to C++ under VS2010.

Also is there a way to generate debug info for VB6 ActiveX EXE that is compatible with VS2010 debug environment?

2
ocx is compiled. Its also saying the symbols file was not included. GOOD LUCKMichaelEvanchik
the other question you are referencing is the OCX is just a reference in a VB project source code. You have nothing but the compiled ocx. Big differenceMichaelEvanchik
@MichaelEvanchik No I have the source to the OCX (C++) and I'm running from the VS2010 development environment where the OCX control is built. But the debugger requires it to be started with the application that is hosting the OCX control. I am starting the debugger from the Debug version of the OCX control in VS2010 but specifying the VB6 as the debug start command. It's the VB6 program "SigToolESIDevice2018.exe" that the alert is complaining about not having debug info not the C++ OCX control.JonN
It depends on what you want to do, WinDbg is the Windows debugger. You can debug anything but it's not like the IDE. As code goes it limited. developer.microsoft.com/en-us/windows/hardware/download-windbgACatInLove
@ACatInLove So are you saying it is not possible to use the VS2010 IDE debugger to debug OCX control when the container is a VB6 ActiveX EXE? If that's true then I'm looking at using the sample TSTCON test container which is described here blogs.msdn.microsoft.com/vcblog/2010/03/18/… and here msdn.microsoft.com/en-us/library/f9adb5t5(VS.100).aspxJonN

2 Answers

1
votes

After some more exploration I found that it is possible to do what I initially asked in my original post.
While the VS2010 debugger doesn't automatically attach to the OCX control when started via the VB6 ActiveX EXE container, it is possible to attach to the OCX control manually. It is in fact possible to be running the container ActiveX EXE in VB6 debugger and simultaneously running the OCX control in VS2010 debugger. Here's the sequence

Start VB6 development environment with the ActiveX EXE project. Start execution of the ActiveX EXE in debug mode. Now start the VS2010 development environment and select menu item Debug:Attach to Process... and then select the VB6 process as the one to attach to. Now breakpoints in the VB6 app will route to the VB6 debugger and breakpoints in the OCX control will route to VS2010 debugger.

If you don't need to debug the VB6 ActiveX EXE you can specify it as the start Command for the VS2010 OCX control and then do the Attach to Process after it starts although using VB6 development environment insures that you can catch breakpoints in the OCX control at startup.

0
votes

I have been able to debug OCX control, but the only way I found is to use the TSTCON sample program I gave in the links (TSTCON Still Available and TSTCON Info) in previous comment. I added TSTCON and TCProps as projects to the VS2010 solution with the OCX Control and then specified TSTCON.exe as the debug Command line. Doing this I am able to break point in the OCX control. Starting debug on OCX control will start TstCon. Then when TstCon app starts right click on content area and select "Insert New Control" and select the OCX control from the list of all registered OCX controls. Be sure to select Linker:Register Output:Yes for the OCX Control project. The control will initialize and then any methods can be invoked and parameters specified via the TstCon app menu Control:Invoke Methods...