Ask a questionAsk a question
 

QuestionIShellWindows behaviour changed under Windows Vista?

  • Wednesday, January 31, 2007 12:32 PMrob74 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi

    After a bit of experimenting, it seems to me like IShellWindows only enumerates "true" Shell Windows under Vista. Internet Explorer Windows are ignored, unlike in  previous Windows versions. Is there another way to enumerate all open Internet Explorer windows in Vista and accessing their IWebBrowser interface?

    Thanks in advance,
    Robert

All Replies

  • Friday, February 02, 2007 1:19 AMSharath Udupa - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I am not aware of any difference. I ran this sample jscript which enumerates the windows and it was able to retrieve information regarding IE windows too. This code is modified from the sample on MSDN (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/objects/shellwindows/shellwindows.asp)

    var objShell = new ActiveXObject("Shell.Application");
    var objShellWindows;
           
    objShellWindows = objShell.Windows();
    if (objShellWindows != null)
    {
         var objIE;
         for (var i = 0; i < objShellWindows.Count; i++)
         {
               objIE = objShellWindows.Item(i);
                if (objIE)
                {
                     WScript.Echo(objIE.LocationURL);
                }
         }
    }

  • Monday, February 05, 2007 9:52 AMrob74 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    Thanks for the answer. I have copied the example to a .js file (with one modification: inserting "WScript.Echo(objShellWindows.Count);" before "var objIE;") and ran it under Windows Vista, but it displays "0" regardless of how many IE windows I open. Only "true" Shell windows are counted. Maybe it has something to do with the version of Windows Vista I am running or with some (security) settings? I am using the German release version of Windows Vista Ultimate - downloaded from MSDN.

    Best Regards,
    Robert
  • Monday, February 05, 2007 4:14 PMrob74 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi again,

    I am (hopefully) one step closer to solving the problem. It seems that IShellWindows works as usual if User Account Control is disabled, but when UAC is enabled, it "hides" the IE windows - see also http://www.teknologika.com/blog/WatiNAndVistaRC1.aspx. So this is probably a new security feature, as I suspected. Of course, the MSDN documentation hasn't been updated yet ... So I suspect I'll have to look into "elevating" the program's rights in order to get it working again. But if someone here has other suggestions, they're still very welcome...

    Greetings,
    Robert
  • Thursday, November 13, 2008 10:05 PMn0wa Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Sorry for diggin this grave, but due to this http://www.google.com/search?hl=en&q=IShellWindows+MSDN&btnG=Search
    (3rd place in search now, yea this thread indexed fine) i can say - all works fine with my Vista SP1


  • Friday, November 14, 2008 5:27 PMjeffdavMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Good to know you're running with UAC turned off. Smile
  • Monday, November 17, 2008 1:34 PMn0wa Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    UAC is enabled 
  • Monday, December 28, 2009 11:57 AMCellendhyll Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    does anyone find a way to solve this?