Rightthen

Rightthen

  • NA
  • 31
  • 14.6k

Windows.Forms.Webbroser DocumentComplete And Internet Navigation Problem

Oct 31 2008 3:16 AM

GentleMen,

i am Programming With Vs2005 C# On Windows Vista Laptop

it has ie7 installed on it the things i did in xp are not working here

For Instance When i try to Launch An Internet Explorer With C# When Ever Navigate() is used

A new Explorer Pops Up . Problem with that is that my Variable is not pointing To the new Explorer Opened

and there by i dont have any control over the new opened explorer i tired with navigating with "_self" so now

new Explorer does not open but in the same explorer the original object first fires Onquiting() Event and then

Navigation to the said site begins and that result again in lossing control because my variable become useless on

Rasing of event OnQuiting.

After much Agony i droped Internet Explorer Altoghether and resorted to use WebBrowser the one in System.Windows.Forms.WebBrowser now the thing is i am unable to know when Document is really Completed

because DocumentComplete is fired every time a new frame is loaded. In internet exploere we could check the parent of pdisp and the internetexplorer itself if both were same it was really completed but how to do that with webbrowser.

I have Tried so many thingsbut they all fire all the time

void DealWithWebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)

{

 

if ( ((DealWithWebBrowser)sender).Document.Equals( this.Document) == true )

{

 MessageBox.Show ( "if ( ((System.Windows.Forms.HtmlDocument)sender).Equals( this.Document) == true )" ) ;

}

 HtmlDocument DocumentCompleted = ( ( System.Windows.Forms.WebBrowser ) sender ).Document ;

 

if ( this.ActiveXInstance != null ) //&& ActiveXBrowser == null )

{

ActiveXBrowser = (shdocvwTLB.WebBrowser)this.ActiveXInstance ;

}

 

if ( DocumentCompleted.Title.Equals(this.Document.Title ) )

{

 MessageBox.Show ( "( DocumentCompleted.Title.Equals(this.Document.Title ) )") ;

}

if ( this.Handle.Equals ( ((DealWithWebBrowser)sender).Handle ) == true )

{

 MessageBox.Show ( "this.Handle.Equals ( ((DealWithWebBrowser)sender).Handle ) == true )" ) ;

}

if ( sender.Equals ( this ) == true )

{

 MessageBox.Show ("if ( sender.Equals ( this ) == true )");

}

if ( DocumentCompleted.Equals ( this.Document ) == true )

{

 MessageBox.Show ( "DocumentCompleted.Equals ( this.Document ) == true");

}

if ( DocumentCompleted.Equals ( this.Document ) == true && DocumentCompleted.Url.Equals ( e.Url ) == true )

{

 MessageBox.Show ("( DocumentCompleted.Equals ( this.Document ) == true && DocumentCompleted.Url.Equals ( e.Url ) == true )");

}

}

 

Please Please Please Help me

Thanking You

Right Then