WinForm video playback

Source: Internet
Author: User

1. Background

In the past few days, an old friend asked me to make a small software program to play videos in WinForm. In the impression, Microsoft has a WM control that can be used directly.

2 Implementation Method 2.1 Microsoft grassroots

The simplest way is to directly use Microsoft's WM control and integrate it through COM. The procedure is as follows:

L toolbox reference

N create a new Tab page in the toolbox and name it Windows Media Player (randomly named). Right-click it and select it, as shown in

N select the Com panel, find the control shown in, and reference it.

N after the reference is successful, as shown in. This control already exists in the toolbox. Drag this control directly to the page.

L code development

The code is relatively simple, as shown in. Detailed code is provided in the download file

2.2

The player used in impressions should be traced back to the university. at that time, Kingsoft film overlord and hero RealPlay player were used. then it was a storm video. Till now, I have been using this player. I personally feel very good. now, let's get down to the truth.

Once installed successfully, the Com component is also installed for development and use by programmers. in fact, it also has another function, which can be used to play videos on Web pages. It should be implemented in the form of a cab package. If you are interested, you can study it. the method of referencing Microsoft WM is the same. shows its name in Com.

L toolbox reference

After successful reference, as shown in

L code development

The code is actually quite simple. it is worth noting that do not directly drag this control to the page, otherwise the page will be very stuck, or even VS will be stuck. as shown in, declare a page variable and load it to the GroupBox control.

Other code is shown in. Detailed code is in the downloaded file.

Appendix: After Com is successfully referenced, DLL reference is shown in

 

Source code file, downloaded from Baidu online storage

Http://pan.baidu.com/s/1o6LTx6U

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.