jcwiatr
asked on
VB6.0, get the handle of an activex control on a form
Hello,
I have a form with an ActiveX control on it for a html editor window. The activex control does not have an inbuilt hWnd property.
How do I find the handle of thso control so I can pass it to a spellchecker etc that requires the handle.
Code samples would be appreciated.
Thank-you.
I have a form with an ActiveX control on it for a html editor window. The activex control does not have an inbuilt hWnd property.
How do I find the handle of thso control so I can pass it to a spellchecker etc that requires the handle.
Code samples would be appreciated.
Thank-you.
have you tried iterating through the CONTROLS collection? If not mistaken, most controls should have an hwnd property.
Dim ctlThing As Control
For Each ctlThing In Me.Controls
If ctlThing.Name = "the activex control you are seeking" Then
Debug.Print ctlThing.Name, ctlThing.hWnd
End If
Next
ASKER
hi aikimark - sounds easy - on testing the statement -
For Each ctlThing In Me.Controls
generates an error on me.controls..
method or data method not found
For Each ctlThing In Me.Controls
generates an error on me.controls..
method or data method not found
ASKER
aikimark, my mistake, i got it working and am getting the name of the control but when I add, ctlThing.hwnd I am getting the error Object does not support this property or method. This makes sense I guess given there is no internal hWnd for this control. I will give the API calls a go.
Can you upload your userform?
Sid
Sid
Also what type of control is it?
Sid
Sid
ASKER
just a basic form at this stage with an ActiveX control pinedit.ocx which is a html editor control. I need the handle so I can bind a spell checker to it.
I have uploaded the form and control. The file pinedit.txt in the archive needs to be renamed to pinedit.ocx and registerd.
Cheers. Form1.zip
I have uploaded the form and control. The file pinedit.txt in the archive needs to be renamed to pinedit.ocx and registerd.
Cheers. Form1.zip
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I wonder if the ActiveX control is merely a container and might not be capable of handling messages, so doesn't have hWnd.
Yeah, seems like it is. It definitely has IE in it.
Sid
Sid
ASKER
Thanks guys. I think you are right about the container. Points awarded based on code to get the handle. But I dont think i will be able to bind our spellchecker to it because of its internals.
Thanks for all the input.
Thanks for all the input.
If you are unable to do it then upload the form.
Sid
ps: If you are an API fan like me, then I would suggest you to bookmark this page :)
http://allapi.mentalis.org/agnet/apiguide.shtml