title: Use Delphi to Find Special Drives
body: <p>I am trying to write a small program in Delphi 2007 to access files off of a portable USB drive whenever it is plugged in to a Windows 7 machine.  This drive does not show up as a standard drive letter though.  It appears under Portable Devices in Windows Explorer.  I have written the following code to enumerate all the items under 'Computer':</p>
  
  <pre><code>Procedure TfrmMain.ComputerChanged(Var Msg: TMessage);
  Var
    Enum: IEnumIDList;
    Fetched: Longword;
    Item: PItemIDList;
    Path: String;
    Computer: IShellFolder;
    StrRet: TSTRRET;
  Begin
    Status('Computer changed...  Checking folders.');
    fDesktop.BindToObject(fCompPidl, Nil, IID_IShellFolder, Computer);
    If Assigned(Computer) And
       (Computer.EnumObjects(Self.Handle, SHCONTF_FOLDERS, Enum) = NOERROR) Then
    Begin
      While (Enum.Next(1, Item, Fetched) = NOERROR) Do
      Begin
        FillChar(StrRet, SizeOf(StrRet), #0);
        Computer.GetDisplayNameOf(Item, SHGDN_FORADDRESSBAR or SHGDN_NORMAL, StrRet);
        Path := StrRetToStr(StrRet, Item);
        Status(Path);
      End;
    End;
  End;
  </code></pre>
  
  <p>(note: the Status procedure just outputs a message to a TMemo.)</p>
  
  <p>This is called whenever my application is notified of a change by the Windows shell subsystem.  It enumerates all of the local drives and network drives but nothing else (iCloud Photos drive is missing as well).</p>
  
  <p>Does anyone know how I can access the files on these virtual drives?</p>