Debugging COM Interface objects
Does anyone know how to see the contents of a COM interface object with the Visual Studio C++ debugger? I hope I'm calling these things the right name.
For example, I have lots of code where I get objects of type IHTMLElement. If I set a breakpoint and try to look at the contents of that object, all I can see is the IDispatch pointer. Pretty useless.
Ironically, while I'm typing code the editor knows what's in each object and can show what methods and attributes are available. Why is this so hard for the debugger?
Is there some trick I can use?
David
Friday, January 23, 2004
Your editor is actually querying the IDispatch interface (or the ITypeInfo interface off of the IDispatch interface) for its implementation details (methods, documentation, parameters, types, etc).
If you just want to be able to query for this information against an active object, I've written a small Lisp interpreter that supports creating/querying OLE objects that I could send you.
K
Friday, January 23, 2004
I think I wasn't clear about what editor I meant. I meant that when I'm writing code, NOT debugging, the autocomplete feature of VS .NET can show me the list of methods and attributes available in the class.
As for a LISP interpreter, you lost me. How would that help me debug?
David
Friday, January 23, 2004
I assume that what you want is to be able to see the methods/properties on an object that supports IDispatch while you're debugging. The debugger doesn't support that, because it involves a lot of work with querying IDispatch and ITypeInfo.
I offered the interpreter so that you could test creating an object, getting it into whatever state you need, and looking at its property values at runtime (since that sounds like what you're trying to do).
K
Friday, January 23, 2004
"I offered the interpreter so that you could test creating an object, getting it into whatever state you need, and looking at its property values at runtime (since that sounds like what you're trying to do)."
I used to use immediate mode in VB a lot for this. Fire up a program with just enough to have a strongly typed interface, then put a break into the code, and start poking the object in the immediate window. Very useful.
Of course, now I'm 100% on .NET, thank god. :)
Brad Wilson (dotnetguy.techieswithcats.com)
Friday, January 23, 2004
Actually a bit more research and I may have found the answer to my own question. Those interface classes (I guess they are OLE Automation interfaces) have no exposed attributes. All they have published methods, including getters and setters. From what I can see in the headers, there aren't even private attributes.
I can see how that would make the debugger show only the IDispatch pointer.
Still, it's pretty annoying, because I know it's an interface to an actual object that holds many attributes. In fact, in Javascript, I can look at the same object and see all of its attributes. So, theoretically, it's possible to do the same thing in C++, but God knows how to do it.
David
Friday, January 23, 2004
David, that's what I said! God's not the only one who knows how to do it (unfortunately).
K
Friday, January 23, 2004
Recent Topics
Fog Creek Home
|