Sign in to follow this  
Followers 0
Bluesmaster

CreateProcess on other Desktop and bring it back

7 posts in this topic

it is possible to start a process hidden on another desktop. But is it possible to bring it back to the input-desktop using its PID?

Example: ( start Notepad )

#include <WinAPISys.au3>
#Include <WinAPI.au3>

$hNewDesktop     = _WinAPI_CreateDesktop( "ShellExecuteHidden_Desktop" , $GENERIC_ALL )

; 2 - Start Process
$tProcess = DllStructCreate( $tagPROCESS_INFORMATION )
$tStartup = DllStructCreate( $tagSTARTUPINFO )
DllStructSetData( $tStartup , 'Size', DllStructGetSize( $tStartup) )
DllStructSetData( $tStartup , 'Desktop', _WinAPI_CreateString(  "ShellExecuteHidden_Desktop" ) )

Local $pid
_WinAPI_CreateProcess( @SystemDir & "\notepad.exe" , "" , 0, 0, 0, 0x00000200   , 0, 0, DllStructGetPtr($tStartup), DllStructGetPtr($tProcess) )
$pid =  DllStructGetData( $tProcess , 'ProcessID' )

so I got the PID ... and now?

SetThreadDesktop: http://msdn.microsoft.com/en-us/library/windows/desktop/ms686250(v=vs.85).aspx  does not accept a PID.

 

And there is another problem:

"The SetThreadDesktop function will fail if the calling thread has any windows or hooks on its current desktop (unless the hDesktop parameter is a handle to the current desktop)."

What do they mean with "current desktop" ? The current inputDesktop or the desktop the proccess is currently running on?

any experts of the windows desktop system here?

 

best regards

Blues


My UDF: [topic='156155']_shellExecuteHidden[/topic]

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

@JohnOne

How is this related to the question?

 

@KaFu

I know the sites you linked but:

1. I want to change the desktop of another thread/ process while SetThreadDesktop only is dedicated to the calling thread > so SetThreadDesktop cannot be the right function?

2. MSDN explicit excludes the "current desktop."  and this is what I intend to do...get it on the currend desktop .. but this is just theory   :)

any practical experiences?

Blues


My UDF: [topic='156155']_shellExecuteHidden[/topic]

Share this post


Link to post
Share on other sites

and by the way:

any windows application has got a window ( except for console windows ).

The function would be totaly useless if it can only send console applications from one desktop to another

as they do not have visible information to show ... or what is my missunderstanding here?

Blues


My UDF: [topic='156155']_shellExecuteHidden[/topic]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

yes but a handle of a desktop not a handle of a process. This was part of my question

 

@Thread #5

I appologize: as I learned it is possible to create a system:windows-app without any window. So it seems an app with window on another desktop may be jailed there forever. :(

Edited by Bluesmaster

My UDF: [topic='156155']_shellExecuteHidden[/topic]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0