https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setthreaddesktop
SetThreadDesktop function (winuser.h) - Win32 apps | Microsoft Learn
Assigns the specified desktop to the calling thread. All subsequent operations on the desktop use the access rights granted to the desktop.
functionhappsmicrosoftlearn