Home > Back-end >  Please help!!!!!! The question of JS function called ActiveX controls.
Please help!!!!!! The question of JS function called ActiveX controls.

Time:10-24

Void CMyActiveXCtrl: : OnSetClientSite (void)
{
IOleClientSite * pClientSite=GetClientSite ();
Retrieves the hr=S_OK;

PWebBrowser=NULL;
Isp IServiceProvider * and * isp2=NULL;//used to navigate the DHTML object level, the role is to provide service
If (! PClientSite)
{
If (pWebBrowser!=NULL)
{
PWebBrowser - & gt; Release ();
PWebBrowser=NULL;
}
return;//! S_OK.
}
The else
{
Hr=pClientSite - & gt; QueryInterface (IID_IServiceProvider, reinterpret_cast & lt; Void * * & gt; (& amp; Isp));
If (FAILED (hr))
{
Hr=S_OK;
Goto the cleanup.
}
Hr=isp - & gt; QueryService (SID_STopLevelBrowser IID_IServiceProvider, reinterpret_cast & lt; Void * * & gt; (& amp; Isp2));
If (FAILED (hr))
{
Hr=S_OK;
Goto the cleanup.
}
//get the browser
Hr=isp - & gt; QueryService (SID_SWebBrowserApp IID_IWebBrowser2, reinterpret_cast & lt; Void * * & gt; (& amp; PWebBrowser));
If (FAILED (hr))
{
Hr=S_OK;
Goto the cleanup.
}
Hr=this - & gt; PWebBrowser - & gt; The get_Document ((IDispatch * *) & amp; PHTMLDocument);//query Web page interface

If (FAILED (hr))
{
Hr=S_OK;
Goto the cleanup.
}
The cleanup:
//Free resources.
If (isp!=NULL)
{

Isp - & gt; Release ();
Isp=NULL;
}
If (isp2!=NULL)
{

Isp2 - & gt; Release ();
Isp2=NULL;
}
return;//hr.
}
return;


The hr=this - as long as add this code & gt; PWebBrowser - & gt; The get_Document ((IDispatch * *) & amp; PHTMLDocument);//query Web page interface
Shut down web page will prompt memory errors, collapse phenomenon, but blocked and can't call JS function, is there any way to improve? Ladies and gentlemen, for help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

CodePudding user response:

Under your top!!!!!!!!!!!!!! Hope to have webC++ master to help,
  • Related