Website intercept and pop up the screen of the window

zhaozj2021-02-16  89

STDMETHODIMP CIEPLUGCOM :: Invoke (Dispid Dispidmember, Refiid Riid, LCID LCID, Word WFLAGS, DISPPARAMS * PDISPPARAMS, VARIANT * PVARRESULT, EXCEPINFO * PEXCEPINFO, UINT * PUARGERR)

{

Uses_Conversion;

IF (! pdispparams)

Return E_INVALIDARG;

LpoLestr LPURL = NULL;

m_spwebbrowser2-> get_locationURL (& lpurl);

Switch (Dispidmember)

{

Case Dispid_beforenaviGate2:

Char * purl;

IF (pdispparams-> cargs> = 5 && pdispparams-> rgvarg [5] .vt == (VT_BYREF | VT_VARIANT))

{

CCOMVARIANT VARURL (* pdispparams-> rgvarg [5] .pvarval);

VARURL.CHANGETYPE (VT_BSTR);

// Transformation to the URL to be visited as a char * type

PURL = OLE2A (VARURL.BSTRVAL);

}

// stop if the URL to be accessed is to be intercepted

// ids_url

IF (strs, "microsoft.com")! = NULL)

{

* pdispparams-> rgvarg [0] .pBoolval = true;

MessageBox (NULL, "Current System Forbidden to Browse this page", "Warning", MB_ICONSTOP);

Return S_OK;

}

Break;

Case Dispid_naviGateComplete2:

Break;

Case Dispid_DocumentComplete:

Break;

Case Dispid_Downloadbegin:

Break;

Case Dispid_downloadlineComplete:

Break;

Case Dispid_newwindow2:

ReadyState M_ReadyState;

m_spwebbrowser2-> get_readystate;

IF (M_ReadyState! = ReadyState_complete)

{

* pdispparams-> rgvarg [0] .pBoolval = true;

Return S_OK;

}

Else

{

* pdispparams-> rgvarg [0] .pBoolval = false;

Return S_OK;

}

Break;

Case Dispid_quit:

Break;

DEFAULT:

Break;

}

Return S_OK;

}

转载请注明原文地址:https://www.9cbs.com/read-12889.html

New Post(0)