static int EnumObjectsCallback(ref DIDEVICEOBJECTINSTANCE pddoi, IntPtr pvRef)
 {
     GCHandle hResult = GCHandle.FromIntPtr(pvRef);
     List<DIDEVICEOBJECTINSTANCE> result = (List<DIDEVICEOBJECTINSTANCE>)(hResult.Target);
     result.Add(pddoi.Clone());
     return 1;
 }
 public void SetRange(DIDEVICEOBJECTINSTANCE o, int lowerRange, int upperRange)
 {
     DIPROPRANGE diproprange = new DIPROPRANGE();
     //
     diproprange.diph.dwSize       = Marshal.SizeOf(diproprange);
     diproprange.diph.dwHeaderSize = Marshal.SizeOf(diproprange.diph);
     diproprange.diph.dwObj        = o.dwType;
     diproprange.diph.dwHow        = (int)DIPH.BYID;
     diproprange.lMin              = lowerRange;
     diproprange.lMax              = upperRange;
     //
     this.pInputDevice.SetProperty((IntPtr)(DIPROP.RANGE), ref diproprange.diph);
 }