How to get Media Player to play * using C #?

I am writing an application to manage an existing WMP instance using C #.

My code currently looks something like this:

private const int WM_COMMAND = 0x111; private const int WMP9_PLAY = 0x4978; SendMessage(WMP.MainWindowHandle, WM_COMMAND, WMP9_PLAY, 0); 

This is great for pausing the media player, but if the media player is paused or stopped, it continues to the next track. The command is called play, but I might have the wrong meaning for it. Does anyone have the best value for WMP9_PLAY, or the best way to get WMP to play?

+4
source share
2 answers

Using Spy ++ (from the answer above), I was able to find another set of SendMessage parameters that is sent when the play / pause button on the Windows keyboard is pressed, which performs the task:

 SendMessage(WMP.MainWindowHandle, 0xC02B, 0x0000000C, 0x000E0000); 
+2
source

Source: https://habr.com/ru/post/1382033/


All Articles