Debugging an OCX (plugin )in VB
Hi,
I have a COM exe written in VC++. This exe calls and loads a COM dll written in VC++. This dll calls and loads a ocx written in VB 6.0. The COM dll merely uses CreateControlEx () method to create the ocx.
Everything so far is good and smooth. The whole application workd fine.
My problem is I cannot step thru the VB ocx code to debug. I selected the option "wait for components to be created" in the project properties of VB ocx . I opened the COM dll (VC) code and VB 6.0 code side by side . I put some break points in both the projects. I am smoothly able to step through the COM dll VC code. I expect that as soon as I reach into the CreateControlEx method of the VC code, I should step into the VB code in the usercontrol_initialize() event .
But this does not happen. The createControlEx returns an error saying class not registered.
Now I manually registered the ocx several times...but I still get the same error.
And this problem is only during debug step through. If I run the exe directly everything is fine.
The only was I am able to debug my ocx currently is by putting msgboxes/ logs in the code and inspecting the log file regularly to see the values of the variables changing.
I would appreciate if someone can tell me a way by which I am able to step into my VB ocx code.
Thanks,
[1377 byte] By [
qa_tarzaan] at [2007-11-19 1:52:36]

# 2 Re: Debugging an OCX (plugin )in VB
Typically what I do is to have the OCX project added to the application group
But both projects are in different environments. The ocx project is in VB6.0 and the COM dll which creates a container and loads the ocx is in VC 7.0 (managed code ).
What I tried is as follows :
I opened the VC code in the IDE and tried to add the vbp (VB6 ocx project) to the solution, but since the development env is Studio.net, it is asking me for a forced upgrade to VB.net which I cannot do.
Let the help/ideas keep pouring..thnx
# 4 Re: Debugging an OCX (plugin )in VB
I think what Wiz was talking about is to create a VB project that emulates you .dll. Then put both project in a project group. That way you can watch what happens when you set the properties of you .ocx.
I can do that but it will not serve my purpose because the ocx recieves parameters from the COM exe. The COM dll is kind of a wrapper over the OCX. It sits in between the COM exe and the OCX.
The COM dll has 2 main functions :
1) Create a container window and host the ocx......... The container window itself is attached to a property sheet/page on the COM exe UI.
2) Pass function calls between the COM exe and the OCX ............and that is what exactly I want to debug and step through...the function calls and the parameters coming to the OCX from the COM exe...
Thanks
# 5 Re: Debugging an OCX (plugin )in VB
I was wondering if that is what you have been trying to do. The compiled OCX cannot be debugged like that once compiled. Perhaps if there's a specific issue, you can address that here, but otherwise I'm guessing you're sorta stuck. If there are issues with the other components, you'd probably do better in the VC++ forum I guess.