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

  • The explosion in mobile devices and applications has generated a great deal of interest in APIs. Today's businesses are under increased pressure to make it easy to build apps, supply tools to help developers work more quickly, and deploy operational analytics so they can track users, developers, application performance, and more. Apigee Edge provides comprehensive API delivery tools and both operational and business-level analytics in an integrated platform. It is available as on-premise software or through …

  • Not long ago, security was viewed as one of the biggest obstacles to widespread adoption of cloud-based deployments for enterprise software solutions. However, the combination of advancing technology and an increasing variety of threats that companies must guard against is rapidly turning the tide. Cloud vendors typically offer a much higher level of data center and virtual system security than most organizations can or will build out on their own. Read this white paper to learn the five ways that cloud …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds