-
1
- #1
dilettante
MIS
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:
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