WebBrowser ActiveX control
Posted: Sat Jul 15, 2006 7:17 pm
I'm pasting here a private msg I sent to Antonio so our discussion can be shared. If anyone else has customized the Shell.InternetExplorer control, I'd love to hear your input.
After much searching in vain on MSDN for docs, Antonio helped me realize the magic keyword is WebBrowser. Here's the link to their docs:
http://msdn.microsoft.com/library/defau ... rowser.asp
Antonio also shared with me his trick to use the Word VBA editor to use their object inspector. What I had not done before is use the Form designer to access all the MS controls; that's where you'll find properties for "Microsoft Web Browser" or something similar. Its name changes with different versions and it appears alphabetically in different places
Here are my hopes for more features:
Meanwhile, there's one Event handler that doesn't seem to be working right. If I can get that, I can use html as a major GUI presentation for all kinds of things
The idea is: How to have the App take actions based on clicks in the webBrowser.
Since BeforeNavigate2() provides the target URL, I could inspect that and do any desired action, including according to the MS docs cancel that navigation. But the trace of params for it shows 7 blank lines and then a number (I presume a pointer), then another 7 blank lines.
Event: BeforeNavigate2
Params:
1798272
...
The MS docs indicate there should be 7 args, and the second one is the URL
Private Sub object_BeforeNavigate2( _
ByVal pDisp As Object, _
ByRef Url As Variant, _
ByRef Flags As Variant, _
ByRef TargetFrameName As Variant, _
ByRef PostData As Variant, _
ByRef Headers As Variant, _
ByRef Cancel As Boolean)
I understand the Variants can make things tricky for a generic routine in your C code to capture, but if there's a way your (or I) could get these accurately it would help a lot.
But then there's the tricky part
The 7th arg "Cancel" is intended to be used "ByRef" to return True to cancel the navigation.
Is there any chance of that value ever being returned back from the PRG level through the C structures to Windows?
What I envision for the best design is to inherit from TActiveX to create TWebBrowser and try to handle specifics there. Do you have any mechanism, as VB does, to route specific Events to a specific PRG method?
Can I help make that happen?
Thanks so much for all your work,
--
Brian Hays
After much searching in vain on MSDN for docs, Antonio helped me realize the magic keyword is WebBrowser. Here's the link to their docs:
http://msdn.microsoft.com/library/defau ... rowser.asp
Antonio also shared with me his trick to use the Word VBA editor to use their object inspector. What I had not done before is use the Form designer to access all the MS controls; that's where you'll find properties for "Microsoft Web Browser" or something similar. Its name changes with different versions and it appears alphabetically in different places
Here are my hopes for more features:
Meanwhile, there's one Event handler that doesn't seem to be working right. If I can get that, I can use html as a major GUI presentation for all kinds of things
The idea is: How to have the App take actions based on clicks in the webBrowser.
Since BeforeNavigate2() provides the target URL, I could inspect that and do any desired action, including according to the MS docs cancel that navigation. But the trace of params for it shows 7 blank lines and then a number (I presume a pointer), then another 7 blank lines.
Event: BeforeNavigate2
Params:
1798272
...
The MS docs indicate there should be 7 args, and the second one is the URL
Private Sub object_BeforeNavigate2( _
ByVal pDisp As Object, _
ByRef Url As Variant, _
ByRef Flags As Variant, _
ByRef TargetFrameName As Variant, _
ByRef PostData As Variant, _
ByRef Headers As Variant, _
ByRef Cancel As Boolean)
I understand the Variants can make things tricky for a generic routine in your C code to capture, but if there's a way your (or I) could get these accurately it would help a lot.
But then there's the tricky part
The 7th arg "Cancel" is intended to be used "ByRef" to return True to cancel the navigation.
Is there any chance of that value ever being returned back from the PRG level through the C structures to Windows?
What I envision for the best design is to inherit from TActiveX to create TWebBrowser and try to handle specifics there. Do you have any mechanism, as VB does, to route specific Events to a specific PRG method?
Can I help make that happen?
Thanks so much for all your work,
--
Brian Hays