首先抱歉我的英语不好。
我正在进行设置:如果是第一次安装程序,我不能使用网络路径但只能使用固定驱动器,因此指令AllowNetworkDrive
必须是AllowNetworkDrive=no
;否则,如果程序已经安装,我必须更新它并允许网络驱动器,所以我需要AllowNetworkDrive=yes
。
一开始,我在AllowNetworkDrive=no
部分使用[Code]
,如果我检查程序是否已安装,我必须将其设置为AllowNetworkDrive=yes
。
目前,我正在以这种方式工作:我在AllowNetworkDrive=no
部分设置了[Setup]
;在[Code]
部分,我做到了这一点:
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 GetDriveType( lpDisk: String ): Integer;
external 'GetDriveTypeA@kernel32.dll stdcall';
[...]
testdrive := Copy(WizardForm.DirEdit.Text, 1, 3);
if (GetDriveType(testdrive) <> DRIVE_FIXED) then
begin
MsgBox('Non è possibile effettuare l''installazione su questa unità.'+#13#13+'Scegliere un''unità locale fissa.', mbError, mb_ok);
Result := False;
end;
还有其他解决方案吗?有没有更简单的方法?谢谢!