public static void listenDeviceInfo(IntPtr handle) { IntPtr num1 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(LOGCONTEXTA))); try { Wintab32.WTInfoA(3U, 0U, num1); } catch { Marshal.FreeHGlobal(num1); return; } LOGCONTEXTA logcontexta = new LOGCONTEXTA(); LOGCONTEXTA structure = (LOGCONTEXTA)Marshal.PtrToStructure(num1, typeof(LOGCONTEXTA)); structure.lcPktData = Wintab32.PACKETDATA; structure.lcPktMode = 0U; structure.lcOptions = 2U; IntPtr num2 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(LOGCONTEXTA))); Marshal.StructureToPtr((object)structure, num2, false); hCtx = Wintab32.WTOpenA(handle, num2, true); Marshal.FreeHGlobal(num1); Marshal.FreeHGlobal(num2); }
public static void stopListenDeviceInfo() { if (!(hCtx != IntPtr.Zero)) { return; } Wintab32.WTClose(hCtx); hCtx = IntPtr.Zero; }
public static PACKET Msg2Packet(Message m) { if (m.Msg != 32752) { return(new PACKET()); } IntPtr num = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(PACKET))); Wintab32.WTPacket(m.LParam, (int)m.WParam, num); PACKET structure = (PACKET)Marshal.PtrToStructure(num, typeof(PACKET)); Marshal.FreeHGlobal(num); return(structure); }