DefineDosDevice() private method

private DefineDosDevice ( DDD dwFlags, string lpDeviceName, string lpTargetPath ) : bool
dwFlags DDD
lpDeviceName string
lpTargetPath string
return bool
Beispiel #1
0
 private static void StopMonitoringKeyboardLeds()
 {
     for (ushort i = 0; i < 4; ++i)
     {
         string kbd_name = "dos_kbd" + i.ToString();
         NativeMethods.DefineDosDevice(DDD.REMOVE_DEFINITION, kbd_name, null);
     }
     Changed -= UpdateKeyboardLeds;
 }
Beispiel #2
0
        private static void StartMonitoringKeyboardLeds()
        {
            for (ushort i = 0; i < 4; ++i)
            {
                string kbd_name  = "dos_kbd" + i.ToString();
                string kbd_class = @"\Device\KeyboardClass" + i.ToString();
                NativeMethods.DefineDosDevice(DDD.RAW_TARGET_PATH, kbd_name, kbd_class);
            }

            Changed += UpdateKeyboardLeds;
        }
Beispiel #3
0
        public static void StopMonitoring()
        {
            Composer.Changed -= EnableTimer;
            DisableTimer();

            lock (m_kbd_devices)
            {
                foreach (ushort id in m_kbd_devices)
                {
                    NativeMethods.DefineDosDevice(DDD.REMOVE_DEFINITION, $"dos_kbd{id}", null);
                }
                m_kbd_devices.Clear();
            }
        }
Beispiel #4
0
        public static void StartMonitoring()
        {
            lock (m_kbd_devices)
            {
                // Try to create up to 4 keyboard devices
                for (ushort id = 0; id < 4; ++id)
                {
                    if (NativeMethods.DefineDosDevice(DDD.RAW_TARGET_PATH, $"dos_kbd{id}",
                                                      $@"\Device\KeyboardClass{id}"))
                    {
                        m_kbd_devices.Add(id);
                    }
                }
            }

            // Use a standard task timer to avoid blocking the composer thread
            EnableTimer();
            Composer.Changed += EnableTimer;
        }