Jump to content

_shellExecuteHidden (allow no windows to become visible)


Bluesmaster
 Share

Recommended Posts

  • 1 month later...

Glad that I could help.

By the way I found out through some experiments, that the windows on such a  hidden desktop will not render their DCs ( device context )

so for automation with image regognition unfortunately you will have to switch to that desktop or get the window to the current desktop which I will describe another time.

regards

Blues

Would it be possible to move the window you originally created/launched on the hidden desktop to the "real" desktop to capture an image of it or do pixelsearch type functions? (and maybe set the window state to hidden so that you would not see it and it would not steal focus)

I was looking at SetProcessWindowStation function but I am not sure this is possible?

Link to comment
Share on other sites

This is a good question. I have planned to implement this later but it turns out to be non-trivial.

I thought about the setThreadDesktop - fcn http://msdn.microsoft.com/en-us/library/windows/desktop/ms686250(v=vs.85).aspx

but it doesnt accept any PID so a programm could only switch itself. ( with some limitations due to its window-handels... )

 

However I think this is worth an own thread: '?do=embed' frameborder='0' data-embedContent>>

And you could also ask in some more windows-specific forums ( and come back with the answer please :bye:  )

You could also switch toward the desktop, screenshot, and switch back...but this is a very ugly solution

regards

Blues

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

Link to comment
Share on other sites

 

You could also switch toward the desktop, screenshot, and switch back...but this is a very ugly solution

Do you mean make the hidden desktop the "foreground" or "active" desktop momentarily in order to take the screenshot? (and flash this on the user's screen?) If so, then yeah, I can see how that would look bad and be disruptive to the user.

I will try to do some more research on this...

Link to comment
Share on other sites

It works great. I ran into one problem that is doing a "runas". Is it possible? What if all my commands were done in a compiled executable and in a different compiled script I call the other doing a "runas", would everything in that second compiled script be running as the user I defined?

Link to comment
Share on other sites

  • 1 month later...
Help me, please write here the example code using _shellExecuteHidden, so as not to display any window:
Run ("ICQSETUP.EXE")
WinWaitActive ("Mirabilis ICQ 1.1132 Corp Beta")
ControlClick ("Mirabilis ICQ 1.1132 Corp Beta","",3)
WinWaitActive ("Mirabilis ICQ 1.1132 Corp Beta")
Send("{ENTER}")
WinWaitActive ("Mirabilis ICQ 1.1132 Corp Beta")
Send("{ENTER}")
WinWaitActive ("Mirabilis ICQ 1.1132 Corp Beta")
Send("{ENTER}")
If WinActive("Install") Then Send("{ENTER}")
WinWaitActive ("Mirabilis ICQ 1.1132 Corp Beta")
Send("{ENTER}")
WinWaitActive ("Mirabilis ICQ 1.1132 Corp Beta")
ControlClick ("Mirabilis ICQ 1.1132 Corp Beta","",4)
WinWaitActive ("Update Complete")
Send("{ENTER}")
WinWaitActive ("ICQ Intranet Client - Sign In")
ControlClick ("ICQ Intranet Client - Sign In","",2)
WinWaitClose ("ICQ Intranet Client - Sign In")
Send("!{F4}")
Thank you!

PS: I'm new to AutoIT, just starting to learn.
Link to comment
Share on other sites

  • 5 months later...

I tried  your application I am getting the error below, not sure if it's  <WinAPIEx.au3> that is wrong

>Running AU3Check (3.3.10.2)  from:C:Program Files (x86)AutoIt3  input:C:Usersanton_000Desktopdemo5_shellExecuteHidden.au3
"C:\Program Files (x86)\AutoIt3\Include\WinAPIEx.au3"(969,230) : error: $tagBITMAPINFOHEADER previously declared as a 'Const'.
Global Const $tagBITMAPINFOHEADER = 'dword biSize;long biWidth;long biHeight;ushort biPlanes;ushort biBitCount;dword biCompression;dword biSizeImage;long biXPelsPerMeter;long biYPelsPerMeter;dword biClrUsed;dword biClrImportant;'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:
Link to comment
Share on other sites

Thank you Universalist,

the example listed work as a charm, however when I tried to do some serious implementation of the concept to hide windows

as claimed with _shellExecuteHidden , it simply do not work

Look at my code the regular shellexecute  works, however the behaviour of _shellExecuteHidden is rather strange (seem to hung)

Dim $run= _shellExecuteHidden(@ComSpec,  " /c  start inetcpl.cpl","","")
;Dim $run= shellExecute(@ComSpec,  " /c  start inetcpl.cpl","","",@SW_HIDE)
Sleep(100)
ControlClick("Internet Properties", "", "[CLASS:Button; TEXT:OK]")
;~ProcessClose($run)
Sleep(1000)
MsgBox(0,"","iam here")
Link to comment
Share on other sites

all I really want to do is work on these

sysdm.cpl – System Properties
inetcpl.cpl – Internet Explorer Properties (general,security,privacy tab)
 
I will call  them silently or invisibly and do some work  send some, ie controlclick ect...  then close
Unfortunately the @sw_Hide does not work and however when I read about the _shellExecuteHidden I was very hopeful
so far no luck , If I am doing something wrong please point me to the right direction
Link to comment
Share on other sites

what I did so far, the script "appear" to be running however the controlsend, controlclick, controlcommand are not working for me 

 

$run= _shellExecuteHidden(@ComSpec,  " /c  start inetcpl.cpl")  ; change made
 
Opt("WinDetectHiddenText", 1)
Sleep(100)
$hWnd = WinGetHandle("Internet Properties")
WinActivate($hWnd)
Sleep(1000)
ControlCommand($hWnd, "", "[CLASS:Button; INSTANCE:7]", "UnCheck")
MsgBox(0,"","iam here1")
ControlClick($hWnd, "", "[CLASS:Button; TEXT:OK]")
Sleep(100)
MsgBox(0,"","iam here2")
 
one fact that is interesting if  I start the  inetcpl.cp windows and leave it on my desktop then run the script all the control suddenly work
 
very interesting fact .... food for thought,any input or comment is most appreciated, can someone try that snippet on their pc and let me know their finding !!! comment or suggestion

post-81487-0-47198600-1414848417_thumb.p

Edited by antonioj84
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...