ImageEn, unit iexWPD

TIEPortableDevices.CopyFileFromDevice

TIEPortableDevices.CopyFileFromDevice


Declaration

function CopyFileFromDevice(const sDeviceID, sObjectID, sDestFilename: WideString; Thumbnail: Boolean = False; MoveFile: Boolean = False): Boolean; overload;
function CopyFileFromDevice(Index: Integer; const sDestFilename: WideString; Thumbnail: Boolean = False; MoveFile: Boolean = False): Boolean; overload;
function CopyFileFromDevice(Indexes: TStrings; const sDestFolder: WideString; Thumbnail: Boolean = False; MoveFile: Boolean = False): Integer; overload;


Description

Copy a file of the specified sObjectID from a device to a local filename

Parameter Description
sDeviceID The ID of the device to copy from (e.g. ActiveDeviceID
sFileID The ID of the file to copy (ID cannot point to a folder)
Index Index of the current item in the Objects array
sDestFilename The local filename to copy the file to
Thumbnail Requests a thumbnail rather than a file (typically returns a 256x256 image). If thumbnail loading fails, or it is not an image file, the full file is returned
MoveFile The file is deleted from the device after copying

Note: Only files are supported, not folders.


Example

// Prompt the user to specify a destination file to copy to
procedure TfrmMain.btnCopyFromDeviceClick(Sender: TObject);
var
  Idx: Integer;
  aObject: TIEWPDObject;
begin
  if lbxObjects.ItemIndex < 0 then
    exit;

  Idx := IEPortableDevices.ObjectIDToIndex( lbxObjects.Items[ lbxObjects.ItemIndex ] );
  aObject := IEPortableDevices.Objects[ Idx ];
  if aObject.ObjectType = iewFolder then
    exit;

  SaveDialog1.FileName := aObject.Filename;
  if SaveDialog1.Execute then
    IEPortableDevices.CopyFileFromDevice( IEPortableDevices.ActiveDeviceID, aObject.ID, SaveDialog1.FileName );
end;


See Also

IEGetFileFromDevice