0

I learn some API form here https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enumdesktopsa and access violation when switching desktops

I know how to create a virtual desktop,like Win+Ctrl+D.

However, I want to go to the next desktop, like Win+Ctrl+-> or Win+Ctrl+<-, go to desktop1 or desktop2. I know here is an API BOOL SwitchDesktop([in] HDESK hDesktop);, but I don't know how to get HDESK of desktop2, 3, 4.

Is there an API like switchToNextDesktop, swithToLeftDesktop and switchToRightDesktop?

Is there an API that can let me know the HDESK of desktop2, 3, 4, 5? The desktop2, 3, 4, 5 is created by Win+Ctrl+D.

Maybe C# has some function? What about C++?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
张大傻
  • 1
  • 2
  • I believe you're talking about the "virtual desktop" API which is a different API (Windows Shell) https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-ivirtualdesktopmanager – Simon Mourier Apr 27 '22 at 09:13
  • 1
    [Windows 10 virtual desktops are a window management feature, not a security feature](https://devblogs.microsoft.com/oldnewthing/20180501-00/?p=98645). – IInspectable Apr 27 '22 at 09:14

0 Answers0