GetDriveTypeThe 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
);
ParameterslpRootPathNamePoints to a null-terminated string that specifies the root directory of the disk to return information about. If lpRootPathName is NULL, the function uses the root of the current directory. Return ValuesThe return value specifies the type of drive. It can be one of the following values: Value Meaning
0 The drive type cannot be determined.
1 The root directory does not exist.
DRIVE_REMOVABLE The drive can be removed from the drive.
DRIVE_FIXED The disk cannot be removed from the drive.
DRIVE_REMOTE The drive is a remote (network) drive.
DRIVE_CDROM The drive is a CD-ROM drive.
DRIVE_RAMDISK The drive is a RAM disk.
);
ParameterslpRootPathNamePoints to a null-terminated string that specifies the root directory of the disk to return information about. If lpRootPathName is NULL, the function uses the root of the current directory. Return ValuesThe return value specifies the type of drive. It can be one of the following values: Value Meaning
0 The drive type cannot be determined.
1 The root directory does not exist.
DRIVE_REMOVABLE The drive can be removed from the drive.
DRIVE_FIXED The disk cannot be removed from the drive.
DRIVE_REMOTE The drive is a remote (network) drive.
DRIVE_CDROM The drive is a CD-ROM drive.
DRIVE_RAMDISK The drive is a RAM disk.
解决方案 »
- 救命 - Delphi控制台或DLL编译的话就失败,如果用窗体的话就成功,实在不理解,帮帮忙!(TObjectFromLResult)
- 窗体之间互相
- 那些精品软件用delphi开发的?
- 开发activex控件的问题
- 请教:TreeView在Edited事件后,如何设置焦点?
- 关于继承窗口的问题 (如何查看 ADODataSet 包含的字段?之二)
- 求 ERP或进销存等系统常用的图标。
- 求教:IE浏览器中文本编辑器是窗口吗?如何获得其Handle?
- Delphi初学,求助
- 各位高手,大虾请回答!共享delphi类库!
- 当我在 ToolButton 上的 Button 发一个 Wm_LbuttonDown 消息时,我如何得到该Button 的名字
- Delphi中如何调用Matlab的函数?
Windows;
Function GetFirstCDROM:Char;
var
Ch : Char;
S : string;
begin
for Ch := 'D' to 'Z' do
begin
s := Ch + ':\';
if GetDriveType(PChar(s)) = DRIVE_CDROM then
Begin
Result:=Ch;
Break;
End;
end;
End;
if GetDriveType('f:\')=DRIVE_CDROM