Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shell32 XP vs Win7 [revisited] 1

Status
Not open for further replies.
Apr 13, 2001
4,475
US
See: thread222-1594332

One of the things added in Windows NT 6.0, a.k.a. Longhorn, a.k.a. Windows Vista and Windows Server 2008 was a "3D window switcher" in Shell32, a.k.a. Explorer.

As part of this Microsoft altered the interface of [tt]Shell32.Shell[/tt] to [tt]IShellDispatch5[/tt], which has a new method [tt]WindowSwitcher()[/tt]. This seems to be the source of the problem.


One workaround is to create and use late-bound instances via [tt]CreateObject()[/tt] calls.


However it can be cleaner and more efficient to create early-bound instances as before. It just gets a little tricky because we only have a limited and somewhat clunky way to do type casting in VB6: you need an extra object reference variable and can't use the "anonymous object" syntax: With New ...

So here's the trick required:

Code:
    Dim Shell As Shell32.IShellDispatch4 'Don't use As Object or you have late-binding!

    Set Shell = CreateObject("Shell.Application")
    With Shell
        MsgBox .NameSpace(ssfCOMMONAPPDATA).Self.Path
    End With
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top