views:

552

answers:

2
+1  Q: 

Debug ActiveX

Hello,

I am trying to fix a bug on an ActiveX control. Is it possible to debug it from within Visual Studio 2008?

+1  A: 

You should attach the debugger to the process which loaded the ActiveX component. If the latter has debug information you will be able to debug it as if it was a usual application.

If the host application refuses to load it and you suspect that some code responsible for the ActiveX initialization is broken you can attach to the process in advance and them do the action that will make the host application load the ActiveX.

sharptooth
How do I identify it? I've tried attaching vs to ie but it didn't work...
Sergio
You usually know the executable name. If you have several processes with the same name - just attach to all at the same time.
sharptooth
The process name does not appear even dough i am looking at the list of all processes...
Sergio
Do you use "Debug"->"Attach to process"? In VS2003 there are checkboxes "show processes from all users" and "show system processes". Once you checked them all the processes names are listed. If the porcess is not there it means it has not been started or has already terminated.
sharptooth
Yes I do use that option. In Vs 2008 instead of "show system processes" we have "Show processes in all sessions". Both are checked and i am sure the active x is still running because i have a dialogue box waiting for my input...
Sergio
Ask VS to attach to this process. This should be enough given you have a fresh .pdb file in the same directory as the .dll of the ActiveX.
sharptooth
+2  A: 

If attaching to the process is a problem, just throw a DebugBreak() into the code you wish to debug. If VS is your JIT debugger, once the debug break command is reached you'll be asked whether you'd like to debug the process. Just say yes, and you're in.

eran