6
votes

Windows 10 provide for users switching between virtual desktops using Task View.

For developing purpose, I need to:

  • detect which virtual desktop is active
  • get virtual desktop parameters (handle, class, position, styles)
  • get list of applications from this virtual desktop
  • move application from one virtual desktop to another

How can I do that? Is there any API?
Thank you for your help!

1

1 Answers

3
votes

There is an interface that should provide most of the functionality you need: IVirtualDesktopManager interface

It has the following methods:

  • GetWindowDesktopId
  • IsWindowOnCurrentVirtualDesktop
  • MoveWindowToDesktop

In case that wasn't enough, there are even more unofficial APIs documented on this Russian website http://www.cyberforum.ru/blogs/105416/blog3671.html

Edit: here's a C# wrapper library for all the COM interfaces: https://github.com/Grabacr07/VirtualDesktop