1

How can I receive a message when user moves somebody else's window between Windows 10 virtual desktops?

I am currently using SetWinEventHook for all other similar purposes (like tracking minimization, text change, etc), but there does not seem to be an entry for moving between virtual desktops in the documentation for event types.

LOST
  • 2,956
  • 3
  • 25
  • 40
  • 1
    @RbMm, I am sorry if it was not clear, but the question is about Windows 10 virtual desktops. AFAIK, user can't move an existing window to a different "Desktop" of the kind that you mentioned. – LOST Apr 26 '18 at 18:52
  • 1
    @LOST I don't think there is a specific event for this issue. Virtual Desktops is a fairly new feature, maybe MS simply overlooked exposing events related to it. However, there is an [`IVirtualDesktopManager`](https://msdn.microsoft.com/en-us/library/windows/desktop/mt186440.aspx) interface, which has [`GetWindowDesktopId()`](https://msdn.microsoft.com/en-us/library/windows/desktop/mt186441.aspx) and [`IsWindowOnCurrentDesktop()`](https://msdn.microsoft.com/en-us/library/windows/desktop/mt186442.aspx) methods, so you should be able to cobble together some kind of manual window tracking system. – Remy Lebeau Apr 26 '18 at 18:57
  • @RemyLebeau, thanks for the idea, that's what I ended up doing for now. Polling has its disadvantages though: you need to spend processor cycles and your app needs a context switch for it. – LOST Apr 27 '18 at 19:26

0 Answers0