判斷光碟格式 |
|
TOMMY
一般會員 發表:16 回覆:32 積分:9 註冊:2002-03-15 發送簡訊給我 |
|
hagar
版主 發表:143 回覆:4056 積分:4445 註冊:2002-04-14 發送簡訊給我 |
How determine if a CD is a Audio CD.
Uploader: Enrique Ortu隳
Question/Problem/Abstract: Is my CD a Audio CD?
Answer: Create a function :
Function AudioCD(Drive : Char) : Boolean; Var FSFlags, MaxLength: DWORD; VolName, Path : String; Begin Path := Drive ':\'; Result := FALSE; if (GetDriveType(PChar(Path)) = DRIVE_CDROM) then begin SetLength(VolName, 64); GetVolumeInformation(PChar(Path), PChar(VolName), Length(VolName), nil, MaxLength, FSFlags, nil,0); if (lStrCmp(PChar(VolName),'Audio CD') = 0) Then Result := TRUE; end; end; |
TOMMY
一般會員 發表:16 回覆:32 積分:9 註冊:2002-03-15 發送簡訊給我 |
引言: How determine if a CD is a Audio CD. Uploader: Enrique Ortu隳 Question/Problem/Abstract: Is my CD a Audio CD? Answer: Create a function :TOMMY 發表人 - tommy 於 2002/06/20 14:06:29Function AudioCD(Drive : Char) : Boolean; Var FSFlags, MaxLength: DWORD; VolName, Path : String; Begin Path := Drive ':\'; Result := FALSE; if (GetDriveType(PChar(Path)) = DRIVE_CDROM) then begin SetLength(VolName, 64); GetVolumeInformation(PChar(Path), PChar(VolName), Length(VolName), nil, MaxLength, FSFlags, nil,0); if (lStrCmp(PChar(VolName),'Audio CD') = 0) Then Result := TRUE; end; end;感謝hagar前輩的再次幫忙 不過....小弟呆呆 已經將程式加入 但是在退片時 仍然保持原來的訊息耶
------
TOMMY |
hagar
版主 發表:143 回覆:4056 積分:4445 註冊:2002-04-14 發送簡訊給我 |
假設光碟機在 D 槽
procedure TForm1.Button1Click(Sender: TObject); begin if AudioCD('D') then ShowMessage('是 Audio CD') else ShowMessage('是 Data CD') end;不過這兒得先確定光碟機內有光碟, 底下是判斷方法: It's easy if we capture the WM_DEVICECHANGE message: Put this line into private section of your form's declaration: private { Private declarations } {Esta Linea/This line} procedure WMDeviceChange(var Msg: TMessage);message WM_DEVICECHANGE;(With this, we capture the message, sending to our own treatment procedure) Put this procedure into implementation part of your form: procedure TForm1.WMDeviceChange(var Msg: TMessage); const CD_METIDO = $8000; CD_SACADO = $8004; var Aviso : String; begin inherited; case Msg.wParam of CD_METIDO : Aviso := 'CD Insertado'; CD_SACADO : Aviso := 'CD Sacado'; end; ShowMessage(Aviso); end;發表人 - hagar 於 2002/06/20 14:09:35 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |