Welcome !
         

 Bring Internet Explorer Appliation window to front

Author Message
margentieri

  • Total Posts : 18
  • Scores: 0
  • Reward points : 0
  • Joined: 9/19/2016
  • Status: offline
Bring Internet Explorer Appliation window to front Monday, November 14, 2016 9:33 AM (permalink)
0
Hello all,
 
I have a script where I create an IE window through CreateObject("InternetExplorer.Application"). The problem is, whenever I run this script, it always opens behind whatever else might already be open on my machine.  I want this IE window to open on TOP of everything else.  It does not have to be "always on top", like the option in Task Manager, but it should at least initially open on top. After that, I don't care what happens.  I have searched high and low and have been unable to find a way to achieve this.  I have tried appactivate and focus() but neither of those seem to work.  Any suggestions?
 
Thanks!
 
#1
    margentieri

    • Total Posts : 18
    • Scores: 0
    • Reward points : 0
    • Joined: 9/19/2016
    • Status: offline
    Re:Bring Internet Explorer Appliation window to front Tuesday, December 20, 2016 6:07 AM (permalink)
    0
    Solved my problem. The issue was either that I was not setting a foreground window within the first 2 seconds (I had a sleep in place before I tried using AppActivate), or because I was not using CreateObject("WScript.Shell") when utilizing AppActivate.
     
    My new code which successfully sets my IE window as a foreground window:
     Set IE = CreateObject("InternetExplorer.Application")
    
    With IE
        
        .ToolBar    = False
        .StatusBar  = False
        .Resizable  = False
        .Height     = 620
        .Width      = 400
        .Left       = 600
        .Top        = 200
        
        .Visible = True
        CreateObject("WScript.Shell").AppActivate "Internet Explorer"
        .Navigate "about:blank"
        
        While .ReadyState <> READYSTATE_COMPLETE
            Sleep 0.01
        Wend
        
        .document.title = "Artel Protocol Options"
        .document.body.style.backgroundcolor = "lightgrey"
        .document.body.innerHTML = "<center>" & sHTMLCode & "</center>"
     

     
    Source:
    https://stackoverflow.com...iation-window-to-front
     
    #2
      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 3 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2017 ASPPlayground.NET Forum Version 3.9