Solved

A TMediaPlayer Prog

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
convert char array to number in c 5 85
thread-safe code in c++ 2 102
I could not build boost code, 10 88
How to read a c++ line with strings and variable numbers of elements 6 27
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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 user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

777 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