Results 1 to 3 of 3

Thread: Refresh window handle list??

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2000
    Posts
    1

    Question

    Here's my problem:

    I need to see whether IE is running first off. I use Get window to do this with "Microsoft Internet Explorer" as the caption.

    Ok,

    I basically have a Main IE window whose handle I get using Findwindow. Now I need to load URLs in this window only. If another IE window popups up it should be closed and URLs continue to be loaded in the main window.

    If the main window happens to close it should start a fresh IE and use the handle of the new window as the new main browser window.

    Here are all the problems:
    I use the code in a timer (every 1 second).
    Now if the main window closes and the new IE is ran, I immediately search for the IE window, but it doesn't always find it. Because of this it will load another and another.

    The main problem is that I launch the program, I see it in the taskbar and then I immediately search for window handle using Findwindow and it can't find it.

    By the way, I find the windows handle using a procedure with Findwindow and Findnext window since I need to search for "Microsoft Internet ...." in only a portion of the code. If I step through the code it works fine, but when I let it run it doesn't. The only thing I can think of is that the program does not wait for the "shell" command to execute since I check the windows right after this.

    Please I need some help.
    What am I doing wrong?
    Is there some sort of API function to refresh all the windows in the list or something?

    I'm kinda a beginer to API to some code would be nice.

    ThanX in advance

    [Edited by HardCopy on 05-04-2000 at 04:59 AM]

    [Edited by HardCopy on 05-04-2000 at 06:09 AM]

  2. #2
    Lively Member
    Join Date
    Apr 2000
    Location
    Hell
    Posts
    89
    Erm, a serious problem here.

    IE's title bar isn't always "Microsoft Internet Explorer"; it can be changed through the registry. (Example: AOL changes it to "Microsoft Internet Explorer Provided By America Online"). In general, it's never a good idea to use FindWindow to find a window by title.

    I'm going out on a limb here, but if you need an instance of Explorer that people can't close, then why don't you just slap a WebBrowser control instance on your form?
    - Steve

    Real programmers use COPY CON PROGRAM.EXE

  3. #3
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    or can you find out IE's class name (get class name could be usefull) then enumwindows to find all the windows with that classname.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width