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

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

  • With 81% of employees using their phones at work, companies have stopped asking: "Is corporate data leaking from personal devices?" and started asking: "How do we effectively prevent corporate data from leaking from personal devices?" The answer has not been simple. ZixOne raises the bar on BYOD security by not allowing email data to reside on the device. In addition, Zix allows employees to maintain complete control of their personal device, therefore satisfying privacy demands of valued employees and the …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds