?? shipinunit.pas
字號:
procedure Tshipinform.addClick(Sender: TObject);
var
count:integer;
begin
OpenDialog1.Options:=[ofHideReadOnly,ofEnableSizing,ofallowmultiselect];
if OpenDialog1.Execute then
begin
for count:=0 to OpenDialog1.Files.Count-1 do
begin
if (pos('.rm',OpenDialog1.Files.Strings[count])<>0)or(pos('.ram',OpenDialog1.Files.Strings[count])<>0)or(pos('.ra',OpenDialog1.Files.Strings[count])<>0)or (pos('.avi',OpenDialog1.Files.Strings[count])<>0)or (pos('.RM',OpenDialog1.Files.Strings[count])<>0)or(pos('.RAM',OpenDialog1.Files.Strings[count])<>0)or(pos('.RA',OpenDialog1.Files.Strings[count])<>0)or (pos('.AVI',OpenDialog1.Files.Strings[count])<>0) then
begin
CheckListBox1.Items.Add(OpenDialog1.Files.Strings[count]);
CheckListBox1.Items.SaveToFile(ExtractFileDir(Application.ExeName)+'\mpgp.dll');
end
else
begin
form5.Label1.Caption:='不能播放該文件! ';
form5.ShowModal;
end;
end;
end
else
OpenDialog1.Options:=[ofHideReadOnly,ofEnableSizing];
OpenDialog1.Options:=[ofHideReadOnly,ofEnableSizing];
CheckListBox1.SetFocus;
CheckListBox1.ItemIndex:=CheckListBox1.ItemIndex+1;
end;
procedure Tshipinform.time_edit; //將秒數轉換成時間格式 顯示在edit2中
begin
ts2:=GetStringFromFrame(tlend*25);
SetLength(ts2,length(ts2)-3);
edit2.Text:=ts2;
end;
procedure Tshipinform.new_time; //取得文件運行時間并且顯示 tlen為秒數
var
ts:string;
begin
tlen:=RealAudio1.GetLength;
tlen:=tlen div 1000;
ts:=GetStringFromFrame(tlen*25);
SetLength(ts,length(ts)-3);
edit1.Text:=ts;
Edit3.Text:=RealAudio1.Source;
end;
procedure Tshipinform.Timer1Timer(Sender: TObject);
begin
if tlend<tlen then
begin
tlend:=tlend+1;
time_edit;
if edit3.Text='' then
edit3.Text:=RealAudio1.Source
else
edit3.Text:='';
end
else
begin
Timer1.Enabled:=false;
if (bfshi=0)and(CheckListBox1.Count<>0) then
begin
if CheckListBox1.ItemIndex=CheckListBox1.Count-1 then
begin
RealAudio1.DoStop;
tlend:=0;
tlen:=0;
time_edit;
edit1.Text:='00:00:00';
Timer1.Enabled:=false;
end
else
begin
RealAudio1.Source:=CheckListBox1.Items.Strings[integer(CheckListBox1.ItemIndex)];
try
RealAudio1.DoPlay;
opentag:=true;
except
begin
opentag:=false;
RealAudio1.Source:='';
RealAudio1.DoStop;
form5.Label1.Caption:='播放文件時發生錯誤! ';
form5.ShowModal;
abort;
end;
end;
new_time;
tlend:=0;
Timer1.Enabled:=true;
CheckListBox1.ItemIndex:=CheckListBox1.ItemIndex+1;
end;
end
else if (bfshi=1)and(CheckListBox1.Count<>0) then
begin
if CheckListBox1.ItemIndex=CheckListBox1.Count-1 then
begin
RealAudio1.Source:=CheckListBox1.Items.Strings[integer(CheckListBox1.ItemIndex)];
try
RealAudio1.DoPlay;
opentag:=true;
except
opentag:=false;
RealAudio1.Source:='';
RealAudio1.DoStop;
form5.Label1.Caption:='播放文件時發生錯誤! ';
form5.ShowModal;
abort;
end;
new_time;
tlend:=0;
Timer1.Enabled:=true;
CheckListBox1.ItemIndex:=0;
end
else
begin
RealAudio1.Source:=CheckListBox1.Items.Strings[integer(CheckListBox1.ItemIndex)];
try
RealAudio1.DoPlay;
opentag:=true;
except
opentag:=false;
RealAudio1.Source:='';
RealAudio1.DoStop;
form5.Label1.Caption:='播放文件時發生錯誤! ';
form5.ShowModal;
abort;
end;
new_time;
tlend:=0;
Timer1.Enabled:=true;
CheckListBox1.ItemIndex:=CheckListBox1.ItemIndex+1;
end;
end
else if (bfshi=2)and(CheckListBox1.Count<>0) then
begin
Timer1.Enabled:=false;
CheckListBox1.ItemIndex:=random(CheckListBox1.Count-2)+1;
RealAudio1.Source:=CheckListBox1.Items.Strings[integer(CheckListBox1.ItemIndex)];
try
RealAudio1.DoPlay;
opentag:=true;
except
opentag:=false;
RealAudio1.Source:='';
RealAudio1.DoStop;
form5.Label1.Caption:='播放文件時發生錯誤! ';
form5.ShowModal;
abort;
end;
new_time;
tlend:=0;
time_edit;
Timer1.Enabled:=true;
CheckListBox1.ItemIndex:=CheckListBox1.ItemIndex+1;
end
else
begin
Timer1.Enabled:=false;
RealAudio1.DoStop;
edit1.Text:='00:00:00';
edit2.Text:='00:00:00';
edit3.Text:='';
BitBtn2.Font.Color:=clgreen;
BitBtn3.Font.Color:=clgreen;
form5.Label1.Caption:='沒有文件存在! ';
form5.ShowModal;
abort;
end;
end;
end;
procedure Tshipinform.RadioButton1Click(Sender: TObject);
begin
bfshi:=0;
end;
procedure Tshipinform.RadioButton2Click(Sender: TObject);
begin
bfshi:=1;
end;
procedure Tshipinform.RadioButton3Click(Sender: TObject);
begin
bfshi:=2;
end;
procedure Tshipinform.RealAudio1StateChange(ASender: TObject; lOldState,
lNewState: Integer);
begin
new_time;
biaoti.Visible:=false;
end;
procedure Tshipinform.CheckListBox1DblClick(Sender: TObject);
begin
if CheckListBox1.Count<>0 then
begin
RealAudio1.Source:=CheckListBox1.Items.Strings[integer(CheckListBox1.ItemIndex)];
try
RealAudio1.DoPlay;
opentag:=true;
except
opentag:=false;
RealAudio1.Source:='';
RealAudio1.DoStop;
form5.Label1.Caption:='播放文件時發生錯誤! ';
form5.ShowModal;
abort;
end;
new_time;
tlend:=0;
Timer1.Enabled:=true;
end
else
begin
form5.Label1.Caption:='沒有播放文件! ';
form5.ShowModal;
end;
end;
procedure Tshipinform.Timer2Timer(Sender: TObject);
begin
if sudu=0 then
begin
tlend:=tlend-StrToInt(edit4.Text);
if tlend<0 then
begin
BitBtn4.Click;
form5.Label1.Caption:='超出時間范圍! ';
form5.ShowModal;
abort;
end
else
RealAudio1.SetPosition(tend*1000);
end
else if sudu=1 then
begin
tlend:=tlend+StrToInt(edit4.Text);
if tlend>tlen then
begin
BitBtn4.Click;
form5.Label1.Caption:='超出時間范圍! ';
form5.ShowModal;
abort;
end
else
RealAudio1.SetPosition(tlend*1000);
end;
time_edit;
end;
procedure Tshipinform.BitBtn8Click(Sender: TObject);
begin
if opentag=true then
begin
sudu:=0;
Timer1.Enabled:=false;
Timer2.Enabled:=true;
end;
end;
procedure Tshipinform.BitBtn9Click(Sender: TObject);
begin
if opentag=true then
begin
sudu:=1;
Timer1.Enabled:=false;
Timer2.Enabled:=true;
end;
end;
procedure Tshipinform.BitBtn10Click(Sender: TObject);
begin
if opentag=true then
begin
Timer2.Enabled:=false;
Timer1.Enabled:=true;
end;
end;
procedure Tshipinform.Edit4KeyPress(Sender: TObject; var Key: Char);
begin
if not(key in ['0'..'9',#8]) then
key:=#0;
end;
procedure Tshipinform.DragFileProc(var Message: TMessage);
var
FileNum: Word;
p: array[0..254] of char;
begin
if Message.Msg = WM_DropFiles then
begin
FileNum := DragQueryFile(Message.WParam,$FFFFFFFF,nil,0);
for FileNum := 0 to FileNum - 1 do
begin
DragQueryFile(Message.WParam, FileNum , p ,255);
RealAudio1.Source:=strpas(p);//加入播放.
if (pos('.rm',RealAudio1.Source)<>0)or(pos('.ram',RealAudio1.Source)<>0)or(pos('.rlm',RealAudio1.Source)<>0)or(pos('.avi',RealAudio1.Source)<>0)or(pos('.RM',RealAudio1.Source)<>0)or(pos('.RAM',RealAudio1.Source)<>0)or(pos('.RLM',RealAudio1.Source)<>0)or(pos('.AVI',RealAudio1.Source)<>0)then
begin
CheckListBox1.Items.Add(strpas(p));
CheckListBox1.Items.SaveToFile(ExtractFileDir(Application.ExeName)+'\mpgp.dll');
end
else
begin
form5.Label1.Caption:='不能播放該文件! ';
form5.ShowModal;
abort;
end;
end;
end
else
begin
OLDWndProc(Message);
end;
end;
procedure Tshipinform.Edit5KeyPress(Sender: TObject; var Key: Char);
begin
key:=#0;
end;
procedure Tshipinform.Timer3Timer(Sender: TObject);
begin
edit5.Text:=TimeToStr(time());
end;
procedure Tshipinform.TrackBar1Change(Sender: TObject);
begin
try
if form2.TrackBar1.Position<13 then
SetWaveLeft(TrackBar1.Position div 13)
else if Form2.TrackBar1.Position>13 then
SetWaveRigth(TrackBar1.Position div 13)
else
SetWaveBalance(TrackBar1.Position div 13 );
Except
begin
abort;
end;
end;
end;
procedure Tshipinform.N12Click(Sender: TObject);
begin
BitBtn6.Click;
end;
procedure Tshipinform.N13Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure Tshipinform.N16Click(Sender: TObject);
begin
form2.Show;
end;
procedure Tshipinform.N2Click(Sender: TObject);
begin
BitBtn1.Click;
end;
procedure Tshipinform.N15Click(Sender: TObject);
begin
form10.ShowModal;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -