When window lost focus, joysick became weird

Blitz3D Forums/Blitz3D Programming/When window lost focus, joysick became weird

amitjf(Posted 2008) [#1]
Hi, I have a very strange problem, which is that i have a program that use the joystick, but when another window(for example notepad) gets the focus and the program loses it, the program gets many commands from the joystick(I think that all the possible command but i dont know).
Please help


Ginger Tea(Posted 2008) [#2]
do you mean when the program you wrote regains focus it wont accept joystic input or that it doesnt when out of focus?

if its b> out of focus then thats how windows does its thing, to play a game it should always be in focus hence why most are full screen save for the casual market (which are mostly mouse driven)

for example your choice of citing note pad
if not pad is out of focus whatever keys you type dont appear in note pad
because windows or you has moved the focus elsewhere and keypresses are going to that program to deal with (its just that notepad isnt geared up to accept user input from a gamepad)

again if yours was a wsad+mouse fps and note pad had focus all your wsad space and mouse input would be kinda like this
wwwwwwwwwwwwwwwwwwwwwwwww space wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwd



amitjf(Posted 2008) [#3]
ok ill explain myself better.
when my program loses focus and i do nothing with the joystick, i discovered that my program get 0 from the JoyHat() instead of -1.


amitjf(Posted 2008) [#4]
Well I solved it using Getfocus() api (user32), to check whether the window is in focus or not, but even though, i wouldn't expect from blitz to have this problem...