NewWindowDispatch3 extern IDispatch * *;
Extern LONG_PTR RunCreateWindowProc;
Void _stdcall WebBrowser: : NewWindow2 (IDispatch * * ppDisp, VARIANT_BOOL * & amp; Cancel)
{
NewWindowDispatch3=ppDisp;
RunCreateWindowProc CallWindowProc (WNDPROC), NULL, WM_Y_OPEN_NW2, 0, 0).
* Cancel=VARIANT_FALSE;
}
LRESULT a CALLBACK WndProc (HWND HWND, UINT Message, WPARAM WPARAM, LPARAM LPARAM) {
The switch (the Message) {
Case WM_CREATE message handler:
RunCreateWindowProc=(LONG_PTR WndProc);
NewWindowDispatch3=0 x0;
break;
Case WM_Y_OPEN_NW2:
OpenNewWindow2 (" Sub Parts ");
break; }
return 0;
}
Void openNewWindow2 (string Description)
{
WebForm - & gt; OpenDefaultWeb (" about: blank ");
WebForm - & gt; GetBrowser () - & gt; GetWebBrowser2 () - & gt; Put_RegisterAsBrowser (VARIANT_TRUE);
LPDISPATCH disp=NULL;
Retrieves the hr=WebForm - & gt; GetBrowser () - & gt; GetWebBrowser2 () - & gt; Get_Application (& amp; Disp);
If (SUCCEEDED (hr))
{
* NewWindowDispatch3=disp;
}
}
In addition, if you use the following code for the first time, has built a successful Internet explorer window, and guide the links, (it pop up a hint, haste presses to determine key) can no longer new Internet explorer window, after a flash back, and the last frame to guide the original window click on the links to open?
Void _stdcall WebBrowser: : OnNewWindow3 (IDispatch * * ppDisp, VARIANT_BOOL * Cancel,
DWORD dwFlags,
BSTR bstrUrlContext,
BSTR bstrUrl)
{
The IWebBrowser2 * wb=NULL;
The CoCreateInstance (CLSID_InternetExplorer,
NULL,
CLSCTX_LOCAL_SERVER,//CLSCTX_ALL,
IID_IWebBrowser2,
(void * *) & amp; Wb);
Wb - & gt; Put_RegisterAsBrowser (VARIANT_TRUE);
Wb - & gt; Put_Visible (VARIANT_FALSE);
Wb - & gt; Get_Application (ppDisp);
}
CodePudding user response:
Pass by to see, have a headache!CodePudding user response:
Don't try so hard, such as adding OnNewWindow3 code, you can simply use to Navigate to your web page, see if you can display properly (generally normal display)Then, add your control code
CodePudding user response:
Navigate completely normal, other are tuned through, is this, don't know is Webbrowser inheritance, inherited methods is wrong, or the other, in addition, the network is a little problem today, however, void _stdcall Webbrowser: : OnNewWindow3 (IDispatch * * ppDisp, VARIANT_BOOL * Cancel,DWORD dwFlags,
BSTR bstrUrlContext,
BSTR bstrUrl)
{
The IWebBrowser2 * wb=NULL;
The CoCreateInstance (CLSID_InternetExplorer,
NULL,
CLSCTX_LOCAL_SERVER,//CLSCTX_ALL,
IID_IWebBrowser2,
(void * *) & amp; Wb);
Wb - & gt; Put_RegisterAsBrowser (VARIANT_TRUE);
Wb - & gt; Put_Visible (VARIANT_FALSE);
Wb - & gt; Get_Application (ppDisp);
}
This a miracle, can the normal load the pop-up page, is to use webbrowser or not
CodePudding user response:
Is there a man, look at ah,CodePudding user response:
see https://bbs.csdn.net/topics/651 # 15CodePudding user response:
Isn't this meaning, and not to use the links in the first frame in the second frame open the page,A new page in the webbrowser, then open a page, the page including multiple frame. The start of the new page is other page a link,
Wrong result: shows a header frame, then, don't know is interrupted or not response, just don't show the other frame.
CodePudding user response:
Capture the NavigateError abnormalities, see if there is a error page load?CodePudding user response:
OnNewWindow, don't need youThe CoCreateInstance (CLSID_InternetExplorer,,,,,,,,,,,
You have is a CLSID_InternetExplorer ppDisp read data
CodePudding user response:
I will try to add a NavigateError, but with the API is not ready-made code, ah!New pop-up window because he wanted to through pop-up window page url, to hide the pop-up window, the get url, and then turn off the hidden window, but can sometimes, sometimes just a flash out, also don't know whether that is flawed, and do not add any code in a newwindow, key new window does not appear, ie is not set for the interception of the pop-up window of this site
CodePudding user response:
https://blog.csdn.net/norsd/article/details/2921389CodePudding user response:
Ie is pit, can try TaShan frameworkCodePudding user response:
Don't use IE, do not use IE, don't use IE, do not use IEThe important thing three times! Don't use IE