keybd_event along with PostMessage win32 not working when Visual Studio has focus (or any application run as admin)

后端 未结 2 585
别跟我提以往
别跟我提以往 2020-12-04 00:39

This is a program that I have used with many changes from the old xp day\'s It\'s a cmd line program that will change track in media applications(Spotify,vlc,mediaPlayer) j

2条回答
  •  独厮守ぢ
    2020-12-04 01:16

    The problem is VS has the focus when the message is sent, you can only put this to work with the focus on the correct application.

    To work around this put a Thread.Sleep before the call to keybd_event and F5 before the sleep and change the focus to the correct place in this time.

提交回复
热议问题