Solved

A TMediaPlayer Prog

Posted on 2001-06-29
4
264 Views
Last Modified: 2012-06-27
OK, i need a program written in c++ builder 4 that is a bit like MediaPlayer but a lot simpler. Where can i download one from or can someone send me one.

thanks
0
Comment
Question by:shodgkiss
  • 3
4 Comments
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6240311
Here's some code from http://www.geocities.com/foetsch:

MCI_OPEN_PARMS OpenParams;
ZeroMemory(&OpenParams, sizeof(OpenParams));
OpenParams.lpstrDeviceType = "sequencer";
OpenParams.lpstrElementName = "some.mid";

// Send MCI_OPEN
mciSendCommand(0, // We're retrieving this!
MCI_OPEN,
// Don't forget to set the appropriate flags!
// The flags will tell MCI which elements of OpenParams
// you set:
MCI_OPEN_TYPE | // because you set DeviceType
MCI_OPEN_ELEMENT, // because you set lpstrElementName
(DWORD)&OpenParams);

// start playback
mciSendCommand(OpenParams.wDeviceID, MCI_PLAY, 0, NULL);

// ...
// stop playback
mciSendCommand(OpenParams.wDeviceID, MCI_STOP, 0, NULL);

// close the device
mciSendCommand(OpenParams.wDeviceID, MCI_CLOSE, 0, NULL);


See the SDK docs for details about the mciSendCommand function and the MCI_
commands.
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6240313
O, Plus 1 example(of Yoto Yotov ):
....
I have however an alternative which may be more suitable for you. The
mciSendString API function provides a quick and easy way to play all
sorts of multimedia files. Instead of using the memory-consuming and
sometimes unreliable MediaPlayer, you could simply send a few string
commands. For example:

1. Insert in your unit file:

#include <mmsystem.h>

2. Add a Button. Edit its OnClick event:

void __fastcall TForm1::MidButtonClick(TObject *Sender)
{
mciSendString("close MIDI", NULL, 0, 0);
mciSendString("open c:\\night.mid type sequencer " 
"alias MIDI", NULL, 0, 0);
mciSendString("play MIDI", NULL, 0, 0);
}

3. Edit the OnClose event of your form:

void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
mciSendString("close MIDI", NULL, 0, 0);
}

--
Yoto Yotov
....
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 100 total points
ID: 6281996
I hope, you use one of them. Alex
0
 

Author Comment

by:shodgkiss
ID: 6283498
Thanks!!!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question