|
Yazılım ve donamından
oluşan IR Player Control programının amacı; SIRCS veya CTRL-S protokolünü
kullanan SONY uzaktan kumandalarıyla WINDOWS XP yüklü bir PC deki Media Player
yazılımını paralel port üzerinden kontrol etmektir. Programı çalıştırarak SONY
kumandanız ile IR Player Control yazılıma bir kaç tuş ile
-VOLUME MUTE ( ses kapa
)
-VOLUME DOWN (sesi azalt )
-VOLUME UP ( sesi artır )
-NEXT TRACK ( bir sonraki parça )
-PREV TRACK ( bir önceki parça )
-STOP ( durdur )
-PLAY/PAUSE ( çal/beklet )
-LAUNCH MEDIA ( playeri aç )
fonksiyonlarını öğretin
ve PCden uzaklaşarak Windows Media Playeri kullanmanın keyfine bakın.
Oturduğunuz yerden sesi açın, kapatın, bir sonraki parçaya geçin vs vs vs
keyfini çıkarın...
IR Player
Control, kaynak kodları ile birlikte tamamen ücretsiz bir yazılımdır...
Donanım kısmı, IR alıcı
modülü, tersleyici ve PIC ten oluşmaktadır. SONY kumandadan alınan IR sinyaller
alıcı modül ile demodüle edilir ve çıkışı terslenerek PICe uygulanır. SONY SIRCS
protokolu start bit, 7 bitlik komut kodu ve 6 bitlik device kodu içerir. CTRL-S
protokolü ise SIRCS protokolünün 2 bit fazlasıdır. SONY protokollerinde veri
uzunluğu 45ms dir. Bunun 2400µs
si ise start bittir. 1 bitinin gönderilmesi 1200µs
lik H seviyesi ve 600µs
lik L seviyesinden oluşur. 0 bitinin gönderilmesi ise 600µs
lik H seviyesi ve 600µs
lik L seviyesi ise gerçekleştirilir. PICe yazılan programda ise start bitinden
sonra gelen 7 bitlik komut kodunun sadece 5 bitlik kısmı alınarak paralel porta
gönderilir. Sonuç olarak PIC komut kodlarını okuduğundan herhangi bir SONY
kumandasıyla devre sorunsuz çalıştırılabilir.

IR Player Control v2 donanımın Eagle formatındaki çizimini indir
Şekilde
donamının şeması verilmiştir. Donanım TSOP1240 IR alıcı modülü, PIC16F84A ve
CD4584 ten oluşmaktadır. U$2 ve U$8 LEDleri donamın test etmek içindir. Kumanda
sinyalleri geldiğinde normalde sönük olan U$2 LEDi yanıp-sönmeye başlar, U$8
LEDi ise söner. Kumandadan gelen sinyallerin kesilmesi ile tekrar yanar.
PIC
programı:
LIST P=16F84
PORTA EQU h'05'
PORTB EQU h'06'
STATUS EQU h'03'
TRISA EQU h'85'
TRISB EQU h'86'
WAITF EQU h'0E'
FH1 EQU h'20'
FH8 EQU h'21'
FHD EQU h'22'
FH2 EQU h'23'
CLRF PORTB
BSF STATUS, 5
CLRF TRISB
MOVLW h'FE'
MOVWF TRISA
BCF STATUS, 5
RESET CLRF PORTB
CLRF FH1
CLRF FHD
MOVLW h'4B'
MOVWF WAITF
MOVLW h'05'
MOVWF FH8
SGNWT BSF PORTA, 0
BTFSS PORTA, 1
GOTO SGNWT
BCF PORTA, 0
MOVLW h'64'
MOVWF FH1
KAYDIR DECFSZ FH1, F
GOTO KAYDIR
BTFSS PORTA, 1
GOTO RESET
CALL WAIT
DECFSZ WAITF, F
BTFSS PORTA, 1
GOTO RESET
CALL WAIT
DECFSZ WAITF, F
BTFSS PORTA, 1
GOTO RESET
CALL WAIT
DECFSZ WAITF, F
BTFSS PORTA, 1
GOTO RESET
CALL WAIT
DECFSZ WAITF, F
BTFSC PORTA, 1
GOTO RESET
CALL WAIT
DECFSZ WAITF, F
AGAIN NOP
NOP
CALL WAIT
DECFSZ WAITF, F
BTFSS PORTA, 1
GOTO JUMP
CALL WAIT
DECFSZ WAITF, F
NOP
NOP
CALL WAIT
DECFSZ WAITF, F
CALL YAZ1
GOTO CHECK
JUMP CALL WAIT
DECFSZ WAITF, F
CALL YAZ0
CHECK DECFSZ FH8, F
GOTO AGAIN
MOVF FHD, W
MOVWF PORTB
TIME CALL WAIT
DECFSZ WAITF, F
GOTO TIME
CALL NEW
GOTO RESET
WAIT MOVLW h'02'
MOVWF FH1
DONGU1 MOVLW h'64'
MOVWF FH2
DONGU2 DECFSZ FH2, F
GOTO DONGU2
DECFSZ FH1, F
GOTO DONGU1
RETURN
YAZ0 RLF FHD, F
BCF FHD, 0
RETURN
YAZ1 RLF FHD, F
BSF FHD, 0
RETURN
NEW MOVLW h'F0'
MOVWF FH1
DONGU11 MOVLW h'F0'
MOVWF FH2
DONGU22 DECFSZ FH2, F
GOTO DONGU22
DECFSZ FH1, F
GOTO DONGU11
RETURN
END
IR Player Control v2
PIC programını indir

