setFocus
setFocus
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
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