Setting up the Z-Axis of the mouse
 
 
mtsmox  
(1/13/00 11:45:46 am)

How can I setup the mouse in DirectInput so that also the z-axis is processed? I have got an mousewheel and want to use it! 

It doesn't work, but if I check the capabilities of my mouse, it says I have 3 axis, so also an z-axis. 
But if I check the z-axis nothing happens!!! 
Do I have to set it up and HOW??? 

tnx 

Joren

Edited by mtsmox   at: 1/13/00 11:45:46 am



 
Spark  
(1/13/00 10:34:51 pm)

I think that it should work if you have a mouse with a mousewheel. I have an IBM mouse and it works fine. It has about 8 levels of scrolling, so if you go all the way down, the Z value is 
-960, and if you go up its 960. Here's some code that should work: 

Option Explicit 

Dim dx As New DirectX7 
Dim di As DirectInput 
Dim di_mouse As DirectInputDevice 
Dim di_state As DIMOUSESTATE 
Private Sub Form_Load() 
Set di = dx.DirectInputCreate 

Set di_mouse = di.CreateDevice("GUID_SysMouse") 
di_mouse.SetCommonDataFormat DIFORMAT_MOUSE 
di_mouse.SetCooperativeLevel Me.hWnd, DISCL_BACKGROUND Or DISCL_NONEXCLUSIVE 
di_mouse.Acquire 

End Sub 
Private Sub Timer1_Timer() 
di_mouse.GetDeviceStateMouse di_state 
Label1.Caption = di_state.z 
End Sub 
 

If it doesn't work... I don't know. 
-Spark