donanım board üzerinde
Board üzerinde görülen
LED display PIC çıkışlarını görmek amacıyla konulmuştur.

paralel
port ile bağlantısı

müzik setimin kumandası
IR Player Control ün PC
arayüzü ise oldukça basittir ayrıca tray icon olarak gizlenebildiği gibi
öğrendiği kumanda fonksiyonlarını da txt olarak kaydettiğinden bir sonraki
açılışta tekrar hafızaya alabilme özelliği vardır.

Program LPTyi her 300ms
yede bir kontrol eder ve PICden gelen 5 bitlik datanın değişip değişmediğine
bakarak Windows Media Playerde bir fonksiyon yerine getirir. Extra olarak bu
fonksiyonlar kumandadan değil de IR Player Control paneli üzerinden de ilgili
butonlar aracılığı ile yapılabilir.
Program ilk çalıştığında
fonksiyonların öğretilmesi gerekir.
Örneğin IR Player
Control e Windows Media Playerin sesini açmayı öğretelim: Paneldeki "Fonksiyon
öğret" işaretlenir ve status bar kısmında "sinyal bekleniyor" mesajı belirir. Bu
anda kumandanızın, normalde tv nizin veya müzik setinizin sesi açmak için
kullandığınız butona basın. Status bardaki "sinyal bekleniyor" yazısı "sinyal
alındı fonk.seç" şeklini alana kadar kumandanızdaki butona basılı tutun. Bundan
sonra tek yapmanız gereken şey program üzerindeki "Vol +" tuşuna basarak gelen
sinyali kaydetmek. Aynı şekilde tüm fonksiyonları da kaydettikten sonra
kumandanızı alıp PC den uzak bir yerde keyfinize bakabilirsiniz. Bundan sonra
play/pause, ses açma-kapama, mute gibi işlemleri kumandanızla
gerçekleştireceksiniz. Unutmadan IR Player Control ile birlikte Windows Media
Player i de açmayı unutmayın veya Media butonuna basın açılsın. Siz yorulmayın
yeter. İsterseniz IR Player Control u "Trayde göster" i işaretleyerek de system
tray e aktarabilirsiniz.

