I've been trying to use IVirtualDesktopManager::MoveWindowToDesktop to move windows between virtual desktops.
Using it on my own windows works great but unfortunately it fails with E_ACCESSDENIED when I try to use it on the window of another process.
Sadly "Launch as admin" is not good enough for it. Am I missing something that I don't know about COM interfaces or is it just badly designed ?
The IVirtualDesktopManager interface has these methods. Gets the identifier for the virtual desktop hosting the provided top-level window. Indicates whether the provided window is on the currently active virtual desktop. Moves a window to the specified virtual desktop. The user can group a collection of windows together to create a virtual desktop.
Luckily, Windows makes it easy to move windows between virtual desktops. Here’s how. Using your mouse or a touchscreen, you can easily drag windows between virtual desktops using the Task View sceen. To open “Task View,” click the “Task View” button on your taskbar or press Windows+Tab.
After that, the window will appear on the virtual desktop you selected. You can also make the window appear on all virtual desktops at once if you right click on its thumbnail in Task View and select “Show this window on all desktops.” Very handy!
The user can group a collection of windows together to create a virtual desktop. Every window is considered to be part of a virtual desktop. When one virtual desktop is hidden, all of the windows associated with it are also hidden. This enables the user to create multiple working environments and to be able to switch between them.
You can move a window not owned by the executing process, but it requires the use of additional, undocumented COM objects.
Code references:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With