Use PowerBuilder to Develop multimedia players

Source: Internet
Author: User
Tags objet

PowerBuilder, as an excellent front-end database R & D tool, is favored by many database developers. Currently, more and more databases are involved in multimedia applications, while PowerBuilder does not provide multimedia controls like VB and Delphi, it does not mean that multimedia cannot be developed using PowerBuilder. The following describes three methods for developing multimedia Using PowerBuilder (taking playvideo File AVI as an example ).

  I. Using OLE Method

Open the multimedia form to be played, click the ole control, the system will pop up the "insert object" dialog box, select the "createnew" Page, select a video clip, put the ole control on the form, compile a script for the form open event (for example, the video file to be played is sample. avi): ole_1.inserfile ("sample. run the form and double-click the OLE to play the video.

  Ii. Use the MCI Method

This method calls the Windows system's API function mcisendstringa. Therefore, you must declare this function first. Select the "declare/local external functions" menu item, and the "declare local external functions" dialog box pops up to declare a local external function: function long mcisendstringa (ref string scommand, ref string returnstr, int ilength, int unitucallback ). Put a command button cb_play on the form, whose text is "play", and input a script for the cb_play click event:

String ls_command, ls_buffer, ls_filename
Filename = "sample. avi ″
Ls_buffer = fill (Char (0), 255)
Ls_command = "open" + ls_filemane + "type avivideo alias avi ″
MciSendStringA (ls_command, ls_buffer, 255, handle (parent ))
Ls_command = "play avi policy ″
MciSendStringA (ls_command, ls_buffer, 255, handle (parent ))

Run the form and click this button to play the video.

  3. Use OCX controls

Windows 95 provides amovie. OCX control, which provides a lot of attributes and functions. You can program its attributes and call its functions to control multimedia and develop a high-quality multimedia player. Next we will take the development of a multimedia player with the playback and stop functions as an example.

On the form to be played, click the ole control. The "insert objet" dialog box is displayed. On the "insert control" Page, select "activemoviecontrolobject ", put the ole control on the form, and then put two command buttons cb_play and cb_stop on the form. Their text values are "play" and "stop" respectively ".

Enter a script for the open event in the form:

Ole_1.Objet.Filename ("sample. avi ″)
The script for the Click event of v cb_play is:
Ole_1.Object.play ()
The cb_stop Click Event script is:
Ole_1.object.stop ()

This simple multimedia player has been developed. If you want more control over multimedia, you can call the corresponding functions of the control and modify its attributes. You can click the Browser icon to view the events, attributes, and functions of the Amovie. ocx control.

View the source of this Article

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.