如何确定某一个计算机的光驱的盘符。(50分)

  • 主题发起人 主题发起人 goodflying
  • 开始时间 开始时间
G

goodflying

Unregistered / Unconfirmed
GUEST, unregistred user!
如何在打包时去掉原代码。<br>如何确定某一个计算机的光驱的盘符。
 
1.打包时不选择源码文件,只选择exe的和库文件<br>2.光驱盘符不固定,关注
 
function GetCDRom: string;<br>var<br>&nbsp; c: Char;<br>&nbsp; Drive: string;<br>&nbsp; DriveType: UINT;<br>&nbsp; DriveSize: Int64;<br>begin<br>&nbsp; for c := 'A' to 'Z' do<br>&nbsp; begin<br>&nbsp; &nbsp; DriveSize := DiskSize(Ord(c) - Ord('A') + 1);<br>&nbsp; &nbsp; if DriveSize &gt; 0 then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; Drive := c + ':';<br>&nbsp; &nbsp; &nbsp; DriveType := GetDriveType(PChar(Drive));<br>&nbsp; &nbsp; &nbsp; if DriveType = DRIVE_CDROM then<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; Result := Drive;<br>&nbsp; &nbsp; &nbsp; &nbsp; Exit;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; end<br>&nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; if c &gt;= 'C' then<br>&nbsp; &nbsp; &nbsp; &nbsp; Exit;<br>&nbsp; end;<br>end;
 
procedure TForm1.Button1Click(Sender: TObject);<br><br>var<br>drive:char;<br>begin<br>for drive:='a' to 'z' do<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; Case GetDriveType(pchar(Drive+':/')) of<br>&nbsp; &nbsp; &nbsp; &nbsp; 2: Label1.Caption :='软盘驱动器';<br>&nbsp; &nbsp; &nbsp; &nbsp; 3: Label1.Caption := '硬盘驱动器';<br>&nbsp; &nbsp; &nbsp; &nbsp; 4: Label1.Caption := '网络驱动器';<br>&nbsp; &nbsp; &nbsp; &nbsp; 5: Label1.Caption := 'CD-ROM驱动器';<br>&nbsp; &nbsp; &nbsp; &nbsp; 6: Label1.Caption := '虚拟驱动器';<br>&nbsp; &nbsp; &nbsp; Else Label1.Caption := '驱动器无效';<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; if GetDriveType(pchar(Drive+':/'))in[2,3,4,5,6] then<br>&nbsp; &nbsp; ComboBox1.Items.Add(pchar(drive+':/ &nbsp; &nbsp;')+label1.Caption);<br>&nbsp; &nbsp; x:=x+1;<br>&nbsp; &nbsp; if x&gt;y then begin<br>&nbsp; &nbsp; &nbsp; showmessage(' &nbsp; &nbsp;Done !');<br>&nbsp; &nbsp; &nbsp; exit;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; end;<br>end;
 
多人接受答案了。
 
后退
顶部