Read-only access to Word document in WebBrowser

A

Alexei

I am trying to use the WebBrowser control in VC++/MFC application to view MS
Word documents by calling Navigate(m_sDocFile, NULL, NULL, NULL, NULL);
I want the document to be in read-only mode when it is viewed in the control.
I am trying to use the the DocumentComplete event to get the default
IDispatch interface pointer for the hosted document object but that is where
I get stuck as I have no idea which Word interface I can query to access and
set that property.

Thanks
Alexei

void CWebBrowserTestDlg::DocumentCompleteExplorer1(LPDISPATCH pDisp,
VARIANT* URL)
{
HRESULT hr = S_OK;
IWebBrowser2* pWB = NULL;

hr = pDisp->QueryInterface(IID_IWebBrowser2,
reinterpret_cast<void**>(&pWB));

IDispatch* pDocDisp = NULL;
// get the default IDispatch interface pointer
// for the hosted document object
hr = pWB->get_Document(&pDocDisp);
if (pDocDisp)
{
VARIANT v;
VariantInit(&v);

I????????* pDoc = NULL; // Which Interface should I use here???
hr = pDocDisp->QueryInterface(IID_????????, reinterpret_cast<void
**>(&pDoc));
if (pDoc)
{
// do stuff
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top