• From Tools Windows Click Choose Items Select Com Components Tab. Search for 'Windows Media Player' and click ok. Now you can see the Windows Media player will be added in your Tools windows, Just drag and drop the control to your winform.
  • Turning off Windows Media Player will not uninstall it, or save any hard drive space. If you like, you can install or uninstall the Windows Media Player feature to no longer have it available for all users on the PC. Uninstalling Windows Media Player will have it no longer available to turn on or off, and will free up around 57.4 MB of space on.


A member asked in our C# Facebook group about how can he implement a Video player in C# windows forms. So here I’ve wrote the complete tutorial.

Steps:

Reinstall Windows Media Player Windows 10

Get the latest Media Player downloads from the Official Microsoft Download Center. C# - Windows Forms - Media Player. Ask Question Asked 5 years, 4 months ago. Windows Media Player is embedded without controls, and with only the.

1- You have to include Microsoft.DirectX.AudioVideoPlayback.dll in your Project.
>> [check how to attach a dll in csharp windows form?]2- Now add this Assembly to your project.

Download
The Mixed Mode Assembly….version ‘v1.1.4322’ error:
3- Third important step is you have to edit your app.config file as follows. Locate this file in your application’s project & open it.
C windows forms media player
Write this line of code in between <configuration> </configuration>.

We are adding above code in our app.config file because sometimes the following error occurs in our application.

This error is due to .Net version compatibility. It can be resolved by adding above code in your app.config file.

Source Code:


4- And the work is done. All you have to do is see this code & if you need any more functions in this add them.

Download:

Download this source code with complete windows forms & all files.

Media

You can use this snippet to stop the windows music, yes, if you use the following code you'll be able to stop (or jump to next and previous track) the music of windows. That means that any active music player we'll respond to the action. This is possible thanks to the simulation of a keypress of the system using the user32.dll and the keybd_event function.

Implementing

To start, we need to include the following namespace in the main class of our project.

Then we are going to import into our project the user32.dll , this api will allow us to get acces to the keybd_event function which we will use to simulate a couple of key press in the system. Immediately, create the method too using :

Now we'll be able to simulate the key events that we need to play-pause-JumpToNextTrack or JumpToPreviousTrack, but we need to declarate too the in variables the codes of the keys that we want to simulate. Just add the following variables in the class (note that they need to be accesible for all the methods):

C windows forms media player software

To simulate events, use the following lines of code (everyline does something different, captain obvious) :

The keybd_event function expects as first parameter the code of the key that will be simulated. Now you just need to add a couple of buttons to your form and attach those functions to click events of the buttons.

A final implementation should work like a charm, the following gif shows the app working with Spotify music. A you may know this app doesn't have any spotify code or anything else, it will only simulate a keyboard event on the system. Therefore this function will work for any music player for windows.

Complete class

Install Windows Media Player

C Windows Forms Media Player

Your class should look like the following when you add the buttons :

Have fun !