Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
INNO Setup, how to browse the network?
Message
De
07/05/2008 08:02:29
 
 
À
06/05/2008 17:47:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Installation et configuration
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01315464
Message ID:
01315551
Vues:
26
This message has been marked as the solution to the initial question of the thread.
>I am now looking to use INNO to deliver upgrades to customers but would like to be able to run the installer on machine A but install to machine B. From what I can see INNO allows you to browse local and mapped drives but you cannot see the network folder to be able to network browse to the machine you want to install to. I understand that if you know the UNC path you can use that but the drawback here is as mentioned, you need to know the UNC path and most of our customer don't.
>
>Does anyone know if this can be done or if I have just missed something obvious, wouldn't be the first time nor the last!

You need some code to make the network available. I got this from the Inno newsgroups (and tweaked for my situation, I think). In my case, I'm using a separate input page for the folder when it's a workstation installation as opposed to a server install. This should give you some idea.

This goes in the [code] section:
type
  BROWSEINFO = record
    hOwner : cardinal;
    pidlRoot : cardinal;
    pszDisplayName : string;
    lpszTitle : string;
    ulFlags : cardinal;
    lpfn : cardinal;
    lParam : cardinal;
    iImage : cardinal;
  end;

var
  AppDirPage, ServerDirPage: TInputDirWizardPage;

function SHGetPathFromIDList(pidl : cardinal; pszPath : string): cardinal;
external 'SHGetPathFromIDListA@shell32.dll stdcall';

function SHBrowseForFolder(var lpBrowseInfo: BROWSEINFO): cardinal;
external 'SHBrowseForFolderA@shell32.dll stdcall';

procedure CoTaskMemFree(pv : cardinal);
external 'CoTaskMemFree@ole32.dll stdcall';

const
  MAX_PATH = 260;
  BIF_RETURNONLYFSDIRS = $1;

procedure OnNetworkButtonClick(Sender: TObject);
var
   bi : BROWSEINFO;
   pidl : cardinal;
   path : string;
begin
  // initialise the BROWSEINFO structure
  bi.hOwner    := WizardForm.Handle;
  bi.lpszTitle := WizardForm.PAGEDESCRIPTIONLABEL.Caption;
  bi.ulFlags   := BIF_RETURNONLYFSDIRS;

  // call the browse folder dialog
  pidl := SHBrowseForFolder(bi);
  if pidl <> 0 then
  begin
    try

      // check if we got back a valid PIDL
      path := StringOfChar(' ', MAX_PATH);
      if SHGetPathFromIDList(pidl, path) = 1 then
      begin
        // if so then poke the path back into the select directory edit box
        ServerDirPage.Values[0] := path;
      end;

    finally
      // clean up
      CoTaskMemFree(pidl);
    end;
  end;
end;

function GetServerDir(Param: String): String;
begin
  { Return the selected DataDir }
  Result := ServerDirPage.Values[0];
end;
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform