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.
Result is true if the copy occurs.
| 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 |
| DestStream | The stream that will be filled with the file. Its position is reset to zero after it is filled |
| 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
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