Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to print from a WebBrowser control - Q156732 not enough
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Internet applications
Title:
How to print from a WebBrowser control - Q156732 not enough
Miscellaneous
Thread ID:
00023525
Message ID:
00023525
Views:
68
Microsoft's Knowledge Base article Q156732 supposedly gives the answer to this question, but not in terms that I can easily apply to VFP. It describes two possible methods: the first is a specialized gimmick that entails setting focus and issuing a Ctrl+P, the second approach gets into API calls. I'm more interested in a translation into VFP of the second method, because the first is less general, and besides, it doesn't work in VFP, as far as I can tell.

It seems that when a WebBrowser control has the focus, it uses its own keyboard buffer, so any KEYBOARD command issued via VFP is futile - the browser control doesn't see it. Similarly, any ON KEY LABEL... or VFP menu-based hot keys appear to be inoperative when the browser control has the focus.

Anyway, even if I could solve the Print problem with KEYBOARD, what I'm really after is the more general problem of getting to ALL of the other ways of controlling a WebBrowser object that have no corresponding PEMs visible to VFP. I gather that this is doable via DECLARE - DLL stuff, but I have yet to see a single comprehensible example in VFP terms. It would be mighty instructive to see a translation of the Q156732 example into VFP code!

Excerpt from Q156732:

// DOCOBJ.H comes with the ActiveX SDK and is installed by default in
// the "\INetSDK\Include" directory
#include

void CAboutDlg::OnPrint()
{
LPDISPATCH lpDispatch = NULL;
LPOLECOMMANDTARGET lpOleCommandTarget = NULL;

lpDispatch = m_ctlWebBrowser.GetDocument();
ASSERT(lpDispatch);

lpDispatch->QueryInterface(IID_IOleCommandTarget,
(void**)&lpOleCommandTarget);
ASSERT(lpOleCommandTarget);

lpDispatch->Release();

// print contents of web browser control
lpOleCommandTarget->Exec(NULL, OLECMDID_PRINT, 0, NULL,NULL);

lpOleCommandTarget->Release();
}

Should I use the object.Document property instead of GetDocument?

Is SHDOCVW.DLL the one that should be specified in DECLARE - DLL statement(s)?

How do I declare and use these functions, which are being invoked with a pointer->function(...) syntax in the example above? Other examples that I've seen in VFP's Solution.APP don't use this construct.

Any help on this would be greatly appreciated.
Montage

"Free at last..."
Reply
Map
View

Click here to load this message in the networking platform