Mouse speed
Blitz3D Forums/Blitz3D Programming/Mouse speed
| ||
In wich way can i modify the speed of the mouse under windows? I tryied the program in the code archives, but its only read the current speed and doesn't set the new speed. Const SPI_GETMOUSESPEED = 112 Const SPI_SETMOUSESPEED = 113 Const SPIF_SENDWININICHANGE = 2 Function GetMouseSpeed%() Local TempSpeed%, Speed% TempSpeed% = CreateBank(4) api_SystemParametersInfo(SPI_GETMOUSESPEED, 0, TempSpeed%, 0) Speed% = PeekInt(TempSpeed%, 0) FreeBank TempSpeed% Return Speed% End Function Function SetMouseSpeed(Speed%) Local TempSpeed%, Flags% TempSpeed% = CreateBank(4) PokeInt TempSpeed%, 0, Speed% Flags% = SPIF_SENDWININICHANGE api_SystemParametersInfo(SPI_SETMOUSESPEED, 0, TempSpeed%, Flags) FreeBank TempSpeed% End Function Print GetMouseSpeed() waitkey() SetMouseSpeed(4) Print GetMouseSpeed() |
| ||
If it's not a windowed program, it's easy to modify the speed just using code. |
| ||
So, what should i do? |
| ||
>So, what should i do? Well, you should obviously think about what you need to accomplish, then trawl through the 2D commandset and check the mouse related commands, then draw the logic on a piece of paper and then program it. Failing that, you can use this. PageUP and PageDOWN changes the scale# variable and thus the speed of movement. EDIT: I am worried though - This is really simple stuff and you don't even seem to be trying. Graphics 640,480 SetBuffer BackBuffer() scale#=1.0 Repeat xs=MouseXSpeed()*scale# ys=MouseYSpeed()*scale# MoveMouse 320,240 x=x+xs y=y+ys If KeyHit(201) Then scale#=scale#-0.1 If KeyHit(209) Then scale#=scale#+0.1 Cls Text x,y,"X",True,True Text 10,10,"Scale: "+scale# Flip Until KeyHit(1) End Andy |
| ||
Thanks, the program works, but in wich way can i set the windows option? The modify should works when the user turn on windows, not when the user execute the program. |
| ||
>Thanks, the program works, but in wich way can i set the >windows option? What windows option? >The modify should works when the user turn on windows, not >when the user execute the program. Well then, I misunderstood your question. I thought you couldn't do it in a B3D program. Andy |
| ||
Is possible using a windows dll(user32.dll, for example)? |
| ||
I guess it's possible, maybe you find some information at www.msdn.com |
| ||
I tryied the program in the code archives, but its only read the current speed and doesn't set the new speed. I can't speak for the modified version you've posted above, but the version I posted works fine. The compiled DLL is even in there as well. |
| ||
I guess my question would be why would you want to adjust windows parameters using Blitz? |
| ||
I found the solution. Thanks for the help. I've another question, but i'll post a new topic. |