線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1254
推到 Plurk!
推到 Facebook!

請問有關開起檔案的問題....

 
Asingboy
一般會員


發表:1
回覆:0
積分:0
註冊:2006-12-27

發送簡訊給我
#1 引用回覆 回覆 發表時間:2006-12-27 11:52:55 IP:220.134.xxx.xxx 訂閱
我寫了一隻程式 功能是 秀出現在時間的電子鐘 然後能設定指定時間 時間到後會showmessage
不過現在我想要加入一個能瀏覽電腦裡檔案的功能 並能選取指定的檔案(.mp3或是其他音樂檔)
然後在我設定好的指定時間到時讓該指定檔案用windows內的播放器播放就可以了
整體的功能就是能自己設定鈴聲的鬧鐘 感覺跟windows內建的"排定的行程"很像
目前我已經把秀電子鐘跟設定指定時間做好了 不過我不知道要怎樣能瀏覽電腦內檔案並且指定某個檔案
還有我也不知道要怎樣讓那個指定檔案在我時間到時自己開啟.... 請各位高手大大指點迷津摟...3q
以下是我目前寫好的程式碼:
//---------------------------------------------------------------------------
#include
#pragma hdrstop
#include
#include
#include
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
bool a,b;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
Word Hour,Min,Sec,MSec ;
Label2->Caption="" VarToStr(Time()) " ";
DecodeTime(Now(), Hour, Min, Sec, MSec);
if ((a==true)&&(Hour==StrToInt(Edit1->Text))&&(Min>=StrToInt(Edit2->Text)))
{
Beep();
if (b==true)
{
b=false;
ShowMessage("時間到了!!!");
Label5->Caption="鬧鈴已解除";
a=false;
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if ((Edit1->Text=="")&&(Edit2->Text==""))
{
ShowMessage("請輸入鬧鈴時間!!");
}
else
{
Label5->Caption="鬧鈴已設定";
a=true;
b=true;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Label5->Caption="鬧鈴已解除";
a=false;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
GroupBox1->Visible=false;
Timer1->Enabled = true;
a=false;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------

hobolin
初階會員


發表:0
回覆:25
積分:25
註冊:2005-07-03

發送簡訊給我
#2 引用回覆 回覆 發表時間:2007-02-03 14:59:10 IP:59.115.xxx.xxx 訂閱
在 system 下有一個 TMediaPlayer 元件可以利用

貼上 BCB 的 help 給你參考

<textarea cols="60" rows="10" class="cpp" name="code"> char sWinDir[255]; GetWindowsDirectory(sWinDir, sizeof(sWinDir)); MediaPlayer1->FileName = AnsiString(sWinDir) "\\Clock.avi"; //specify video file MediaPlayer1->DeviceType = dtAVIVideo; //set Device compatibility to AVI MediaPlayer1->Display = Panel1; //Set display device to a TPanel MediaPlayer1->Open(); MediaPlayer1->Play(); </textarea> 以上 hobo@tdtv.tinp.net.tw
系統時間:2024-04-30 16:20:00
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!