MouseZSpeed Bug?

Blitz3D Forums/Blitz3D Programming/MouseZSpeed Bug?

Whenever my program looses focus (ie if I click on another window), I get very strange results from mousezspeed... -5 and things like that (whereas the documentation states it can only return 1,0 and -1). Here's some code to test this, I'm wondering if this is a bug, and if there is a way to get around it...

While Not KeyHit(1)
	vMouseZSpeed=MouseZSpeed()
	If Not vMouseZSpeed=0 Then
		Print vMouseZSpeed
	End If
Wend



Edit : if I also display MouseZ() like this :

While Not KeyHit(1)
	vMouseZSpeed=MouseZSpeed()
	If Not vMouseZSpeed=0 Then
		Print vMouseZSpeed
		Print MouseZ()
	End If
Wend


It is clear that the mousewheel is always reset to 0 when the program looses focus. This is not acceptable for my program... Anyone know how to fix it?

well, you can know if your program has an active focus by using the user32.dll and the user32.decls from the code archives:

api_getactivewindow()

returns 0 or window handle if the windows is focused.

Hope it helps...

Thanks, it seems to work perfectly!