Click to See Complete Forum and Search --> : OnNewWindow2
Nenad
August 30th, 1999, 07:05 AM
OnNewWindow2( LPDISPATCH* ppDisp, BOOL* Cancel ); is method of CHtmlWiew class and ppDisp is a to an interface pointer that, optionally, receives the IDispatch interface pointer of a new WebBrowser or Internet Explorer object. I need to know URL location of that new window of a Internet Explorer object. How to do that?
Walter Bertl
October 18th, 1999, 03:14 AM
Have exactly the same problem.
Did You find a solution ???
muscicapa
October 22nd, 1999, 06:32 AM
One solution is to create a new explorer object and pass its Idispatch to the parameter. Now you can use the interface to the new explorer object ( IWebBrowser2) to get the LocationURL using an incoming call.
hope this will work :-)
I tried this with VB , it works.
but its a bit of sweat with VC.
But the problem is a recursive newwindow call !!!!I am in need of a solution myself
Nenad
October 26th, 1999, 01:42 AM
Rcursive window call: solution:
OnMouseClicked(){
flag=TRUE
}
OnNewWindow(){
if (flag){
......
..
*ppDisp=.....
.....
...
flag=FALSE
}
{
OnNavigationComplete(){
if(flag){
flag=FALSE
}
}
This means that newwindow can retrieve URL only when mouse clicked (when user click on a hiperlink).
If html page is loaded and that page want to open new window by it self (whitout user clicking on hiperlink); my code will not alowed this.
This code will prevent and recursive opennewwindow.
Try this code and write to me how it works.
October 26th, 1999, 02:10 AM
I am using the regular Internet explorer and not a control. I have no intention of writing a hook to get the mouse click on the browser.
I am trying to get the sink registered with all the windows or the window currently in focus.
The VB code here shows the spirit in which i need the thing to work.
This VB code is faulty and the victim of a lot of wayward experimentation.
But it should give an idea of the problem.
MSDN Article ID: Q180366 suggests some interesting ideas but event that fails with sites like www.games.com www.desktop.com etc
Dim ie As shdocvw.InternetExplorer
Dim WithEvents iecoll As shdocvw.ShellWindows
Dim WithEvents currentie As InternetExplorer
Dim first As Boolean
Dim firstie As Object
Private Sub Command1_Click()
For Each ie In iecoll
Set currentie = ie
Next
End Sub
Private Sub currentie_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
If Not first Then
Set firstie = pDisp
first = True
End If
End Sub
Private Sub Form_Load()
first = False
Set iecoll = New shdocvw.ShellWindows
For Each ie In iecoll
Set currentie = ie
Next
End Sub
SteveS
January 20th, 2000, 11:30 AM
I need the answer to this also. Did you ever get the solution?
Why would Microsoft hide such an important piece of information with this function in the first place?
Nenad
January 27th, 2000, 04:36 AM
Yes I get the solution. If you use Microsoft Web Browser Control (ActiveX control)on dialog ,you must create another dialog with Web Browser Control on it in resource editor. When NewWindow event ocurs in the first dialog you must content of this newwindow put in second dialogs Web Browser Control with this line: *ppDisp=pNewDlgExplorer->m_explorer_control.GetApplication();. Now, second dialogs Web Browser Control start to load some html page and you must OnBeforeNavigate (CDlgExplorerSecond::OnBeforeNavigate) catch this new page and put this new page back in firs dialog:
CDlgExplorerSecond::OnBeforeNavigate(strUrl)
{
pFirstDlgExplorer->Navigate(strUrl);
}
.
..
.
CDlgExplorerSecond* pNewDlgExplorer;
pNewDlgExplorer=new CDlgExplorerSecond;
pNewDlgExplorer->Create(IDD_DIALOG_EXPLORER);
void CDlgExplorerFirst::OnNewWindow2Explorer(LPDISPATCH FAR* ppDisp, BOOL FAR* Cancel)
{
*ppDisp=pNewDlgExplorer->m_explorer_control.GetApplication();
}
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.