Ejemplo n.º 1
0
		public Accelerometer()
		{
			RegistryKey tAcelMgrKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\TOSHIBA\\AcelUtil\\TAcelMgr");
			string path = (string)tAcelMgrKey.GetValue("PATH");
			tAcelMgrLibrary = NativeMethods.LoadLibrary(path);

			IntPtr getImmediateFunction = NativeMethods.GetProcAddress(tAcelMgrLibrary, "GetImmediate");
			getImmediate = (GetImmediate)Marshal.GetDelegateForFunctionPointer(getImmediateFunction, typeof(GetImmediate));

			IntPtr getZeroBaseFunction = NativeMethods.GetProcAddress(tAcelMgrLibrary, "GetZeroBase");
			getZeroBase = (GetZeroBase)Marshal.GetDelegateForFunctionPointer(getZeroBaseFunction, typeof(GetZeroBase));

			getZeroBase(out xMin, out yMin, out xMax, out yMax);

			XLength = (short)(XMax - XMin);
			YLength = (short)(YMax - YMin);
		}
Ejemplo n.º 2
0
        public Accelerometer()
        {
            RegistryKey tAcelMgrKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\TOSHIBA\\AcelUtil\\TAcelMgr");
            string      path        = (string)tAcelMgrKey.GetValue("PATH");

            tAcelMgrLibrary = NativeMethods.LoadLibrary(path);

            IntPtr getImmediateFunction = NativeMethods.GetProcAddress(tAcelMgrLibrary, "GetImmediate");

            getImmediate = (GetImmediate)Marshal.GetDelegateForFunctionPointer(getImmediateFunction, typeof(GetImmediate));

            IntPtr getZeroBaseFunction = NativeMethods.GetProcAddress(tAcelMgrLibrary, "GetZeroBase");

            getZeroBase = (GetZeroBase)Marshal.GetDelegateForFunctionPointer(getZeroBaseFunction, typeof(GetZeroBase));

            getZeroBase(out xMin, out yMin, out xMax, out yMax);

            XLength = (short)(XMax - XMin);
            YLength = (short)(YMax - YMin);
        }