Is this Mouse Speed code correct?

Just starting out? Need help? Post your questions and find answers here.
sybixsus
User
User
Posts: 14
Joined: Mon Jul 21, 2003 12:28 pm
Location: UK

Is this Mouse Speed code correct?

Post 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
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

Not sure, but i would have put @MouseSpeed instead of *MouseSpeed.
sybixsus
User
User
Posts: 14
Joined: Mon Jul 21, 2003 12:28 pm
Location: UK

Post 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.
Post Reply