| 633 | } |
| 634 | |
| 635 | HRESULT STDMETHODCALLTYPE DuiLib::CWebBrowserUI::Exec( __RPC__in_opt const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, __RPC__in_opt VARIANT *pvaIn, __RPC__inout_opt VARIANT *pvaOut ) |
| 636 | { |
| 637 | HRESULT hr = S_OK; |
| 638 | |
| 639 | if (pguidCmdGroup && IsEqualGUID(*pguidCmdGroup, CGID_DocHostCommandHandler)) |
| 640 | { |
| 641 | |
| 642 | switch (nCmdID) |
| 643 | { |
| 644 | |
| 645 | case OLECMDID_SHOWSCRIPTERROR: |
| 646 | { |
| 647 | IHTMLDocument2* pDoc = NULL; |
| 648 | IHTMLWindow2* pWindow = NULL; |
| 649 | IHTMLEventObj* pEventObj = NULL; |
| 650 | BSTR rgwszNames[5] = |
| 651 | { |
| 652 | SysAllocString(L"errorLine"), |
| 653 | SysAllocString(L"errorCharacter"), |
| 654 | SysAllocString(L"errorCode"), |
| 655 | SysAllocString(L"errorMessage"), |
| 656 | SysAllocString(L"errorUrl") |
| 657 | }; |
| 658 | DISPID rgDispIDs[5]; |
| 659 | VARIANT rgvaEventInfo[5]; |
| 660 | DISPPARAMS params; |
| 661 | BOOL fContinueRunningScripts = true; |
| 662 | int i; |
| 663 | |
| 664 | params.cArgs = 0; |
| 665 | params.cNamedArgs = 0; |
| 666 | |
| 667 | // Get the document that is currently being viewed. |
| 668 | hr = pvaIn->punkVal->QueryInterface(IID_IHTMLDocument2, (void **) &pDoc); |
| 669 | // Get document.parentWindow. |
| 670 | hr = pDoc->get_parentWindow(&pWindow); |
| 671 | pDoc->Release(); |
| 672 | // Get the window.event object. |
| 673 | hr = pWindow->get_event(&pEventObj); |
| 674 | // Get the error info from the window.event object. |
| 675 | for (i = 0; i < 5; i++) |
| 676 | { |
| 677 | // Get the property's dispID. |
| 678 | hr = pEventObj->GetIDsOfNames(IID_NULL, &rgwszNames[i], 1, |
| 679 | LOCALE_SYSTEM_DEFAULT, &rgDispIDs[i]); |
| 680 | // Get the value of the property. |
| 681 | hr = pEventObj->Invoke(rgDispIDs[i], IID_NULL, |
| 682 | LOCALE_SYSTEM_DEFAULT, |
| 683 | DISPATCH_PROPERTYGET, ¶ms, &rgvaEventInfo[i], |
| 684 | NULL, NULL); |
| 685 | SysFreeString(rgwszNames[i]); |
| 686 | } |
| 687 | |
| 688 | // At this point, you would normally alert the user with |
| 689 | // the information about the error, which is now contained |
| 690 | // in rgvaEventInfo[]. Or, you could just exit silently. |
| 691 | |
| 692 | (*pvaOut).vt = VT_BOOL; |
nothing calls this directly
no test coverage detected