GetDriveType ()

From ISXKB

Revision as of 15:42, 16 June 2009 by Markus (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

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: