Page 1 of 1

Is this Mouse Speed code correct?

Posted: Tue May 24, 2005 7:41 pm
by sybixsus
This is a little DLL I'm trying to write which is supposed to use the USER32 SystemParametersInfo function to get and set the mouse speed. I'm using it as a DLL because I need to call it from Blitz3d.

GetMouseSpeed is currently returning 0, regardless of the mouse setting, so I'm evidently doing something wrong. It *could* be the way I'm calling the DLL from Blitz, in which case I'll have to ask over there how to call it, but I'd like to know if the code itself looks sound.

Code: Select all

#SPI_GETMOUSESPEED=112
#SPI_SETMOUSESPEED=113

ProcedureDLL.l GetMouseSensitivity()
  MouseSpeed.l=0
  SystemParametersInfo_(#SPI_GETMOUSESPEED,0,*MouseSpeed,#SPIF_SENDWININICHANGE)
  
  ProcedureReturn MouseSpeed
EndProcedure 

ProcedureDLL SetMouseSensitivity(Sense.l)
  SystemParametersInfo_(#SPI_SETMOUSESPEED,0,Sense,#SPIF_SENDWININICHANGE)
  
EndProcedure

Posted: Tue May 24, 2005 7:54 pm
by Polo
Not sure, but i would have put @MouseSpeed instead of *MouseSpeed.

Posted: Tue May 24, 2005 8:18 pm
by sybixsus
That was indeed the problem. I've never touched PureBasic pointers before, so didn't really know how to use them. Thanks for the fast and helpful response.