ITaskbar HrInit method throws exception under RemoteApp

假装没事ソ 提交于 2020-01-05 22:20:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!