I am writing a program in which the user can vary the mouse speed, and I need to restore it to its original value on exit. I am able to set the mouse speed OK but I cannot read it. Here's some test code (VB2010):
Code:
	<System.Runtime.InteropServices.DllImport("User32.dll", EntryPoint:="SystemParametersInfo")> _
	Public Shared Function SystemParametersInfo(ByVal uAction As Int32, ByVal uParam As Int32, ByVal pvParam As IntPtr, ByVal fuWinIni As Int32) As Int32
	End Function

	Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
		Const SPI_GETMOUSESPEED As Int32 = &H70
		Const SPI_SETMOUSESPEED As Int32 = &H71
		Dim setValue As Integer = 17
		Dim setValuePtr As New IntPtr(setValue)
		Dim getValue As Integer
		Dim getValuePtr As New IntPtr(getValue)
		SystemParametersInfo(SPI_SETMOUSESPEED, 0, setValuePtr, 0)
		SystemParametersInfo(SPI_GETMOUSESPEED, 0, getValuePtr, 1)
		Console.WriteLine(getValue.ToString)
	End Sub
This sets the mouse speed correctly (to 17 in the above code) but the console output is always 0. Can anyone see what's wrong?

The msdn documentation is as follows:
Name:  mouseSpeed.png
Views: 832
Size:  10.9 KB