Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP can't obtain results from WebBrowser's ExecWB method
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
VFP can't obtain results from WebBrowser's ExecWB method
Divers
Thread ID:
00661392
Message ID:
00661392
Vues:
65
I've run into a problem that appears to be due to a VFP limitation described in Q177575 - PRB: ActiveX Controls Passing Variant Back to VFP Cause Error. Specifically, I'm getting OLE error code 0x80020010: Invalid callee, when I attempt to obtain the browser's current ZOOM setting via ExecWB, whose last argument returns a VARIANT value by reference.

Here are some related threads that lead me to believe this is just one example of a much broader issue:

BSTR and Variant - Thread 484560
From VB to VFP - Thread 594726
Datatyps long and variant needed - Thread 660295

The following series of command lines illustrates how to reproduce the error that I'm seeing under VFP7 SP1, with IE 5.5, under Win2K Pro (SP1):
x = CREATEOBJECT("InternetExplorer.Application")
x.Visible = .t.
x.navigate2('http://www.microsoft.com/')
pvaout = "EMPTY"
x.ExecWB(19, 2, NULL, @pvaout)
I've tried a bunch of variations on the 3rd and 4th arguments, to no avail. (Note that OLECMDID_ZOOM = 19 and OLECMDEXECOPT_DONTPROMPTUSER = 2.) There is no problem with the converse operation of setting the browser's ZOOM state, as opposed to getting it, e.g. by substituting this for the last command:
x.ExecWB(19, 2, 4, 0)
which has the desired effect of zooming to the largest of five available font size choices, i.e. the same as View, Text Size, Largest in Internet Explorer's menu.

Can anyone confirm (or refute) this problem, or suggest a simple workaround? If there is no way around it in VFP, maybe the best solution would be to use VB6 to create a DLL that contains a simple wrapper function for ExecWB, whose purpose is to provide a VFP-callable flavor of ExecWB that returns its result (pvaout) in a more VFP-friendly form, e.g. a character string or flavor of number. I suppose the same sort of gimmick could be used for other COM functions that can't be used directly from VFP, providing that one can pass the COM object reference as an input argument to the VB DLL. Does this sound reasonable?

Now that I've installed VB6, I'd be glad to try creating such a DLL, but I haven't yet got a clue where to begin. If anyone would care to give me some help getting started (and confirming that I understand this correctly), I'd be very appreciative. I'll make the results (VB source code + DLL) available to all.

Mike
Montage

"Free at last..."
Répondre
Fil
Voir

Click here to load this message in the networking platform