我目前正在使用以下功能来检测 MCE 遥控器上的特殊按钮按下(播放、停止、暂停)。
Private Const WM_APPCOMMAND As Integer = &H319
Public Function WndProc(hwnd As IntPtr, msg As Integer, wParam As IntPtr, lParam As IntPtr, ByRef handled As Boolean) As IntPtr
If msg = WM_APPCOMMAND Then
Dim cmd As Integer = CInt(CUInt(lParam) >> 16 And Not &HF000)
Select Case cmd
Case 13 'Stop
'Some Code
Exit Select
Case 47 'Pause
'Some Code
Exit Select
Case 46 'Play
'Some Code
Exit Select
End Select
handled = True
End If
Return IntPtr.Zero
End Function
我也想要使用彩色按钮的功能,但是当它们被按下时,它们似乎没有为 cmd 返回任何东西。
有没有办法实现这个功能?