Quantcast
Channel: VBForums - Application Deployment
Viewing all articles
Browse latest Browse all 254

Inno Setup script help - selected drive D not working

$
0
0
I'm trying to fix a bug in a script that I am using in the Inno Setup installer.

The problem is that when I select the drive D radio button (from a list of drive C, drive D) the script wants to always install on drive C.

I'm not that good at coding but in the GetDriveChoosed function, I saw that it was harded coded to always select drive C so I remmed out those lines but it still always selects drive C.

Can someone help me figure out what I need to do to modify the code so I can select any available drive on my system?

Thank you...

Code:


//get all drives letters of system
  drivesletters := StringOfChar( ' ', 64 );
  lenletters := GetLogicalDriveStrings( 63, drivesletters );
  SetLength( drivesletters , lenletters );
  drive := '';
  n := 0;
  while ( (Length(drivesletters) > 0) ) do
  begin
    posnull := Pos( #0, drivesletters );
  if posnull > 0 then
  begin
      drive:= UpperCase( Copy( drivesletters, 1, posnull - 1 ) );

      // get number type of disk
      disktype := GetDriveType( drive );

      // add it only if it is not a floppy
      if ( not ( disktype = DRIVE_REMOVABLE ) ) then
      begin
        SetArrayLength(DrivePrompts, N+1);
        SetArrayLength(DriveValues, N+1);
        SetArrayLength(DrvLetters, N+1);

        DrivePrompts[n] := drive + '  ' + DriveTypeString( disktype );
        DrvLetters[n] := drive;
        // default select C: Drive
        if ( drive = 'C:\' ) then DriveValues[n] := '1';
        n := n + 1;
      end
  drivesletters := Copy( drivesletters, posnull+1, Length(drivesletters));
  end
end;


function GetDriveChoosed : String;
var i:Integer;
begin
  for i:=0 to GetArrayLength(DriveValues)-1 do
    begin
      //if DriveValues[i]='1' then
      //  begin
          Result:=DrvLetters[i];
          Exit;
      //  end;
    end;
  Result:='?';
end;


Viewing all articles
Browse latest Browse all 254

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>