ImageEn, unit iexWPD

TIEPortableDevices.CopyStreamFromDevice

TIEPortableDevices.CopyStreamFromDevice


Declaration

function CopyStreamFromDevice(const sDeviceID, sObjectID: Widestring; DestStream: TStream; Thumbnail: Boolean = False): Boolean; overload;
function CopyStreamFromDevice(Index: Integer; DestStream: TStream; Thumbnail: Boolean = False): Boolean; overload;


Description

Copy a file of the specified sObjectID from a device to a stream.

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
ssDestStream The stream that will be filled with the file
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

Note: Ensure sObjectID points to a file, not a folder. ssDestStream will be created if it is nil and its position is reset to zero after it is filled.


Example

// Display the selected image in an ImageEnView
Idx := IEPortableDevices.ObjectIDToIndex( lbxObjects.Items[ lbxObjects.ItemIndex ] );
aObject := IEPortableDevices.Objects[ Idx ];
if ( aObject.ObjectType <> iewFolder ) and IsKnownFormat( aObject.Filename ) the
begin
  aMemStream := TMemoryStream.create;
  try
    if IEPortableDevices.CopyStreamFromDevice( SelectedDeviceID, aObject.ID, aMemStream ) then
      ImageEnView1.IO.LoadFromStream(aMemStream);
  finally
    aMemStream.free;
  end;
end;


See Also

IEGetFileFromDevice