I am trying to make a music player in Python with support for Windows Media Center remotes.
Some buttons like play, pause, stop, FWD and RWD use APPCOMMAND, but I can’t capture any APPCOMMAND data using ctypes or pywin32.
What I have tried:
– Importing Win32 API via ctypes to access APPCOMMAND data.
– Using pywin32 library.
– Minimal test project
import ctypes
from ctypes import wintypes
# Import Win32 API
user32 = ctypes.WinDLL('user32')
msg = wintypes.MSG()
while True:
user32.PeekMessageW(ctypes.byref(msg), None, 0, 0, 1)
print(f"Message: {msg.message}, wParam: {msg.wParam}, lParam: {msg.lParam}, time: {msg.time}, hwnd: {msg.hWnd}")
Issue: cannot capture any APPCOMMAND data. I am using a Windows Media Center remote to send APPCOMMAND data.
Environment:
Python version: 3.x
Libraries: ctypes
How can I capture APPCOMMAND data using ctypes or any other method to use Windows Media Center remotes in Python?
Aleksander Sats is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1