问题
I have a WPF application that sometimes launches legacy VB6 windows. These VB6 windows are compiled as ActiveX DLLs and are launched ‘modally’ from the main WPF application. When the main WPF application launches the VB6 window, the VB6 window passes Me.Hwnd back to the main WPF application which uses ITaskbarList to display an icon on the Windows Taskbar. Code similar to below has worked for years (“value” is ultimately Me.Hwnd from the VB6 application).
private ITaskbarList _taskbar;
_taskbar = (ITaskbarList)new CoTaskbarList();
_taskbar.HrInit();
_taskbar.AddTab((IntPtr)value);
My client is now running the application via RemoteApp and the HrInit method is throwing an exception (HResult -2146233088 / 0x80131500).
Is ITaskbarList functionality supported under RemoteApp? Is there a better approach to accessing the taskbar when the application is running under RemoteApp?
回答1:
This is because RemoteApp does not run dwm/explorer.exe as a shell, instead it runs its own shell (rdpshell.exe). By running dwm/explorer as a shell, you pull in the entire desktop (so you basically run Remote Desktop rather than RemoteApp).
Therefore, utilities that are specific to DWM/explorer.exe are not working under RemoteApp (since there is no hosting shell and there is no taskbar etc.).
What are you trying to achieve? Is the RemoteApp (VB6 app) supposed to launch another app or what are you trying to achieve? Maybe we can work on fixing that.
来源:https://stackoverflow.com/questions/35185388/itaskbar-hrinit-method-throws-exception-under-remoteapp