Пример #1
0
        public static void getMonitorInfos()
        {
            screenNum     = 0;
            listener      = new MonitorInfosCallback(onMonitorInfoCallback);
            mMonitorInfos = new HNStruct.MONITORINFOEX[10];
            HuionDriverDLL.EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero, listener, IntPtr.Zero);
            int    num1 = Marshal.SizeOf(typeof(HNStruct.MONITORINFOEX));
            IntPtr num2 = Marshal.AllocHGlobal(num1 * 10);
            long   num3 = 0;

            switch (IntPtr.Size)
            {
            case 4:
                num3 = (long)num2.ToInt32();
                break;

            case 8:
                num3 = num2.ToInt64();
                break;
            }

            for (int index = 0; index < 10; ++index)
            {
                Marshal.StructureToPtr((object)mMonitorInfos[index], new IntPtr(num3), false);
                num3 += (long)num1;
            }

            HuionDriverDLL.hnd_refresh_monitors(num2, (uint)screenNum);
            Marshal.FreeHGlobal(num2);
        }
Пример #2
0
 public static bool CheckHotkey(IntPtr handle, HuionKeyEventArgs hotKey)
 {
     HuionDriverDLL.KeyModifiers fsModifiers = HuionDriverDLL.KeyModifiers.None;
     if (hotKey.Control)
     {
         fsModifiers |= HuionDriverDLL.KeyModifiers.Ctrl;
     }
     if (hotKey.Alt)
     {
         fsModifiers |= HuionDriverDLL.KeyModifiers.Alt;
     }
     if (hotKey.Window)
     {
         fsModifiers |= HuionDriverDLL.KeyModifiers.WindowsKey;
     }
     if (hotKey.Shift)
     {
         fsModifiers |= HuionDriverDLL.KeyModifiers.Shift;
     }
     if (!HuionDriverDLL.RegisterHotKey(handle, 1000, fsModifiers, hotKey.KeyCode))
     {
         return(false);
     }
     HuionDriverDLL.UnregisterHotKey(handle, 1000);
     return(true);
 }
Пример #3
0
 private static bool onMonitorInfoCallback(IntPtr hMonitor, IntPtr hdcMonitor, ref HNStruct.RECT lprcMonitor,
                                           IntPtr dwData)
 {
     HNStruct.MONITORINFOEX lpmi = new HNStruct.MONITORINFOEX();
     lpmi.Size = Marshal.SizeOf(typeof(HNStruct.MONITORINFOEX));
     HuionDriverDLL.GetMonitorInfo(hMonitor, ref lpmi);
     mMonitorInfos[screenNum] = lpmi;
     ++screenNum;
     return(true);
 }
Пример #4
0
        public static bool showMainWindow(IntPtr handle)
        {
            if (HuionDriverDLL.IsWindowVisible(handle))
            {
                HuionDriverDLL.SetForegroundWindow(handle);
                return(true);
            }

            HuionDriverDLL.ShowWindow(handle, 5);
            return(!HuionDriverDLL.SetForegroundWindow(handle));
        }
Пример #5
0
 public static void listenHotKey(IntPtr handle, Void callback, HuionKeyEventArgs hotKey)
 {
     showFormEvent += callback;
     HuionDriverDLL.KeyModifiers fsModifiers = HuionDriverDLL.KeyModifiers.None;
     if (hotKey.Control)
     {
         fsModifiers |= HuionDriverDLL.KeyModifiers.Ctrl;
     }
     if (hotKey.Alt)
     {
         fsModifiers |= HuionDriverDLL.KeyModifiers.Alt;
     }
     if (hotKey.Window)
     {
         fsModifiers |= HuionDriverDLL.KeyModifiers.WindowsKey;
     }
     if (hotKey.Shift)
     {
         fsModifiers |= HuionDriverDLL.KeyModifiers.Shift;
     }
     HuionDriverDLL.RegisterHotKey(handle, 1000, fsModifiers, hotKey.KeyCode);
 }
Пример #6
0
 public static void unlistenHotKey(IntPtr handle)
 {
     // ISSUE: reference to a compiler-generated field
     showFormEvent = (Void)null;
     HuionDriverDLL.UnregisterHotKey(handle, 1000);
 }