1.
写一个搜索驱动器的过程
function GetDrives : TDriveBits;
var
E,ct : Integer;
begin
E := SetErrorMode ( SEM_FAILCRITICALERRORS );
try
Integer ( Result ) := GetLogicalDrives;
// now check if each present drive is allowed to show
for ct := 0 to 25
do
if ct in Result
then
case GetDriveType ( PChar (Char (ct+Ord('A'))+':/'))
of
DRIVE_UNKNOWN : if not (drtUnknown in fDriveTypes)
then
Exclude ( Result , ct );
DRIVE_REMOVABLE : if not (drtRemovable in fDriveTypes)
then
Exclude ( Result , ct );
DRIVE_FIXED : if not (drtFixed in fDriveTypes)
then
Exclude ( Result , ct );
DRIVE_REMOTE : if not (drtRemote in fDriveTypes)
then
Exclude ( Result , ct );
DRIVE_CDROM : if not (drtCDRom in fDriveTypes)
then
Exclude ( Result , ct );
DRIVE_RAMDISK : if not (drtRamDisk in fDriveTypes)
then
Exclude ( Result , ct );
end;
finally
SetErrorMode ( E );
end;
end;
2.比如要打开 F:/Test目录
执行 winexec('explorer.exe F:/Test',sw_Show);