ExecWB command (WebBrowser control) 
Author Message
 ExecWB command (WebBrowser control)

Hi,

Firstly, where do I find information about the arguments to the ExecWB
command ? I can find info that this command exists, and on the printing
part, but no more than that.

Secondly, can anyone can help me with the select all and copy arguments for
the same command ?

Many thanks

Ben Alborough



Wed, 18 Apr 2001 03:00:00 GMT  
 ExecWB command (WebBrowser control)
On Sat, 31 Oct 1998 06:37:06 +0200, "BenA"

Quote:

>Firstly, where do I find information about the arguments to the ExecWB
>command ? I can find info that this command exists, and on the printing
>part, but no more than that.

The command is fairly common with other ActiveX controls, like the
office suite, and a general explanation is available at:

http://msdn.microsoft.com/developer/sdk/inetsdk/help/compdev/active_d...

Quote:
>Secondly, can anyone can help me with the select all and copy arguments for
>the same command ?

Here are a couple of modified procedures from an app I am working
on...they seem to work fine for me, hope they work for you too:

Private Sub mnuSelAll_Click()
        wbBrowser.ExecWB OLECMDID_SELECTALL, _          
        OLECMDEXECOPT_DODEFAULT
End Sub

Private Sub mnuCopy_Click()
        wbBrowser.ExecWB OLECMDID_COPY, _
        OLECMDEXECOPT_DODEFAULT
End Sub

You're gonna need to modify these to fit your code of course(any
logic, etc)  but they seem to work for me.

HTH, and good luck!

Steve



Wed, 18 Apr 2001 03:00:00 GMT  
 ExecWB command (WebBrowser control)
Thanks for the prompt reply Steve,

I went to the site you suggested, and landed up downloading most of the
INetSDK (almost 2 hours).

After reading through most of the documentation, it seems as if us VB guys
are left out of the picture (most of it's geared towards C++, which is Dutch
to me).

The following command works fine for me :
WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER

but as soon as I use any other command such as the ones you suggested, I get
the following error :
Method 'ExecWB' of Object 'IWebBrowser2' failed.

What am I doing wrong ?

If anyone can help, please do.

TIA
Ben Alborough



Wed, 18 Apr 2001 03:00:00 GMT  
 ExecWB command (WebBrowser control)
On Sat, 31 Oct 1998 11:27:53 +0200, "BenA"

Quote:

>The following command works fine for me :
>WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER
>but as soon as I use any other command such as the ones you suggested, I get
>the following error :
>Method 'ExecWB' of Object 'IWebBrowser2' failed.

>What am I doing wrong ?

The only thing that leaps to mind is the second paramater.  You need
to make sure you're using  OLECMDEXECOPT_DODEFAULT instead of
DONTPROMPTUSER

If not, I'm outta ideas, without seeing your code directly.

Steve

Emailed and posted, sice these microsoft groups don't always propogate
so well.



Wed, 18 Apr 2001 03:00:00 GMT  
 ExecWB command (WebBrowser control)
I have a single form with a single WeBBrowser control on it, and a command
button.

Private Sub Command1_Click()
'WeBBrowser1.ExecWB OLECMDID_SELECTALL, OLECMDEXECOPT_DODEFAULT
End Sub

The only commands that work for me are the OLECMDID_SAVEAS, and
OLECMDID_PRINT.

I'm using VB 5.0 Prof. with SP3. I'm beginning to wonder if this problem I
have has something to do with IE4.0 which I'm using, as I haven't seen any
other posts similar to mine and I don't see any reason in code for the
statements not to work.

Anyway, I'll keep the newsgroup informed if I stumble onto a solution as I'm
sure I can't be the only one with this problem.

Thanks again for your help.

Ben Alborough



Thu, 19 Apr 2001 03:00:00 GMT  
 ExecWB command (WebBrowser control)
On Sun, 1 Nov 1998 05:10:57 +0200, "BenA"

Quote:

>Private Sub Command1_Click()
>'WeBBrowser1.ExecWB OLECMDID_SELECTALL, OLECMDEXECOPT_DODEFAULT
>End Sub
>The only commands that work for me are the OLECMDID_SAVEAS, and
>OLECMDID_PRINT.

Hmm.  Odd indeed

Quote:
>I'm using VB 5.0 Prof. with SP3.

Same here.

Quote:
>Anyway, I'll keep the newsgroup informed if I stumble onto a solution as I'm
>sure I can't be the only one with this problem.

Yes.  Please do.  I'd love to know what could be causing the problem.

Sorry I couldn't have been of more help.

Steve



Thu, 19 Apr 2001 03:00:00 GMT  
 ExecWB command (WebBrowser control)


Fri, 19 Jun 1992 00:00:00 GMT  
 ExecWB command (WebBrowser control)
After many hours, the solution was just a mouse click away.

If I load the form, click on the WebBrowser control first, and then the
command button, all the ExecWB commands function.

If I load the form, click on the command button (without clicking on the
WebBrowser control), the ExecWB commands don't function except for the
printing.

It seems as if the users of my app will need to click the WebBrowser control
first before anything else is done, as the setfocus command doesn't achieve
the desired result.

If there is anyone out there who can tell me how to simulate a mouse click
programmatically, my world would be a better place.

Many thanks to Steve.



Fri, 20 Apr 2001 03:00:00 GMT  
 ExecWB command (WebBrowser control)
Have you tried setting the z-order of the WebBrowser control?

Quote:

> After many hours, the solution was just a mouse click away.

