Solved

A TMediaPlayer Prog

Posted on 2001-06-29
4
256 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

707 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now