怎样知道指定的盘符是否是可移动硬盘,或者怎样检测是否插入了 |
答題得分者是:malanlk
|
cxg
中階會員 發表:116 回覆:192 積分:76 註冊:2004-02-12 發送簡訊給我 |
|
jow
尊榮會員 發表:66 回覆:751 積分:1253 註冊:2002-03-13 發送簡訊給我 |
The GetLogicalDriveStrings function fills a buffer with strings that specify valid drives in the system. DWORD GetLogicalDriveStrings( DWORD nBufferLength, // size of buffer LPTSTR lpBuffer // address of buffer for drive strings ); The GetDriveType function determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive. UINT GetDriveType( LPCTSTR lpRootPathName // address of root path ); |
cxg
中階會員 發表:116 回覆:192 積分:76 註冊:2004-02-12 發送簡訊給我 |
|
malanlk
尊榮會員 發表:20 回覆:694 積分:577 註冊:2004-04-19 發送簡訊給我 |
我這都可以看得到
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} function GetLogicalDisks: string; var i,n :integer; buf :pchar; begin buf:=stralloc(255); n:=GetLogicalDriveStrings(255,buf); Result:=''; for i:=0 to n do if buf[i]<>#0 then begin if (ord(buf[i]) in [$41..$5a]) or (ord(buf[i]) in [$61..$7a]) then Result:=Result upcase(buf[i]) end else if buf[i 1]=#0 then break; strdispose(buf); end; procedure TForm1.Button1Click(Sender: TObject); var s: String; begin // Logical devices s:=GetLogicalDisks; showmessage(s); end; end. |
cxg
中階會員 發表:116 回覆:192 積分:76 註冊:2004-02-12 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |