Declaration
function IEGetFileFromDevice(Path: string; const DestFilename: string): Boolean; overload;
function IEGetFileFromDevice(Path: string): TMemoryStream; overload;
Description
Retrieves a file from a connected device by specifying a full path (using
TIEPortableDevices).
Path should be in format: DEVICE\PATH\FILENAME
Device: Friendly name of the device, e.g. 'GM1913' (optionally with the WPD: prefix) or a device ID, e.g. '\\?\usb#vid_05c6&pid_f000&mi_00#7...f33}
Path: Full path delimited by backslashes
Filename: Friendly name of the file including the extension
Examples:
'GM1913\Internal shared storage\image3.jpg'
'WPD:GM1913\Internal shared storage\DCIM\Camera\IMG_110453.jpg'
'\\?\usb#vid_05c6&pid_f000&mi_00#7&1&000#{6ac27878-a6fa-4155-ba85-f98f351d4f33}\Internal shared storage\image3.jpg'
// Note: This is the same as calling ImageEnView1.IO.LoadFromFile( 'WPD:GM1913\Internal shared storage\image3.jpg' );
var
ms: TMemoryStream;
begin
ms := IEGetFileFromDevice( 'GM1913\Internal shared storage\image3.jpg' );
if ms <> nil then
try
ImageEnView1.IO.LoadFromStream( ms );
finally
ms.free;
end;
end;
var
fn: string;
begin
fn := 'D:\image.jpg';
if IEGetFileFromDevice( '\\?\usb#vid_05c6&pid_f000&mi_00#7&1&000#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\Internal shared storage\DCIM\Camera\IMG_110453.jpg', fn ) then
ShellExecute(Handle, 'open', PChar( fn ), nil, nil, SW_MAXIMIZE);
end;