1

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?

DFG
  • 13
  • 3

1 Answers1

0

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.

cdavid
  • 497
  • 6
  • 11
  • The "main application" is a WPF application. It is being deployed to the client via RemoteApp. The user selects a Ribbon Item and the application launches a VB6 ActiveX form. Because the user can go back and forth between this VB6 form and the original window (or even launch other windows), we want the main window AND the VB6 window to be displayed in the Taskbar -- for example, if the VB6 window gets behind the main window, the user can bring it forward by clicking on the Taskbar. Thanks for your reply. – DFG Feb 03 '16 at 20:58
  • I think @cdavid is correct, I could not gain access to the Taskbar. Instead, my code uses this statement: Boolean isRemoteApp = System.Windows.Forms.SystemInformation.TerminalServerSession; to determine if it is being launched from RemoteApp. If so, then it doesn't attempt to control the taskbar. Not ideal, but works ok for my situation. – DFG Feb 08 '16 at 19:38