Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / June 2005

Tip: Looking for answers? Try searching our database.

Missing events from ActiveX OCX's

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brendan Grant - 01 Jun 2005 00:12 GMT
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.

Anyone have any thoughts as to what the cause might be or how to resolve it?
Brendan Grant - 01 Jun 2005 22:02 GMT
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?

> 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).
[quoted text clipped - 16 lines]
>
> Anyone have any thoughts as to what the cause might be or how to resolve it?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.