0
votes

I have started a command line MP3-player (Fmedia). How do I send (Hotkeys) commands to that app. when it's running? I have the PID.

I can't seem to find it, besides a way to kill a running proccess.

Dim strApp, PID
strApp = "C:\Take5-V4\fmedia\fmedia-gui.exe """ & strFilename & """"
PID = Shell(strApp, vbNormalFocus)
1

1 Answers

1
votes

You can use SendKeys to send hotkeys.

The documentation on it has an example that's nearly exactly what you want. I've adapted it to your needs:

Dim strApp, PID
strApp = "C:\Take5-V4\fmedia\fmedia-gui.exe """ & strFilename & """"
PID = Shell(strApp, vbNormalFocus)
AppActivate PID
SendKeys "A", True 'Sends the A key to your program.

If you don't want to activate the application, it's still possible through the WinAPI SendMessage method, but substantially more complex.