Can you tell me how I move a running application (and its associated window) to a different desktop? SDK documentation does not mention it. But, considering that there are bunch of virtual desktop products in the market, it should be possible to do so.

Say, you have the destination desktop window handle (HWND) in hDTWnd (not HDESK) and the top level window to move is hWnd.

invoke SetWindowPos,hWnd,hDTWnd,x,y,0,0,SWP_NOSIZE or SWP_SHOWWINDOW

does not change a thing. But, no error from the system. OTOH, when I tried

invoke SetParent,hWnd,hDTWnd

it shows the window in the destination desktop, but the window does not respond at all. Input focus seems to remain unchanged in the source desktop.

Maybe I'm missing something obvious. :stupid: Any insight about this?
Posted on 2003-08-22 00:48:43 by Starless
thats because the program its self is relitive to the destop it was created on..

one possilbe way i can think of is do a gloabal hook find window name or process id of the app you want to switch then have the hook call the new desktop destination that it is to be attatched to...

i was working on making my own desktop and a managed to get the new desktop but i could not find out how to add my own objects like icons or shell context then i got side tracked with making a decryptor and never went back to it..
Posted on 2003-08-22 03:34:02 by devilsclaw

I've been searching for possibilities since I posted the message. And, I came to a similar conclusion. But, the implementation idea that I had requires almost as much work (both in the sense of data management and coding) as process management part of OS. There's gotta be a simpler and more elegant way.

In the meantime, I skimmed through so-called 'replacement shells' for idea. It seems to me that most of them implement virtual desktop switching by creating a big window which covers the whole desktop and selectively mapping application windows. Two of them I tried. One segfault'ed on me, and the other looked OK. I wonder if this is the way that other commercial apps implement it.
Posted on 2003-08-22 04:44:02 by Starless