views:

124

answers:

1

Since getting a satisfactory answer on SuperUser is very difficult, I want to rephrase this question and ask:

Is there any way to programatically detect a mouse was plugged in the usb port, and change the cursor speed in windows (perhaps through an API)?

I'd like to use C#, but I'm open to any language that can run on a windows 7 machine.

+2  A: 

I don't know about the detection but you can use P/Invoke to the SystemParametersInfo api using

[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SystemParametersInfo(SPI uiAction, uint uiParam, String pvParam, SPIF fWinIni);

with the uiAction as (SPI_SETMOUSESPEED) = 0x0071

Preet Sangha
Great, now I only need the other part. Thanks.
Juan Manuel
Does http://bytes.com/topic/c-sharp/answers/740363-need-detect-insertion-removal-usb-drive help?
Preet Sangha
Perhaps, I'll test it when I have a chance
Juan Manuel