首先很抱歉我的英语不好。
我正在设置:如果是第一次安装程序,我不能使用网络路径,只能使用固定驱动器,所以指令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;
还有其他解决方案吗?有没有更简单的方法?谢谢!