System tray de IR Player
Control simgesine sağ fare tuşu ile tıkladığınızda yukarıda da görülen pop-up
menu belirir. Menüden programı gizleyebileceğiniz gibi tekrar gösterebilir ve
kapatabilirsiniz.
IR Player Control kaynak
kodu:
//---------------------------------------------------------------------------
#include <vcl.h>
#include <shellapi.h>
#include <winio.h>
#include <dos.h>
#include <mmsystem.h>
#pragma hdrstop
#include "traymain.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
DWORD dwPortVal;
int VOLUME_MUTE;
int VOLUME_DOWN;
int VOLUME_UP;
int MEDIA_NEXT_TRACK;
int MEDIA_PREV_TRACK;
int MEDIA_STOP;
int MEDIA_PLAY_PAUSE;
int LAUNCH_MEDIA_SELECT;
int normal=-122;
int okunan;
int yrd;
TFormMain *FormMain;
//---------------------------------------------------------------------------
__fastcall TFormMain::TFormMain(TComponent* Owner)
: TForm(Owner)
{
CheckBox1->Checked=true;
}
//----------------------------------------------------------------------------
void __fastcall TFormMain::DrawItem(TMessage& Msg)
{
IconDrawItem((LPDRAWITEMSTRUCT)Msg.LParam);
TForm::Dispatch(&Msg);
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::MyNotify(TMessage& Msg)
{
POINT MousePos;
switch(Msg.LParam)
{
case WM_RBUTTONUP:
if (GetCursorPos(&MousePos))
{
PopupMenu1->PopupComponent = FormMain;
SetForegroundWindow(Handle);
PopupMenu1->Popup(MousePos.x, MousePos.y);
}
else
Show();
break;
case WM_LBUTTONUP:
ToggleState();
break;
default:
break;
}
TForm::Dispatch(&Msg);
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::FormDestroy(TObject *Sender)
{
TrayMessage(NIM_DELETE);
}
//---------------------------------------------------------------------------
bool __fastcall TFormMain::TrayMessage(DWORD dwMessage)
{
NOTIFYICONDATA tnd;
PSTR pszTip;
pszTip = TipText();
tnd.cbSize = sizeof(NOTIFYICONDATA);
tnd.hWnd = Handle;
tnd.uID = IDC_MYICON;
tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
tnd.uCallbackMessage = MYWM_NOTIFY;
if (dwMessage == NIM_MODIFY)
{
tnd.hIcon = (HICON)IconHandle();
if (pszTip)
lstrcpyn(tnd.szTip, pszTip, sizeof(tnd.szTip));
else
tnd.szTip[0] = '\0';
}
else
{
tnd.hIcon = NULL;
tnd.szTip[0] = '\0';
}
return (Shell_NotifyIcon(dwMessage, &tnd));
}
//---------------------------------------------------------------------------
HICON __fastcall TFormMain::IconHandle(void)
{
return (Image1->Picture->Icon->Handle);
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::ToggleState(void)
{
}
//---------------------------------------------------------------------------
PSTR __fastcall TFormMain::TipText(void)
{
return ("IR Player Control");
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::CheckBox1Click(TObject *Sender)
{
if (CheckBox1->Checked)
{
TrayMessage(NIM_ADD);
TrayMessage(NIM_MODIFY);
}
else
TrayMessage(NIM_DELETE);
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::RadioButtonClick(TObject *Sender)
{
if (!CheckBox1->Checked)
return;
TrayMessage(NIM_MODIFY);
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::EditKeyUp(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if (!CheckBox1->Checked)
return;
TrayMessage(NIM_MODIFY);
}
//---------------------------------------------------------------------------
LRESULT IconDrawItem(LPDRAWITEMSTRUCT lpdi)
{
HICON hIcon;
hIcon = (HICON)LoadImage(g_hinst, MAKEINTRESOURCE(lpdi->CtlID), IMAGE_ICON,
16, 16, 0);
if (!hIcon)
return(FALSE);
DrawIconEx(lpdi->hDC, lpdi->rcItem.left, lpdi->rcItem.top, hIcon,
16, 16, 0, NULL, DI_NORMAL);
return(TRUE);
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::Properties1Click(TObject *Sender)
{
Show();
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::ToggleState1Click(TObject *Sender)
{
ToggleState();
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::Shutdown1Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::tym1Click(TObject *Sender)
{
Hide();
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::FormActivate(TObject *Sender)
{
InitializeWinIo();
int iFileHandle;
int iFileLength;
int iBytesRead;
char *pszBuffer;
//----------------------------file----------------------------------------
iFileHandle = FileOpen("VOLUME_MUTE.txt",fmOpenReadWrite);
iFileLength = FileSeek(iFileHandle,0,2);
FileSeek(iFileHandle,0,0);
pszBuffer = new char[iFileLength+1];
iBytesRead = FileRead(iFileHandle, pszBuffer, iFileLength);
FileClose(iFileHandle);
VOLUME_MUTE=StrToInt(pszBuffer);
//---------------------------------------------------------------------
iFileHandle = FileOpen("VOLUME_DOWN.txt",fmOpenReadWrite);
iFileLength = FileSeek(iFileHandle,0,2);
FileSeek(iFileHandle,0,0);
pszBuffer = new char[iFileLength+1];
iBytesRead = FileRead(iFileHandle, pszBuffer, iFileLength);
FileClose(iFileHandle);
VOLUME_DOWN=StrToInt(pszBuffer);
//---------------------------------------------------------------------
iFileHandle = FileOpen("VOLUME_UP.txt",fmOpenReadWrite);
iFileLength = FileSeek(iFileHandle,0,2);
FileSeek(iFileHandle,0,0);
pszBuffer = new char[iFileLength+1];
iBytesRead = FileRead(iFileHandle, pszBuffer, iFileLength);
FileClose(iFileHandle);
VOLUME_UP=StrToInt(pszBuffer);
//---------------------------------------------------------------------
iFileHandle = FileOpen("MEDIA_NEXT_TRACK.txt",fmOpenReadWrite);
iFileLength = FileSeek(iFileHandle,0,2);
FileSeek(iFileHandle,0,0);
pszBuffer = new char[iFileLength+1];
iBytesRead = FileRead(iFileHandle, pszBuffer, iFileLength);
FileClose(iFileHandle);
MEDIA_NEXT_TRACK=StrToInt(pszBuffer);
//-------------------------------------------------------------------
iFileHandle = FileOpen("LAUNCH_MEDIA_SELECT.txt",fmOpenReadWrite);
iFileLength = FileSeek(iFileHandle,0,2);
FileSeek(iFileHandle,0,0);
pszBuffer = new char[iFileLength+1];
iBytesRead = FileRead(iFileHandle, pszBuffer, iFileLength);
FileClose(iFileHandle);
LAUNCH_MEDIA_SELECT=StrToInt(pszBuffer);
//---------------------------------------------------------------------
iFileHandle = FileOpen("MEDIA_STOP.txt",fmOpenReadWrite);
iFileLength = FileSeek(iFileHandle,0,2);
FileSeek(iFileHandle,0,0);
pszBuffer = new char[iFileLength+1];
iBytesRead = FileRead(iFileHandle, pszBuffer, iFileLength);
FileClose(iFileHandle);
MEDIA_STOP=StrToInt(pszBuffer);
//---------------------------------------------------------------------
iFileHandle = FileOpen("MEDIA_PLAY_PAUSE.txt",fmOpenReadWrite);
iFileLength = FileSeek(iFileHandle,0,2);
FileSeek(iFileHandle,0,0);
pszBuffer = new char[iFileLength+1];
iBytesRead = FileRead(iFileHandle, pszBuffer, iFileLength);
FileClose(iFileHandle);
MEDIA_PLAY_PAUSE=StrToInt(pszBuffer);
//---------------------------------------------------------------------
iFileHandle = FileOpen("MEDIA_PREV_TRACK.txt",fmOpenReadWrite);
iFileLength = FileSeek(iFileHandle,0,2);
FileSeek(iFileHandle,0,0);
pszBuffer = new char[iFileLength+1];
iBytesRead = FileRead(iFileHandle, pszBuffer, iFileLength);
FileClose(iFileHandle);
MEDIA_PREV_TRACK=StrToInt(pszBuffer);
//---------------------------------------------------------------------
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::FormClose(TObject *Sender, TCloseAction &Action)
{
ShutdownWinIo();
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::Timer1Timer(TObject *Sender)
{
if (yrd==0) StatusBar1->Panels->Items[0]->Text="IR Player Control";
GetPortVal(0x379, &dwPortVal, 1);
StatusBar1->Panels->Items[1]->Text= IntToStr(dwPortVal);
if (!dwPortVal==-122) StatusBar1->Panels->Items[0]->Text="Hardware
algılanamadı";
if ((CheckBox2->Checked)&&(yrd==1))
{
if (dwPortVal!=normal)
{
okunan=dwPortVal;
StatusBar1->Panels->Items[0]->Text="Sinyal alındı fonksiyon seç";
}
}
if ((dwPortVal==VOLUME_DOWN)&&(!CheckBox2->Checked))
{
if (CheckBox3->Checked) sndPlaySound("beep.wav", SND_ASYNC | SND_FILENAME);
StatusBar1->Panels->Items[0]->Text="Vol -";
keybd_event(VK_VOLUME_DOWN, 0, KEYEVENTF_EXTENDEDKEY ,0);
keybd_event(VK_VOLUME_DOWN, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
Sleep(100);
}
if ((dwPortVal==VOLUME_UP)&&(!CheckBox2->Checked))
{
if (CheckBox3->Checked) sndPlaySound("beep.wav", SND_ASYNC | SND_FILENAME);
StatusBar1->Panels->Items[0]->Text="Vol +";
keybd_event(VK_VOLUME_UP, 0, KEYEVENTF_EXTENDEDKEY ,0);
keybd_event(VK_VOLUME_UP, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
Sleep(100);
}
if ((dwPortVal==MEDIA_PLAY_PAUSE)&&(!CheckBox2->Checked))
{
if (CheckBox3->Checked) sndPlaySound("beep.wav", SND_ASYNC | SND_FILENAME);
StatusBar1->Panels->Items[0]->Text="Play/Pause";
keybd_event(VK_MEDIA_PLAY_PAUSE , 0, KEYEVENTF_EXTENDEDKEY ,0);
keybd_event(VK_MEDIA_PLAY_PAUSE , 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
0);
Sleep(100);
}
if ((dwPortVal==MEDIA_NEXT_TRACK)&&(!CheckBox2->Checked))
{
if (CheckBox3->Checked) sndPlaySound("beep.wav", SND_ASYNC | SND_FILENAME);
StatusBar1->Panels->Items[0]->Text="Next track";
keybd_event(VK_MEDIA_NEXT_TRACK, 0, KEYEVENTF_EXTENDEDKEY ,0);
keybd_event(VK_MEDIA_NEXT_TRACK, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
Sleep(100);
}
if ((dwPortVal==MEDIA_STOP)&&(!CheckBox2->Checked))
{
if (CheckBox3->Checked) sndPlaySound("beep.wav", SND_ASYNC | SND_FILENAME);
StatusBar1->Panels->Items[0]->Text="Stop";
keybd_event(VK_MEDIA_STOP, 0, KEYEVENTF_EXTENDEDKEY ,0);
keybd_event(VK_MEDIA_STOP, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
Sleep(100);
}
if ((dwPortVal==LAUNCH_MEDIA_SELECT)&&(!CheckBox2->Checked))
{
if (CheckBox3->Checked) sndPlaySound("beep.wav", SND_ASYNC | SND_FILENAME);
StatusBar1->Panels->Items[0]->Text="Media";
keybd_event(VK_LAUNCH_MEDIA_SELECT, 0, KEYEVENTF_EXTENDEDKEY ,0);
keybd_event(VK_LAUNCH_MEDIA_SELECT, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
0);
Sleep(100);
}
if ((dwPortVal==VOLUME_MUTE)&&(!CheckBox2->Checked))
{
if (CheckBox3->Checked) sndPlaySound("beep.wav", SND_ASYNC | SND_FILENAME);
StatusBar1->Panels->Items[0]->Text="Mute";
keybd_event(VK_VOLUME_MUTE, 0, KEYEVENTF_EXTENDEDKEY ,0);
keybd_event(VK_VOLUME_MUTE, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
Sleep(100);
}
if ((dwPortVal==MEDIA_PREV_TRACK)&&(!CheckBox2->Checked))
{
if (CheckBox3->Checked) sndPlaySound("beep.wav", SND_ASYNC | SND_FILENAME);
StatusBar1->Panels->Items[0]->Text="Prev track";
keybd_event(VK_MEDIA_PREV_TRACK, 0, KEYEVENTF_EXTENDEDKEY ,0);
keybd_event(VK_MEDIA_PREV_TRACK, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
Sleep(100);
}
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::Button4Click(TObject *Sender)
{
if (CheckBox2->Checked)
{
MEDIA_STOP=okunan;
CheckBox2->Checked=false;
StatusBar1->Panels->Items[0]->Text="Stop eklendi";
yrd=0;
//-----------------file------------------------------------------------
int iFileHandle1;
AnsiString Temp;
Temp=IntToStr(MEDIA_STOP);
iFileHandle1 = FileCreate("MEDIA_STOP.txt");
FileClose(iFileHandle1);
int iFileHandle2;
iFileHandle2 = FileOpen("MEDIA_STOP.txt" , fmOpenReadWrite );
FileSeek(iFileHandle2,0,2);
FileWrite(iFileHandle2,Temp.c_str(),5);
FileClose(iFileHandle2);
//----------------------------------------------------------------------
}
else {
keybd_event(VK_MEDIA_STOP, 0, KEYEVENTF_EXTENDEDKEY ,0);
keybd_event(VK_MEDIA_STOP, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);}
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::Button7Click(TObject *Sender)
{
if (CheckBox2->Checked)
{
MEDIA_PLAY_PAUSE=okunan;
CheckBox2->Checked=false;
StatusBar1->Panels->Items[0]->Text="Play/Pause eklendi";
yrd=0;
//-----------------file------------------------------------------------
int iFileHandle1;
AnsiString Temp;
Temp=IntToStr(MEDIA_PLAY_PAUSE);
iFileHandle1 = FileCreate("MEDIA_PLAY_PAUSE.txt");
FileClose(iFileHandle1);
int iFileHandle2;
iFileHandle2 = FileOpen("MEDIA_PLAY_PAUSE.txt" , fmOpenReadWrite );
FileSeek(iFileHandle2,0,2);
FileWrite(iFileHandle2,Temp.c_str(),5);
FileClose(iFileHandle2);
//----------------------------------------------------------------------
}
else {
keybd_event(VK_MEDIA_PLAY_PAUSE, 0, KEYEVENTF_EXTENDEDKEY ,0);
keybd_event(VK_MEDIA_PLAY_PAUSE, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
0);}
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::Button3Click(TObject *Sender)
{
if (CheckBox2->Checked)
{
MEDIA_PREV_TRACK=okunan;
CheckBox2->Checked=false;
StatusBar1->Panels->Items[0]->Text="Prev track eklendi";
yrd=0;
//-----------------file------------------------------------------------
int iFileHandle1;
AnsiString Temp;
Temp=IntToStr(MEDIA_PREV_TRACK);
iFileHandle1 = FileCreate("MEDIA_PREV_TRACK.txt");
FileClose(iFileHandle1);
int iFileHandle2;
iFileHandle2 = FileOpen("MEDIA_PREV_TRACK.txt" , fmOpenReadWrite );
FileSeek(iFileHandle2,0,2);
FileWrite(iFileHandle2,Temp.c_str(),5);
FileClose(iFileHandle2);
//----------------------------------------------------------------------
}
else {
keybd_event(VK_MEDIA_PREV_TRACK, 0, KEYEVENTF_EXTENDEDKEY ,0);
keybd_event(VK_MEDIA_PREV_TRACK, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
0);}
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::Button8Click(TObject *Sender)
{
if (CheckBox2->Checked)
{
LAUNCH_MEDIA_SELECT=okunan;
CheckBox2->Checked=false;
StatusBar1->Panels->Items[0]->Text="Media eklendi";
yrd=0;
//-----------------file------------------------------------------------
int iFileHandle1;
AnsiString Temp;
Temp=IntToStr(LAUNCH_MEDIA_SELECT);
iFileHandle1 = FileCreate("LAUNCH_MEDIA_SELECT.txt");
FileClose(iFileHandle1);
int iFileHandle2;
iFileHandle2 = FileOpen("LAUNCH_MEDIA_SELECT.txt" , fmOpenReadWrite );
FileSeek(iFileHandle2,0,2);
FileWrite(iFileHandle2,Temp.c_str(),5);
FileClose(iFileHandle2);
//----------------------------------------------------------------------
}
else {
keybd_event(VK_LAUNCH_MEDIA_SELECT, 0, KEYEVENTF_EXTENDEDKEY ,0);
keybd_event(VK_LAUNCH_MEDIA_SELECT, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
0);}
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::Button2Click(TObject *Sender)
{
if (CheckBox2->Checked)
{
MEDIA_NEXT_TRACK=okunan;
CheckBox2->Checked=false;
StatusBar1->Panels->Items[0]->Text="Next track eklendi";
yrd=0;
//-----------------file------------------------------------------------
int iFileHandle1;
AnsiString Temp;
Temp=IntToStr(MEDIA_NEXT_TRACK);
iFileHandle1 = FileCreate("MEDIA_NEXT_TRACK.txt");
FileClose(iFileHandle1);
int iFileHandle2;
iFileHandle2 = FileOpen("MEDIA_NEXT_TRACK.txt" , fmOpenReadWrite );
FileSeek(iFileHandle2,0,2);
FileWrite(iFileHandle2,Temp.c_str(),5);
FileClose(iFileHandle2);
//----------------------------------------------------------------------
}
else {
keybd_event(VK_MEDIA_NEXT_TRACK, 0, KEYEVENTF_EXTENDEDKEY ,0);
keybd_event(VK_MEDIA_NEXT_TRACK, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
0);}
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::Button1Click(TObject *Sender)
{
if (CheckBox2->Checked)
{
VOLUME_MUTE=okunan;
CheckBox2->Checked=false;
StatusBar1->Panels->Items[0]->Text="Mute eklendi";
yrd=0;
//-----------------file------------------------------------------------
int iFileHandle1;
AnsiString Temp;
Temp=IntToStr(VOLUME_MUTE);
iFileHandle1 = FileCreate("VOLUME_MUTE.txt");
FileClose(iFileHandle1);
int iFileHandle2;
iFileHandle2 = FileOpen("VOLUME_MUTE.txt" , fmOpenReadWrite );
FileSeek(iFileHandle2,0,2);
FileWrite(iFileHandle2,Temp.c_str(),5);
FileClose(iFileHandle2);
//----------------------------------------------------------------------
}
else {
keybd_event(VK_VOLUME_MUTE , 0, KEYEVENTF_EXTENDEDKEY ,0);
keybd_event(VK_VOLUME_MUTE , 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);}
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::Button6Click(TObject *Sender)
{
if (CheckBox2->Checked)
{
VOLUME_DOWN=okunan;
CheckBox2->Checked=false;
StatusBar1->Panels->Items[0]->Text="Volume down eklendi";
yrd=0;
//-----------------file------------------------------------------------
int iFileHandle1;
AnsiString Temp;
Temp=IntToStr(VOLUME_DOWN);
iFileHandle1 = FileCreate("VOLUME_DOWN.txt");
FileClose(iFileHandle1);
int iFileHandle2;
iFileHandle2 = FileOpen("VOLUME_DOWN.txt" , fmOpenReadWrite );
FileSeek(iFileHandle2,0,2);
FileWrite(iFileHandle2,Temp.c_str(),5);
FileClose(iFileHandle2);
//----------------------------------------------------------------------
}
else {
keybd_event(VK_VOLUME_DOWN , 0, KEYEVENTF_EXTENDEDKEY ,0);
keybd_event(VK_VOLUME_DOWN , 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);}
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::Button5Click(TObject *Sender)
{
if (CheckBox2->Checked)
{
VOLUME_UP=okunan;
CheckBox2->Checked=false;
StatusBar1->Panels->Items[0]->Text="Volume up eklendi";
yrd=0;
//-----------------file------------------------------------------------
int iFileHandle1;
AnsiString Temp;
Temp=IntToStr(VOLUME_UP);
iFileHandle1 = FileCreate("VOLUME_UP.txt");
FileClose(iFileHandle1);
int iFileHandle2;
iFileHandle2 = FileOpen("VOLUME_UP.txt" , fmOpenReadWrite );
FileSeek(iFileHandle2,0,2);
FileWrite(iFileHandle2,Temp.c_str(),5);
FileClose(iFileHandle2);
//----------------------------------------------------------------------
}
else {
keybd_event(VK_VOLUME_UP, 0, KEYEVENTF_EXTENDEDKEY ,0);
keybd_event(VK_VOLUME_UP, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);}
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::CheckBox2Click(TObject *Sender)
{
int cevap;
if (CheckBox2->Checked) cevap=Application->MessageBoxA("Fonksiyon öğretme işlemi
boyunca status barı takip edin. ","IR Player'e fonksiyon atamak
üzeresiniz",MB_OKCANCEL+MB_ICONINFORMATION);
if (cevap!=1) CheckBox2->Checked=false;
else
{
StatusBar1->Panels->Items[0]->Text="Sinyal bekleniyor";
yrd=1;
}
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::Hakknda1Click(TObject *Sender)
{
Application->MessageBoxA("IR Player Control yazılımı, media programlarını
WINDOWS XP altında paralel port üzerinden SONY marka kumandalarla kontrol
edebilen, öğrenme ve kaydetme fonksiyonları olan tamamen ücretsiz bir
yazılımdır.\nBu program Tegin Yücel MAYADAĞLI tarafından yazılmıştır...\n\nTegin
Yücel MAYADAĞLI\nElektrik-Elektronik
Mühendisi\ne-mail:r2d2droids@yahoo.co.uk\nmsn:c3podroids@hotmail.com","Hakkında",MB_OK
+ MB_ICONINFORMATION);
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::Beep1Click(TObject *Sender)
{
if (CheckBox3->Checked) CheckBox3->Checked=false;
else CheckBox3->Checked=true;
}
//---------------------------------------------------------------------------
traymain.h:
//---------------------------------------------------------------------------
#ifndef traymainH
#define traymainH
//---------------------------------------------------------------------------
#include <Forms.hpp>
#include <StdCtrls.hpp>
#include <Controls.hpp>
#include <Classes.hpp>
#include <ExtCtrls.hpp>
#include <Menus.hpp>
#include <Graphics.hpp>
#include <jpeg.hpp>
#include <ComCtrls.hpp>
#define MYWM_NOTIFY (WM_APP+100)
#define IDC_MYICON 1006
extern HINSTANCE g_hinst;
LRESULT IconDrawItem(LPDRAWITEMSTRUCT lpdi);
//---------------------------------------------------------------------------
class TFormMain : public TForm
{
__published:
TCheckBox *CheckBox1;
TImage *Image1;
TPopupMenu *PopupMenu1;
TMenuItem *Properties1;
TMenuItem *Shutdown1;
TMenuItem *tym1;
TTimer *Timer1;
TButton *Button1;
TButton *Button2;
TButton *Button3;
TButton *Button4;
TButton *Button5;
TButton *Button6;
TButton *Button7;
TButton *Button8;
TLabel *Label2;
TCheckBox *CheckBox2;
TStatusBar *StatusBar1;
TMenuItem *Hakknda1;
void __fastcall FormDestroy(TObject *Sender);
void __fastcall CheckBox1Click(TObject *Sender);
void __fastcall RadioButtonClick(TObject *Sender);
void __fastcall EditKeyUp(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall Properties1Click(TObject *Sender);
void __fastcall ToggleState1Click(TObject *Sender);
void __fastcall Shutdown1Click(TObject *Sender);
void __fastcall tym1Click(TObject *Sender);
void __fastcall FormActivate(TObject *Sender);
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
void __fastcall Timer1Timer(TObject *Sender);
void __fastcall Button4Click(TObject *Sender);
void __fastcall Button7Click(TObject *Sender);
void __fastcall Button3Click(TObject *Sender);
void __fastcall Button8Click(TObject *Sender);
void __fastcall Button2Click(TObject *Sender);
void __fastcall Button1Click(TObject *Sender);
void __fastcall Button6Click(TObject *Sender);
void __fastcall Button5Click(TObject *Sender);
void __fastcall CheckBox2Click(TObject *Sender);
void __fastcall Hakknda1Click(TObject *Sender);
private: // private user declarations
void __fastcall DrawItem(TMessage& Msg);
void __fastcall MyNotify(TMessage& Msg);
bool __fastcall TrayMessage(DWORD dwMessage);
HICON __fastcall IconHandle(void);
void __fastcall ToggleState(void);
PSTR __fastcall TipText(void);
public: // public user declarations
virtual __fastcall TFormMain(TComponent* Owner);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_DRAWITEM,TMessage,DrawItem)
MESSAGE_HANDLER(MYWM_NOTIFY,TMessage,MyNotify)
END_MESSAGE_MAP(TForm)
};
//---------------------------------------------------------------------------
extern TFormMain *FormMain;
//---------------------------------------------------------------------------
#endif
IR Player Control v2 programını indir
IR Player Control v2 programının kaynak kodlarını indir part1
IR Player Control v2 programının kaynak kodlarını indir part2
IR Player Control v2 programının kaynak kodlarını indir part3
Kaynak kodlarını derlerken
Borland C++ Builder 5 veya üstü compiler kullanın!
|