B4J Question Focus on App

Patent

Member
Licensed User
Longtime User
Dear Community,

wanna get the OS-Focus (MS-Windows) (to handle the key-events) to my B4J App if i do a Mouse-Hover over my App.
If i Mouseclick to my App it works as usually, the OS -and Java and so on send the Key Events to my App. All right.
If another App has the Focus the Key-Events goes to this App.
Right OS Behaviour at all.
(Mouse -Entered Events are working without this OS-Focus as well).

Question as above: How set the OS-Focus (for Key Events)?

thanks for ideas

Patent
 

Daestrum

Expert
Licensed User
Longtime User
You could use hotkeys - but you need to find combinations that are not used by other running apps. CTRL+ALT+J etc.

If you want all keypresses to go to your app, then you are basically writing a keylogger, Windows will fight against that and so will most A/V softwre.
 
Upvote 0

Patent

Member
Licensed User
Longtime User
You could use hotkeys - but you need to find combinations that are not used by other running apps. CTRL+ALT+J etc.

If you want all keypresses to go to your app, then you are basically writing a keylogger, Windows will fight against that and so will most A/V softwre.
Thanks for Thinking!

I want to clarify:
I got the Mouse_Entered Event on MainForm, if the app has the OS Focus or not, i got it. OK
So i could handle the Focus-Thing.
But
Root(B4XView).RequestFocus will not work, if the General OS Focus is not on my App.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
You need to get the app handle ans set the focus, using either reflection or jna
 
Upvote 0
Top