> If I load the form, click on the WebBrowser control first, and then the
> command button, all the ExecWB commands function.

> If I load the form, click on the command button (without clicking on the
> WebBrowser control), the ExecWB commands don't function except for the
> printing.

> It seems as if the users of my app will need to click the WebBrowser control
> first before anything else is done, as the setfocus command doesn't achieve
> the desired result.

> If there is anyone out there who can tell me how to simulate a mouse click
> programmatically, my world would be a better place.

> Many thanks to Steve.

--
Mike
Flair Software
DART Chart - Real-Time Charting and Alerts Software
http://www.flairsoft.com


Sat, 21 Apr 2001 03:00:00 GMT  
 ExecWB command (WebBrowser control)
I'm having the same problem with the same error.  Setting the zOrder to
vbBringToFront or using SetFocus don't work?  But, if I click on the web
control, then use the ExecWB it works okay.  What can I do here?

David

Quote:

>Have you tried setting the z-order of the WebBrowser control?


>> After many hours, the solution was just a mouse click away.

>> If I load the form, click on the WebBrowser control first, and then the
>> command button, all the ExecWB commands function.

>> If I load the form, click on the command button (without clicking on the
>> WebBrowser control), the ExecWB commands don't function except for the
>> printing.

>> It seems as if the users of my app will need to click the WebBrowser
control
>> first before anything else is done, as the setfocus command doesn't
achieve
>> the desired result.

>> If there is anyone out there who can tell me how to simulate a mouse
click
>> programmatically, my world would be a better place.

>> Many thanks to Steve.

>--
>Mike
>Flair Software
>DART Chart - Real-Time Charting and Alerts Software
>http://www.flairsoft.com



Sat, 21 Apr 2001 03:00:00 GMT  
 ExecWB command (WebBrowser control)


Fri, 19 Jun 1992 00:00:00 GMT  
 ExecWB command (WebBrowser control)
Hi,

I'm glad to see I'm not the only one with this annoyance.

Setting the ZOrder made no difference here either.

Just for interests sake :

When a form with the WebBrowser control is shown modally (Form1.Show 1), VB
hangs after any print commands sent to the WebBrowser control via ExecWB.

Can anyone else confirm this problem / bug ?

Ben Alborough



Sun, 22 Apr 2001 03:00:00 GMT  
 ExecWB command (WebBrowser control)


Fri, 19 Jun 1992 00:00:00 GMT  
 ExecWB command (WebBrowser control)

Quote:
> If there is anyone out there who can tell me how to simulate a mouse click
> programmatically, my world would be a better place.

It is always a pleasure to make someones world a better place, so here we go

Normally, you can "fake" mouse click simply by sending few messages to the
windows you want to "click". But here is the problem that we don't know the
handle of the window that web browser uses. Or at least I couldn't find any
direct way of obtaining it.

So I managed to compose following code, which is a TOTAL hack. So I don't
recommend anyone to use it, but it works for me.

First you need to create a Picture box or something to set your webbrowser
control in. You should make picture box's size equal to webbrowsers size.

And here's the code

Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal Hwnd
As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function ChildWindowFromPoint Lib "user32" (ByVal Hwnd As Long,
ByVal xPoint As Long, ByVal yPoint As Long) As Long

Sub CopyWebToClip(WebBrow as Object)
    Dim I As Long
    'Does WBs work?
    If WebBrow.QueryStatusWB(OLECMDID_SELECTALL) = 0 Then
        'Nope. Get hwnd for container
        I = WebBrow.Container.Hwnd
        'Get 1st Child Window (Shell Embedding)
        I = ChildWindowFromPoint(I, 5, 5)
        'Get 2nd Child Window (Shell DocObject View)
        I = ChildWindowFromPoint(I, 5, 5)
        'Get 3rd Child Window (Internet Explorer Server)
        I = ChildWindowFromPoint(I, 5, 5)

        SendMessage I, WM_LBUTTONDOWN, 0, &HF000F
        SendMessage I, WM_LBUTTONUP, 0, &HF000F
    End If
    'If still doesn't work, give up!
    If WebBrow.QueryStatusWB(OLECMDID_SELECTALL) = 0 Then Exit Sub
    WebBrow.ExecWB OLECMDID_SELECTALL, OLECMDEXECOPT_DODEFAULT
    WebBrow.ExecWB OLECMDID_COPY, OLECMDEXECOPT_DONTPROMPTUSER
    WebBrow.ExecWB OLECMDID_CLEARSELECTION, OLECMDEXECOPT_DONTPROMPTUSER
end sub

Hopefully you find this useful.

 Regards,

 Ville Valpasvuo



Sun, 29 Apr 2001 03:00:00 GMT  
 
 [ 14 post ] 

 Relevant Pages 

1. ExecWB and Zoom: Font Size in WebBrowser Control

2. Help w/ ExecWB method of WebBrowser control

3. Webbrowser-Control: execwb - Parameter [Pvain] (print templates)

4. Webbrowser-Control: execwb - Parameter [Pvain] (print templates)

5. ExecWB method of WebBrowser control

6. How to print custom headers with webbrowser.ExecWB using a SafeArray

7. ExecWB method for clipboard copy with webbrowser

8. WebBrowser.ExecWB & Print

9. WebBrowser ExecWB and OLECMDID_FIND

10. Print command in webbrowser control

11. Webbrowser Control Print command

12. ExecWB and IE 4 Web Control

 

 
Powered by phpBB® Forum Software