After spending lots of time in the debugger, looking at the execution of the
OCX, I have found the cause, but not the fix.
The OCX acts as a wrapper to an array of more complicated objects, when each
child object is created, it is given a CWnd pointer to its parent (the OCX).
The CWnd class has a pointer named m_hWnd which refers to the parent/window
of the OCX, this value is null whenever I run the OCX through my C# app. Of
course, when I do so in the VB app, it is non null.
Googling for a fix to this has proven fruitless. Knowing what I know now...
what should I try short of manually passing down a handle from the form as
set at runtime?
[quoted text, click to view] "Brendan Grant" wrote:
> I have an old custom written ActiveX control, written in VC++6 that I am
> trying to use on a Windows form with C# (and also VB.NET for testing).
>
> I add the control to the toolbox using the standard ‘add/remove items’
> option, and everything proceeds fine. As does adding the control to the form.
> For the most part I seem to be able to call all of my functions properly
> (there are some oddities which are defying debugging for now, however I
> expect to track them down just as soon as I have the events working).
>
> The problem currently is the events. No matter how I may add an event
> handler to an event on the control, a call never reaches my handler.
>
> What really gets me, is that using the OCX in VB6 works fine, however when I
> put an AX wrapper around it for use in .NET, it doesn’t want to talk back.
>
> I also have seen this issues with another custom OCX that I imported via the
> same method described above, I can call all of it’s functions, however none
> of it’s events are ever fired despite their being triggered.
>