Easily create a RealPlayer player with C Builder
Ma Minshen, Five Dalian Chi City Bureau of Statistics
Today's REALPLAYER's streaming media file is gradually rising with its powerful video compression. The RealPlayer Plus player is also a preferred software for playing the RealPlayer format file. However, RealPlayer Plus is not perfect, such as starting time, large space, and historical records. In fact, we can use C Builder to create a RealPlayer player that fully meets yourself. Below I will introduce you how to use C Builder to help you achieve this wish. But the premise is that you must have a RealPlayer Plus player in your machine, because we have to use its own ActiveX control. First, we have to import the required ActiveX control in C Builder. Click on the menu "Component → Import ActiveX Control ..." Open the Import ActiveX dialog box. In the Import ActiveX list box, we can see all registered AxctiveX controls in Windows. Select "RealPlayer ActiveX Control Library" control. Then click the "Install" button. Go back to the main interface of the C Builder, you will find a component called Reaudio in the ActiveX tab in the VCL panel. Let us put it in the form. However, in the default, the Reaudio component has no video playback window, which is only to play sound. This is what we don't want to see. At this time we can add the following code in the Reaudio component's Controls property: ImageWindow, ControlPanel, Statusbar where: ImageWindow, ControlPanel, Statusbar indicate the display video play window, the control strip. After adding the code, we can find that the appearance of the control has changed to a video playback window shape. Then set the Align property to AlClient, so that the playback window can vary with the form of the form, so that everyone can pull the play window size at will when watching the movie animation. Then, add the TMAINMENU component in the window, one of the TopEndialog components. Used to select and open the playback video file. Double-click the TMAINMENU component and enter the menu designer. Here, we want to design a menu item File and two submenu Open, exit. After the design is complete: Double-click Open to add the following code: void __fastcall tform1 :: o1click (TOBJECT * Sender) {if (OpenDialog1-> Execute ()) {realaudio1-> source = OpenDialog1-> filename; / / Open and start player}} Double click EXIT to add the following code: // ---------------------------------- ----------------------------------------- void __fastcall tform1 :: x1click (TOBJECT * Sender) {close (); // Termination Program Run}
In order to open a file, it is easy to select the file, set the Filter property of the OpenDialog component as follows: All media files (* .rm, *. RAM, *. RA, *. SWF, *. Mp3) | * .rm ; *. ram; *. ra; *. SWF; *. mp3 | *. * | *. *. Finally, you can compile and run. This program is debugged in the environment of Windows 98, C Builder 5.0.