KOD cpp: UKRYJ
//---------------------------------------------------------------------------
#include <vcl.h>
#include <vfw.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
OpenDialog1->Execute();
if (OpenDialog1->FileName!="")
{
MediaPlayer1->FileName=OpenDialog1->FileName;
MediaPlayer1->Open();
Form1->Caption="Odtwarzacz multimedialny: "+ExtractFileName(OpenDialog1->FileName);
TrackBar2->Max=MediaPlayer1->Length;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Application->Terminate();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TrackBar1Change(TObject *Sender)
{
waveOutSetVolume(0, (TrackBar1->Position*65535)+TrackBar1->Position);
int wartosc, procent;
String wynik;
wartosc=(TrackBar1->Position);
procent=(wartosc*10000)/65535;
if(procent!=10000)
{
if(procent!=0)
{
wynik=FormatCurr("Dzwiek: #%", (procent/100));
}
else
{
wynik="Dzwiek: 0%";
}
}
else
{
wynik="Dzwiek: 100%";
}
TrackBar1->ShowHint=TRUE;
TrackBar1->Hint=wynik;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TrackBar2Change(TObject *Sender)
{
TrackBar2->Position=MediaPlayer1->Position;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
TrackBar2->Position=MediaPlayer1->Position;
bool odswiezanie;
odswiezanie=TRUE;
if(!odswiezanie)
{
TrackBar2->Refresh();
}
else
{
odswiezanie=FALSE;
}
}
//---------------------------------------------------------------------------
#include <vcl.h>
#include <vfw.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
OpenDialog1->Execute();
if (OpenDialog1->FileName!="")
{
MediaPlayer1->FileName=OpenDialog1->FileName;
MediaPlayer1->Open();
Form1->Caption="Odtwarzacz multimedialny: "+ExtractFileName(OpenDialog1->FileName);
TrackBar2->Max=MediaPlayer1->Length;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Application->Terminate();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TrackBar1Change(TObject *Sender)
{
waveOutSetVolume(0, (TrackBar1->Position*65535)+TrackBar1->Position);
int wartosc, procent;
String wynik;
wartosc=(TrackBar1->Position);
procent=(wartosc*10000)/65535;
if(procent!=10000)
{
if(procent!=0)
{
wynik=FormatCurr("Dzwiek: #%", (procent/100));
}
else
{
wynik="Dzwiek: 0%";
}
}
else
{
wynik="Dzwiek: 100%";
}
TrackBar1->ShowHint=TRUE;
TrackBar1->Hint=wynik;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TrackBar2Change(TObject *Sender)
{
TrackBar2->Position=MediaPlayer1->Position;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
TrackBar2->Position=MediaPlayer1->Position;
bool odswiezanie;
odswiezanie=TRUE;
if(!odswiezanie)
{
TrackBar2->Refresh();
}
else
{
odswiezanie=FALSE;
}
}
//---------------------------------------------------------------------------
I jeszcze pytań parę. Niektóre filmy odtwarzane tym programikem działają poprawnie a niektóre nie, czy to wina braku jakichś kodeków w programie i jak je można dodać do programu? I czy da radę ustawić TrackBar2 w ten sposób, że gdy go przesuwam to przesuwa się również miejsce odtwarzania pliku?