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

  • Today's agile organizations pose operations teams with a tremendous challenge: to deploy new releases to production immediately after development and testing is completed. To ensure that applications are deployed successfully, an automatic and transparent process is required. We refer to this process as Zero Touch Deployment™. This white paper reviews two approaches to Zero Touch Deployment--a script-based solution and a release automation platform. The article discusses how each can solve the key …

  • Learn How A Global Entertainment Company Saw a 448% ROI Every business today uses software to manage systems, deliver products, and empower employees to do their jobs. But software inevitably breaks, and when it does, businesses lose money -- in the form of dissatisfied customers, missed SLAs or lost productivity. PagerDuty, an operations performance platform, solves this problem by helping operations engineers and developers more effectively manage and resolve incidents across a company's global operations. …

Most Popular Programming Stories

More for Developers

RSS Feeds