Open URL in existing IE Window

screenshot

To find the existing instance of Internet Explorer, we need to use the FindWindowEx and EnumChildWindows Windows API calls.

FindWindowEx will find a window with a given classname - we then use the EnumChildWindows routine to search that application for the EditControl (read: address text box) in Internet explorer. Once the textbox has been found, a simple SendMessage call can be made with the WM_SETTEXT parameter to set the address.

Once the text has been set in IE's address textbox, we can simply do another SendMessage call, this time with WM_KEYDOWN and passing the 'return' key constant.

Download Zipped Project Files (and exe) - 7k



Comments

  • Modify existing code

    Posted by Legacy on 05/22/2003 12:00am

    Originally posted by: komal

    I need that a new instance of explorer should be created, if existing instance doesnt exist. How do i modify this code. Pls tell me.
    

    Reply
  • Detect that page is fully loaded

    Posted by Legacy on 12/11/2002 12:00am

    Originally posted by: Jake Miles

    How can you detect in the VB program that the page is fully loaded in the IE window?

    Reply
  • CA WE VERIFY THAT THE URL IS NOT A SUB-DOMAIN!

    Posted by Legacy on 11/19/2002 12:00am

    Originally posted by: Usman Zaheer

    Can we verify that if a given URL is sub-domain or not just like we enter;
    
    

    www.yahoo.com (Its a domain)

    www.abc.yahoo.com (Its a sub-domain)

    PLEASE HELP IN THIS REGARD!!!!!!!!!!

    Reply
  • get the url from internet explorer

    Posted by Legacy on 11/19/2001 12:00am

    Originally posted by: Cyrano

    Instead of sending a url to a internet explorer window, I would like to get the url from a internet explorer window.

    • thats it

      Posted by c-o-m-m-a-n-d-e-r on 09/27/2004 08:35am

      Here we go:
      //buff ist the handel to IE Windows
      char buffer[256];
      HWND child;
      HWND ie; 
      if(ie = ::FindWindow("IEFrame",buff))
      {
      	if(child = ::FindWindowEx(ie,0,"WorkerW",0))
      	{
      		if(child = ::FindWindowEx(child,0,"ReBarWindow32",0))
      		{
      			if(child = ::FindWindowEx(child,0,"ComboBoxEx32",0))
      			{
      						::SendMessage(child,WM_GETTEXT,255,(long)&buffer[0]);
      						CString test = buffer;				AfxMessageBox(test);
      			}
      		}
      	}
      }

      Reply
    Reply
  • Netscape

    Posted by Legacy on 06/06/2001 12:00am

    Originally posted by: Navdeep G

    How can i fill data in text boxes of a Netscape Window.???

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • VMware vCloud® Government Service provided by Carpathia® is an enterprise-class hybrid cloud service that delivers the tried and tested VMware capabilities widely used by government organizations today, with the added security and compliance assurance of FedRAMP authorization. The hybrid cloud is becoming more and more prevalent – in fact, nearly three-fourths of large enterprises expect to have hybrid deployments by 2015, according to a recent Gartner analyst report. Learn about the benefits of …

Most Popular Programming Stories

More for Developers

RSS Feeds