GetDriveType ()

From ISXKB

(Difference between revisions)
Jump to: navigation, search
Current revision (15:42, 16 June 2009) (view source)
 
Line 14: Line 14:
function GetDriveType (lpDisk: String): Integer;
function GetDriveType (lpDisk: String): Integer;
-
external 'GetDriveTypeA@kernel32.dll stdcall';
+
external 'GetDriveTypeA@kernel32.dll stdcall';
</pre>
</pre>

Current revision

This article shows how to use the Windows API function GetDriveType with Inno Setup.

Declaration

The following declaration is required in a [Code] section:

const
   DRIVE_UNKNOWN     = 0;
   DRIVE_NO_ROOT_DIR = 1;
   DRIVE_REMOVABLE   = 2;
   DRIVE_FIXED       = 3;
   DRIVE_REMOTE      = 4;
   DRIVE_CDROM       = 5;
   DRIVE_RAMDISK     = 6;

function GetDriveType (lpDisk: String): Integer;
 external 'GetDriveTypeA@kernel32.dll stdcall';

GetDriveType () at MSDN

Example Code

DriveType := GetDriveType ('K:\');
if DriveType = DRIVE_CDROM then
begin
   // This is most likely a CD drive.
end;
Personal tools
Ads: