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: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Companies must routinely transfer files and share data to run their business, work with partners, and speed operations. However, many find the traditional approach to file transfer lacks necessary security, is too complex and difficult to manage, does not support the levels of automation needed, and breaks down when addressing the file transfer requirements of new areas like Big Data analytics and mobile applications. This QuinStreet SmartSelect discusses how the changing business environment is making the use …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds