?
Solved

A TMediaPlayer Prog

Posted on 2001-06-29
4
Medium Priority
?
274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 400 total points
ID: 6281996
I hope, you use one of them. Alex
0
 

Author Comment

by:shodgkiss
ID: 6283498
Thanks!!!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
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.
Suggested Courses

752 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