Solved

A TMediaPlayer Prog

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
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.

696 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