|
正式会员享受无限制浏览网站功能和高速网盘下载,赶快加入本站吧!
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- #ifdef Unicode
- #define A "W"
- #else
- #define A "A"
- #endif
- [Setup]
- AppName=DriveType
- AppVerName=DriveType
- Uninstallable=false
- UpdateUninstallLogAppName=false
- DisableDirPage=true
- DisableProgramGroupPage=true
- DefaultDirName={pf}\Drvtype
- DisableStartupPrompt=true
- [Code]
- function GetDriveType( lpDisk: String ): Integer;
- external 'GetDriveType{#A}@kernel32.dll stdcall';
- const
- DRIVE_UNKNOWN = 0; // The drive type cannot be determined.
- DRIVE_NO_ROOT_DIR = 1; // The root path is invalid. For example, no volume is mounted at the path.
- DRIVE_REMOVABLE = 2; // The disk can be removed from the drive.
- DRIVE_FIXED = 3; // The disk cannot be removed from the drive.
- DRIVE_REMOTE = 4; // The drive is a remote (network) drive.
- DRIVE_CDROM = 5; // The drive is a CD-ROM drive.
- DRIVE_RAMDISK = 6; // The drive is a RAM disk.
- // function to convert disk type to string
- function DriveTypeString( dtype: Integer ): String;
- begin
- case dtype of
- DRIVE_NO_ROOT_DIR : Result := '根目录无效'; //'Root path invalid';
- DRIVE_REMOVABLE : Result := '可移动盘'; //'Removable';
- DRIVE_FIXED : Result := '硬盘'; //'Fixed';
- DRIVE_REMOTE : Result := '网络'; //'Network';
- DRIVE_CDROM : Result := '光盘'; //'CD-ROM';
- DRIVE_RAMDISK : Result := '内存'; //'Ram disk';
- else
- Result := '未知'; //'Unknown';
- end;
- end;
- function InitializeSetup(): Boolean;
- var srcdisk: String;
- disktype: Integer;
- begin
- Result := true;
- // get drive from where setup was launched
- srcdisk := AddBackSlash( ExtractFileDrive( ExpandConstant('{srcexe}') ) ) ;
- // get number type of disk
- disktype := GetDriveType( srcdisk );
- // show which type of disk it is
- MsgBox( Format( '安装程序从 %s 启动,类型为“%s”。', [srcdisk, DriveTypeString( disktype )] ) , mbInformation, MB_OK );
- end;
复制代码
|
|