Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting active virtual desktop on Windows 10 - Task View - virtual desktop switcher

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!

like image 659
LetItRock Avatar asked May 27 '15 15:05

LetItRock


1 Answers

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

like image 112
blade Avatar answered Oct 15 '22 00:10

blade