Help: Events on ActiveX documents: WebBrowser control: WithEvents 
Author Message
 Help: Events on ActiveX documents: WebBrowser control: WithEvents

->Well, I talked with Microsoft support and they gave me the following
->workaround  "Use the Win32 MessageBox API .... we've heard of
problems
->with using MsgBox() in event handlers."  Seems kind of weird to me,
but
->it did eliminate the problem.

Unfortunately MsgBox was designed to suspend all events in a Visual
Basic app while active. But what I suspect is causing the problem is
the fact that the MsgBox function displays a modal window and that I
don't believe that you can't display modal windows from an ActiveX
Document.

Paul
~~~~



Tue, 15 Feb 2000 03:00:00 GMT  
 Help: Events on ActiveX documents: WebBrowser control: WithEvents

Hi Paul, BTW, are we related?

As it turns out, Microsoft has acknowledged that this one is a bug in
the VB5 Service Pack 2.  As soon as I uninstalled SP2, the problem went
away.  I may be wrong here, but think the issue with ActiveX documents
and dialog boxes was actually the display of *modeless* dialogs.  Thanks
for your response.

Tom

Quote:


> ->Well, I talked with Microsoft support and they gave me the following
> ->workaround  "Use the Win32 MessageBox API .... we've heard of
> problems
> ->with using MsgBox() in event handlers."  Seems kind of weird to me,
> but
> ->it did eliminate the problem.

> Unfortunately MsgBox was designed to suspend all events in a Visual
> Basic app while active. But what I suspect is causing the problem is
> the fact that the MsgBox function displays a modal window and that I
> don't believe that you can't display modal windows from an ActiveX
> Document.

> Paul
> ~~~~




Tue, 15 Feb 2000 03:00:00 GMT  
 Help: Events on ActiveX documents: WebBrowser control: WithEvents

->Hi Paul, BTW, are we related?

Hmmm... if so it would probably be distant. I can check with my father
since he's been working on a family tree over the past couple of
years. Our name isn't uncommon.

->
->As it turns out, Microsoft has acknowledged that this one is a bug
in
->the VB5 Service Pack 2.  As soon as I uninstalled SP2, the problem
went
->away.  I may be wrong here, but think the issue with ActiveX
documents
->and dialog boxes was actually the display of *modeless* dialogs.  

Interesting. Perhaps I have it backwards. I had assumed that IE
handled the displaying of modal windows.

Paul
~~~~



Sat, 19 Feb 2000 03:00:00 GMT  
 Help: Events on ActiveX documents: WebBrowser control: WithEvents

Just to add my 2 cents...

Getting a UserDoc to display modal windows isn't a problem.  Heck, you can
include forms in the project and display those modal if you like; I do all
the time.  The problam is the sharing of private objects (like the
CommandButton) between the two sides.  VB doesn't like this.  My coworker
and I found a workaround, though still a troublesome one.  It goes
something like this:

1.  In the test app, add a class module.  It should have one method and one
event.  The method:
        Public sub LaunchEvent(byref MyVariant as Variant)
                RaiseEvent ObjectEvent(MyVariant)
        End sub
The event:
        Event ObjectEvent(byref MyVariant as Variant)

declare an instance of this class WithEvents

2.  Put a method in the UserDoc:
        Public Sub EventLauncher(byref MyLauncher)
                set <your private variable here> = MyLauncher
        end sub

3.  When you need to pass information from the doc, call
        <your private variable here>.LaunchEvent <whatever data or object you wish
to pass>

4.  Back on the app side, you'll have your handler code:
        private sub <class instanc>_ObjectEvent(byref MyVariant)
                ...blahblahblah...
        sub
(Make sure your code knows how to handle any possible passes)

We usually pass strings, asnd send them through a select case to determine
what needs to be done.  However we have also passed Database object,
Recordset objects, Fonts, etc.  You can weed these out with If TypeOf
MyVariant is Database, etc.

problem:  VB has no problem with this when compiled, but doesn't like it if
the UserDoc is in debug mode, and will often crash.  The App can be in
debug, though.

problem:  You have to make absolutely sure you don't try to launch an event
before the private variable is set on the UserDoc side.  We handled this
using the webbrowser control DownloadComplete and NavigateComplete events
to determine when to call webbrowser.document.EventLauncher
Note that these events don't always occur in the same order.

Hop that helps.

Patrick Beaudette & Chris Musson



Quote:

> ->Hi Paul, BTW, are we related?

> Hmmm... if so it would probably be distant. I can check with my father
> since he's been working on a family tree over the past couple of
> years. Our name isn't uncommon.

> ->
> ->As it turns out, Microsoft has acknowledged that this one is a bug
> in
> ->the VB5 Service Pack 2.  As soon as I uninstalled SP2, the problem
> went
> ->away.  I may be wrong here, but think the issue with ActiveX
> documents
> ->and dialog boxes was actually the display of *modeless* dialogs.  

> Interesting. Perhaps I have it backwards. I had assumed that IE
> handled the displaying of modal windows.

> Paul
> ~~~~




Tue, 22 Feb 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Hosting a WebBrowser Control Inside ActiveX Document or ActiveX Control to be Ho

2. WebBrowser Control and detecting last document complete event

3. WebBrowser Control and detecting last document complete event

4. WebBrowser control doesn't terminate in ActiveX document

5. Accessing ActiveX Documents from the WebBrowser control?

6. Opening ActiveX documents to WebBrowser control

7. WebBrowser control doesn't terminate in ActiveX document

8. Webbrowser control generates GPF when used in a activex document

9. Accessing ActiveX Documents from the WebBrowser control?

10. Help need to get XML Document from WebBrowser Control

11. Bug in Q311284 sample for webbrowser control events - please help

12. WebBrowser in ActiveX Document?

 

 
Powered by phpBB® Forum Software