0

Is there a way that Python can control Enable and Disable the Input Device?

By a manual way, Windows 10, it is in Settings > Manage sound devices > Input Device

enter image description here

I've tried codes, but not achieving what's wanted.

Reference: Disable/enable completely input devices (mouse+keyboard+touchpad) in Windows10

import ctypes
ctypes.windll.user32.BlockInput(True)

Reference: How to toggle microphone on and off using python

import win32api
import win32gui

WM_APPCOMMAND = 0x319
APPCOMMAND_MICROPHONE_VOLUME_MUTE = 0x180000

hwnd_active = win32gui.GetForegroundWindow()
win32api.SendMessage(hwnd_active, WM_APPCOMMAND, None, APPCOMMAND_MICROPHONE_VOLUME_MUTE)

Thank you.

Mark K
  • 7,725
  • 13
  • 50
  • 97

0 Answers0