Page 1 of 1
setFocus
Posted: Wed Aug 15, 2012 5:24 pm
by cvirus
Hello admin, is it possible ro getfocus on the window that you bring with the run command? This because i want to make an auto login with sendkeys in internet explorer but it aint working.
setFocus
Posted: Wed Aug 29, 2012 3:34 pm
by Marco
hi i`ve looked everwhere but can not find a good solution for it.
The only thing i can up with is the following code
I hope you can do something with it, best regards
`set focus to third party application
declare getforeground as "GetForegroundWindow" of user32
? result as integer
end declare
declare setforeground as "SetForegroundWindow" of user32
? hwnd as integer
end declare
dim ThirdPartyHWND as integer
`open or shell
open "notepad.exe"
`wait until foreground window is notepad
sleep 1000
`get windows handle of the active window(notepad)
getforeground.execute
ThirdPartyHWND=getforeground.result
`a testform to check all out it`s getting the focus
object testform as form
? object testbutton as button
? ? width=300
? ? caption="setfocus to third party app"
? ? onclick=setfoc
? end object
? showmodal
end object
sub setfoc
? ``set the focus to the earlier saved windows handle
? setforeground.hwnd=ThirdPartyHWND
? setforeground.execute
end sub
setFocus
Posted: Thu Aug 30, 2012 1:54 pm
by cvirus
Thanks Admin, it works but i got to make more tests. :D