Moving applications between desktops in Windows

前端 未结 3 1670
旧巷少年郎
旧巷少年郎 2021-01-01 07:56

I am trying to figure out how can I send a running application do a new Windows desktop created with CreateDesktop.

I can create a new Desktop, and then launch an ap

相关标签:
3条回答
  • 2021-01-01 08:28

    Window resources (such as HWNDs) are specific to a desktop. If you create a window in one desktop, I can't see how you would be able to move it to another desktop. For example, the HWNDs used by your application might already be in use in the other desktop.

    Virtual Desktop Managers don't have to use Windows Desktops -- they can create the same effect by manipulating the windows. Take a look at VirtuaWin, an open source Virtual Desktop Manager.

    0 讨论(0)
  • 2021-01-01 08:33

    I have not implemented any code, but just thinking aloud... Quoting from the following MSDN Link

    A process automatically establishes a connection to a window station and desktop when it first calls a USER32 or GDI32 function. If the process did not call SetProcessWindowStation, it connects to the window station inherited from the parent process

    This implies that the 'running application' already has the value of "lpDesktop member of the STARTUPINFO structure" set to the current window station. I think you may need to change this value to send the application to another desktop. As this link mentions SetProcessWindowStation Function, this could be done using

    BOOL WINAPI SetProcessWindowStation( __in HWINSTA hWinSta );

    Also, as SetThreadDesktop Function mentions

    Assigns the specified desktop to the calling thread.

    So I guess, for this to work, you 'running application' will need to call SetThreadDesktop. It will be helpful if you could post in some code...

    0 讨论(0)
  • 2021-01-01 08:40

    Just try Vista/XP Virtual Desktop Manager from http://vdm.codeplex.com/

    0 讨论(0)
提交回复
热议问题