(* ImageEn Build 7.0.0.06.2637 @ 7-4-17 14:58:42.679 *) (* Copyright (c) 1998-2017 by Carlotta Calandra. All rights reserved. Copyright (c) 2011-2017 by Xequte Software. This software comes without express or implied warranty. In no case shall the author be liable for any damage or unwanted behavior of any computer hardware and/or software. Author grants you the right to include the component in your application, whether COMMERCIAL, SHAREWARE, or FREEWARE. ImageEn, IEvolution and ImageEn ActiveX may not be included in any commercial, shareware or freeware libraries or components. www.ImageEn.com *) (* File version 1011 *) unit iexWPD; // NPC: 23/10/14 {$R-} {$Q-} {$I ie.inc} {$IFDEF IEINCLUDEWPD} {$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. {$WARN SYMBOL_PLATFORM OFF} {$WRITEABLECONST ON} {$VARPROPSETTER ON} interface uses ActiveX, ComObj, ComCtrls, Classes; type {!! TIEPortableDeviceLogEvent Declaration } TIEPortableDeviceLogEvent = procedure(Sender : TObject; const sMsg : String) of object; {!!} type {!! TWPDObjectFormat Declaration } TWPDObjectFormat = ( _WPD_OBJECT_FORMAT_3GP , _WPD_OBJECT_FORMAT_AAC , _WPD_OBJECT_FORMAT_ABSTRACT_CONTACT , _WPD_OBJECT_FORMAT_ABSTRACT_CONTACT_GROUP , _WPD_OBJECT_FORMAT_ABSTRACT_MEDIA_CAST , _WPD_OBJECT_FORMAT_AIFF , _WPD_OBJECT_FORMAT_ALL , _WPD_OBJECT_FORMAT_ASF , _WPD_OBJECT_FORMAT_ASXPLAYLIST , _WPD_OBJECT_FORMAT_AUDIBLE , _WPD_OBJECT_FORMAT_AVI , _WPD_OBJECT_FORMAT_BMP , _WPD_OBJECT_FORMAT_CIFF , _WPD_OBJECT_FORMAT_DPOF , _WPD_OBJECT_FORMAT_EXECUTABLE , _WPD_OBJECT_FORMAT_EXIF , _WPD_OBJECT_FORMAT_FLAC , _WPD_OBJECT_FORMAT_FLASHPIX , _WPD_OBJECT_FORMAT_GIF , _WPD_OBJECT_FORMAT_HTML , _WPD_OBJECT_FORMAT_ICALENDAR , _WPD_OBJECT_FORMAT_ICON , _WPD_OBJECT_FORMAT_JFIF , _WPD_OBJECT_FORMAT_JP2 , _WPD_OBJECT_FORMAT_JPX , _WPD_OBJECT_FORMAT_M3UPLAYLIST , _WPD_OBJECT_FORMAT_M4A , _WPD_OBJECT_FORMAT_MHT_COMPILED_HTML , _WPD_OBJECT_FORMAT_MICROSOFT_EXCEL , _WPD_OBJECT_FORMAT_MICROSOFT_POWERPOINT , _WPD_OBJECT_FORMAT_MICROSOFT_WFC , _WPD_OBJECT_FORMAT_MICROSOFT_WORD , _WPD_OBJECT_FORMAT_MP2 , _WPD_OBJECT_FORMAT_MP3 , _WPD_OBJECT_FORMAT_MP4 , _WPD_OBJECT_FORMAT_MPEG , _WPD_OBJECT_FORMAT_MPLPLAYLIST , _WPD_OBJECT_FORMAT_NETWORK_ASSOCIATION , _WPD_OBJECT_FORMAT_OGG , _WPD_OBJECT_FORMAT_PCD , _WPD_OBJECT_FORMAT_PICT , _WPD_OBJECT_FORMAT_PLSPLAYLIST , _WPD_OBJECT_FORMAT_PNG , _WPD_OBJECT_FORMAT_PROPERTIES_ONLY , _WPD_OBJECT_FORMAT_SCRIPT , _WPD_OBJECT_FORMAT_TEXT , _WPD_OBJECT_FORMAT_TIFF , _WPD_OBJECT_FORMAT_TIFFEP , _WPD_OBJECT_FORMAT_TIFFIT , _WPD_OBJECT_FORMAT_UNSPECIFIED , _WPD_OBJECT_FORMAT_VCALENDAR1 , _WPD_OBJECT_FORMAT_VCARD2 , _WPD_OBJECT_FORMAT_VCARD3 , _WPD_OBJECT_FORMAT_WAVE , _WPD_OBJECT_FORMAT_WINDOWSIMAGEFORMAT , _WPD_OBJECT_FORMAT_WMA , _WPD_OBJECT_FORMAT_WMV , _WPD_OBJECT_FORMAT_WPLPLAYLIST , _WPD_OBJECT_FORMAT_X509V3CERTIFICATE , _WPD_OBJECT_FORMAT_XML , _WPD_OBJECT_FORMAT_UNKNOWN ); {!!} {!! TWPDContentType Declaration } TWPDContentType = ( _WPD_CONTENT_TYPE_ALL , _WPD_CONTENT_TYPE_APPOINTMENT , _WPD_CONTENT_TYPE_AUDIO , _WPD_CONTENT_TYPE_AUDIO_ALBUM , _WPD_CONTENT_TYPE_CALENDAR , _WPD_CONTENT_TYPE_CERTIFICATE , _WPD_CONTENT_TYPE_CONTACT , _WPD_CONTENT_TYPE_CONTACT_GROUP , _WPD_CONTENT_TYPE_DOCUMENT , _WPD_CONTENT_TYPE_EMAIL , _WPD_CONTENT_TYPE_FUNCTIONAL_OBJECT , _WPD_CONTENT_TYPE_GENERIC_FILE , _WPD_CONTENT_TYPE_GENERIC_MESSAGE , _WPD_CONTENT_TYPE_IMAGE , _WPD_CONTENT_TYPE_IMAGE_ALBUM , _WPD_CONTENT_TYPE_MEDIA_CAST , _WPD_CONTENT_TYPE_MEMO , _WPD_CONTENT_TYPE_MIXED_CONTENT_ALBUM , _WPD_CONTENT_TYPE_NETWORK_ASSOCIATION , _WPD_CONTENT_TYPE_PLAYLIST , _WPD_CONTENT_TYPE_PROGRAM , _WPD_CONTENT_TYPE_SECTION , _WPD_CONTENT_TYPE_TASK , _WPD_CONTENT_TYPE_TELEVISION , _WPD_CONTENT_TYPE_UNSPECIFIED , _WPD_CONTENT_TYPE_VIDEO , _WPD_CONTENT_TYPE_VIDEO_ALBUM , _WPD_CONTENT_TYPE_WIRELESS_PROFILE , _WPD_CONTENT_TYPE_FOLDER , _WPD_CONTENT_TYPE_UNKNOWN ); {!!} {!! TIEWPDObjectType Declaration } TIEWPDObjectType = (iewFile, iewFolder); {!!} {!! TIEWPDObjectTypes Declaration TIEWPDObjectTypes = set of ; !!} TIEWPDObjectTypes = set of TIEWPDObjectType; {!! TIEPortableDevice Declaration } TIEPortableDevice = Record ID : WideString; FriendlyName : WideString; Description : WideString; Manufacturer : WideString; IsDrive : Boolean; // True if it a removable drive, false for devices, such as smart phones end; {!!} PIEPortableDevice = ^TIEPortableDevice; {!! TIEWPDObject Declaration TIEWPDObject = Record ID : WideString; FriendlyName : WideString; // The WPD name. A file without an extension - Best for folders Filename : WideString; // Original name in WPD. Name of file with extension (but without a path) - Best for files Path : WideString; ObjectType : ; end; !!} TIEWPDObject = Record ID : WideString; FriendlyName : WideString; // The WPD name. A file without an extension Filename : WideString; // Original name in WPD. Name of file with extension (but without a path) Path : WideString; ObjectType : TIEWPDObjectType; end; PIEWPDObject = ^TIEWPDObject; {!! TIEWPDObjectAdvancedProps Declaration TIEWPDObjectAdvancedProps = Record ObjectID : WideString; ParentID : WideString; FriendlyName : WideString; // The WPD name. A file without an extension - Best for folders Filename : WideString; // Original name in WPD. Name of file with extension (but without a path) - Best for files PersistentUniqueID : WideString; ObjectFormat : ; ContentType : ; IsHidden : Boolean; IsSystem : Boolean; DateCreated : TDateTime; DateModified : TDateTime; SizeBytes : Largeuint; // Is Int64 end; !!} TIEWPDObjectAdvancedProps = Record ObjectID : WideString; ParentID : WideString; FriendlyName : WideString; Filename : WideString; PersistentUniqueID : WideString; ObjectFormat : TWPDObjectFormat; ContentType : TWPDContentType; IsHidden : Boolean; IsSystem : Boolean; DateCreated : TDateTime; DateModified : TDateTime; SizeBytes : Largeuint; end; {!! TIEPortableDevices Description An implementation of Windows Portable Devices API, which provides access to connected devices and external drives. It is used in ImageEn by the class for acquisition of images from devices. Demos Demos\ImageAcquisition\AllAcquire\AllAcquire.dpr Demos\ImageAcquisition\PortableDevices\WPDDemo.dpr Properties Methods Events !!} TIEPortableDevices = class private fDevices : TList; fObjects : TList; fDevicesInitialized : Boolean; fObjectsInitialized : Boolean; fSorted : Boolean; fOnLog : TIEPortableDeviceLogEvent; fLastError : String; fActiveDeviceID: WideString; fActiveFolderID: WideString; fHideEmptyDevices : Boolean; procedure Clear(); procedure ClearObjectList(); function DeviceContainsObjects(const sDeviceID : WideString) : Boolean; procedure AddToLog(const sMsg : String); function GetDevices(Index: Integer): TIEPortableDevice; function GetDeviceCount: Integer; procedure CheckDevicesInitialized(); function GetObjects(Index: Integer): TIEWPDObject; function GetObjectCount: Integer; procedure CheckObjectsInitialized(); procedure SetActiveDeviceID(const Value: WideString); procedure SetActiveFolderID(const Value: WideString); function GetCanNavigateToParent: Boolean; public {!! TIEPortableDevices.Create Declaration } constructor Create(); {!!} {!! TIEPortableDevices.Destroy Declaration } destructor Destroy(); override; {!!} property ActiveDeviceID : WideString read fActiveDeviceID write SetActiveDeviceID; property ActiveFolderID : WideString read fActiveFolderID write SetActiveFolderID; function RefreshDevices(): Boolean; property Devices[Index: Integer]: TIEPortableDevice read GetDevices; property DeviceCount : Integer read GetDeviceCount; function DeviceIDToIndex(const sDeviceID : WideString) : Integer; function NavigateToFolderID(const sFolderID : WideString; bIncludeSubFolders : Boolean = False; GetTypes: TIEWPDObjectTypes = [iewFile, iewFolder]) : Boolean; overload; function NavigateToFolderID(const sDeviceID, sFolderID : WideString; bIncludeSubFolders : Boolean = False; GetTypes: TIEWPDObjectTypes = [iewFile, iewFolder]) : Boolean; overload; function NavigateToFolderPath(const sPath : WideString; bIncludeSubFolders : Boolean = False; GetTypes: TIEWPDObjectTypes = [iewFile, iewFolder]) : Boolean; overload; function NavigateToFolderPath(const sDeviceID, sPath : WideString; bIncludeSubFolders : Boolean = False; GetTypes: TIEWPDObjectTypes = [iewFile, iewFolder]) : Boolean; overload; function FindFilesOfType(const sDeviceID, sFolderID : WideString; sFileExtensions: String; iMaxDepth : Integer = 0): Boolean; overload; function FindFilesOfType(const sFolderID : WideString; sFileExtensions: String; iMaxDepth : Integer = 0): Boolean; overload; function FindFilesByName(const sDeviceID, sFolderID, sSearchText: WideString; GetTypes: TIEWPDObjectTypes = [iewFile, iewFolder]; iMaxDepth : Integer = 0): Boolean; overload; function FindFilesByName(const sFolderID, sSearchText: WideString; GetTypes: TIEWPDObjectTypes = [iewFile, iewFolder]; iMaxDepth : Integer = 0): Boolean; overload; function NavigateToParent() : Boolean; property Objects[Index: Integer]: TIEWPDObject read GetObjects; property ObjectCount : Integer read GetObjectCount; function ObjectIDToIndex(const sObjectID : WideString) : Integer; function ObjectIsFolder(const sObjectID : WideString) : Boolean; overload; function ObjectIsFolder(Index: Integer): Boolean; overload; function GetObjectAdvancedProps(const sObjectID: WideString; out DestProps : TIEWPDObjectAdvancedProps): Boolean; overload; function GetObjectAdvancedProps(Index: Integer; out DestProps : TIEWPDObjectAdvancedProps): Boolean; overload; function GetObjectAdvancedProps(const sDeviceID, sObjectID: WideString; out DestProps : TIEWPDObjectAdvancedProps): Boolean; overload; function CopyFileFromDevice(const sDeviceID, sObjectID, sDestFilename: WideString): Boolean; function CopyStreamFromDevice(const sDeviceID, sObjectID: WideString; var ssDestStream: TMemoryStream): Boolean; function Cancel(): Boolean; function CopyFileToDevice(const sDeviceID, sFolderID, sSourceFilename: WideString): Boolean; function DeleteFromDevice(const sDeviceID, sObjectID : WideString; bDeleteSubObjects: Boolean; var sResultText: WideString): Integer; overload; function DeleteFromDevice(const sDeviceID, sObjectID : WideString; bDeleteSubObjects: Boolean = True): Integer; overload; function DeleteFromDevice(const sDeviceID : WideString; ssObjectIDs : TStrings; bDeleteSubObjects: Boolean = True): Integer; overload; function DeleteFromDevice(const sDeviceID : WideString; ssObjectIDs : TStrings; bDeleteSubObjects: Boolean; var sResultText: WideString): Integer; overload; function LookupDeviceFriendlyName(const sDeviceID : WideString): WideString; function LookupObjectFriendlyName(const sObjectID : WideString): WideString; overload; function LookupObjectFriendlyName(const sDeviceID, sObjectID : WideString): WideString; overload; function PathToFolderID(const sPath : WideString) : WideString; overload; function PathToFolderID(const sDeviceID, sPath : WideString) : WideString; overload; {$IFDEF DEBUG} function EnumDeviceProperties(const sDeviceID : WideString; ssDest : TStrings) : Boolean; {$ENDIF} {!! TIEPortableDevices.LastError Declaration property LastError : String; (Read-only) Description Returns detail on the last failure that occured. When calling a WPD method, such as , a false result will indicate failure. Read LastError to access detail of the failure. Example if IEPortableDevices.RefreshDevices = False then ShowMessage('Unable to get devices: ' + IEPortableDevices.LastError); !!} property LastError : String read fLastError; {!! TIEPortableDevices.OnLog Declaration property OnLog : ; Description Specify an OnLog handler to receive debugging information. Example procedure TfrmMain.FormCreate(Sender: TObject); begin fPortableDevices := TIEPortableDevices.Create(); fPortableDevices.OnLog := AddToLog; end; procedure TfrmMain.AddToLog(Sender : TObject; const sMsg : String); begin memLog.Lines.Add( sMsg ); end; !!} property OnLog : TIEPortableDeviceLogEvent read fOnLog write fOnLog; property CanNavigateToParent : Boolean read GetCanNavigateToParent; {!! TIEPortableDevices.Sorted Declaration property Sorted : Boolean; (Read/Write) Description When enabled, the returned list of objects will be sorted alphabetically (also folders before files). Default: True !!} property Sorted : Boolean read fSorted write fSorted; {!! TIEPortableDevices.HideEmptyDevices Declaration property HideEmptyDevices : Boolean; (Read/Write) Description When enabled, the list of devices will exclude any devices that are not available or are empty. Default: False Note: You will need to the device list after changing HideEmptyDevices. !!} property HideEmptyDevices : Boolean read fHideEmptyDevices write fHideEmptyDevices; end; implementation uses SysUtils, Windows, Variants, Controls, hyieutils, OleServer, hyiedefs; type TLogger = procedure(const sMsg : String) of object; const CLASS_PortableDeviceValues: TGUID = '{0c15d503-d017-47ce-9016-7b3f978721cc}'; CLASS_PortableDevicePropVariantCollection: TGUID = '{08a99e2f-6d6d-4b80-af5a-baf2bcbe4cb9}'; CLSID_PortableDeviceKeyCollection: TGUID = '{de2d022d-2480-43be-97f0-d1fa2cf98f4f}'; {$IFDEF DEBUG} WPD_CATEGORY_CAPABILITIES : TGuid = '{0cabec78-6b74-41c6-9216-2639d1fce356}'; WPD_CATEGORY_COMMON : TGuid = '{f0422a9c-5dc8-4440-b5bd-5df28835658a}'; WPD_CATEGORY_DEVICE_HINTS : TGuid = '{0d5fb92b-cb46-4c4f-8343-0bc3d3f17c84}'; WPD_CATEGORY_MEDIA_CAPTURE : TGuid = '{59b433ba-fe44-4d8d-808c-6bcb9b0f15e8}'; WPD_CATEGORY_NETWORK_CONFIGURATION : TGuid = '{78f9c6fc-79b8-473c-9060-6bd23dd072c4}'; WPD_CATEGORY_NULL : TGuid = '{00000000-0000-0000-0000-000000000000}'; WPD_CATEGORY_OBJECT_ENUMERATION : TGuid = '{b7474e91-e7f8-4ad9-b400-ad1a4b58eeec}'; WPD_CATEGORY_OBJECT_MANAGEMENT : TGuid = '{ef1e43dd-a9ed-4341-8bcc-186192aea089}'; WPD_CATEGORY_OBJECT_PROPERTIES : TGuid = '{9e5582e4-0814-44e6-981a-b2998d583804}'; WPD_CATEGORY_OBJECT_PROPERTIES_BULK : TGuid = '{11c824dd-04cd-4e4e-8c7b-f6efb794d84e}'; WPD_CATEGORY_OBJECT_RESOURCES : TGuid = '{b3a2b22d-a595-4108-be0a-fc3c965f3d4a}'; WPD_CATEGORY_SERVICE_CAPABILITIES : TGuid = '{24457e74-2e9f-44f9-8c57-1d1bcb170b89}'; WPD_CATEGORY_SERVICE_COMMON : TGuid = '{322f071d-36ef-477f-b4b5-6f52d734baee}'; WPD_CATEGORY_SERVICE_METHODS : TGuid = '{2d521ca8-c1b0-4268-a342-cf19321569bc}'; WPD_CATEGORY_SMS : TGuid = '{afc25d66-fe0d-4114-9097-970c93e920d1}'; WPD_CATEGORY_STILL_IMAGE_CAPTURE : TGuid = '{4fcd6982-22a2-4b05-a48b-62d38bf27b32}'; WPD_CATEGORY_STORAGE : TGuid = '{d8f907a6-34cc-45fa-97fb-d007fa47ec94}'; {$ENDIF} WPD_CONTENT_TYPE_ALL : TGuid = '{80e170d2-1055-4a3e-b952-82cc4f8a8689}'; WPD_CONTENT_TYPE_APPOINTMENT : TGuid = '{0fed060e-8793-4b1e-90c9-48ac389ac631}'; WPD_CONTENT_TYPE_AUDIO : TGuid = '{4ad2c85e-5e2d-45e5-8864-4f229e3c6cf0}'; WPD_CONTENT_TYPE_AUDIO_ALBUM : TGuid = '{aa18737e-5009-48fa-ae21-85f24383b4e6}'; WPD_CONTENT_TYPE_CALENDAR : TGuid = '{a1fd5967-6023-49a0-9df1-f8060be751b0}'; WPD_CONTENT_TYPE_CERTIFICATE : TGuid = '{dc3876e8-a948-4060-9050-cbd77e8a3d87}'; WPD_CONTENT_TYPE_CONTACT : TGuid = '{eaba8313-4525-4707-9f0e-87c6808e9435}'; WPD_CONTENT_TYPE_CONTACT_GROUP : TGuid = '{346b8932-4c36-40d8-9415-1828291f9de9}'; WPD_CONTENT_TYPE_DOCUMENT : TGuid = '{680adf52-950a-4041-9b41-65e393648155}'; WPD_CONTENT_TYPE_EMAIL : TGuid = '{8038044a-7e51-4f8f-883d-1d0623d14533}'; WPD_CONTENT_TYPE_FUNCTIONAL_OBJECT : TGuid = '{99ed0160-17ff-4c44-9d98-1d7a6f941921}'; WPD_CONTENT_TYPE_GENERIC_FILE : TGuid = '{0085e0a6-8d34-45d7-bc5c-447e59c73d48}'; WPD_CONTENT_TYPE_GENERIC_MESSAGE : TGuid = '{e80eaaf8-b2db-4133-b67e-1bef4b4a6e5f}'; WPD_CONTENT_TYPE_IMAGE : TGuid = '{ef2107d5-a52a-4243-a26b-62d4176d7603}'; WPD_CONTENT_TYPE_IMAGE_ALBUM : TGuid = '{75793148-15f5-4a30-a813-54ed8a37e226}'; WPD_CONTENT_TYPE_MEDIA_CAST : TGuid = '{5e88b3cc-3e65-4e62-bfff-229495253ab0}'; WPD_CONTENT_TYPE_MEMO : TGuid = '{9cd20ecf-3b50-414f-a641-e473ffe45751}'; WPD_CONTENT_TYPE_MIXED_CONTENT_ALBUM : TGuid = '{00f0c3ac-a593-49ac-9219-24abca5a2563}'; WPD_CONTENT_TYPE_NETWORK_ASSOCIATION : TGuid = '{031da7ee-18c8-4205-847e-89a11261d0f3}'; WPD_CONTENT_TYPE_PLAYLIST : TGuid = '{1a33f7e4-af13-48f5-994e-77369dfe04a3}'; WPD_CONTENT_TYPE_PROGRAM : TGuid = '{d269f96a-247c-4bff-98fb-97f3c49220e6}'; WPD_CONTENT_TYPE_SECTION : TGuid = '{821089f5-1d91-4dc9-be3c-bbb1b35b18ce}'; WPD_CONTENT_TYPE_TASK : TGuid = '{63252f2c-887f-4cb6-b1ac-d29855dcef6c}'; WPD_CONTENT_TYPE_TELEVISION : TGuid = '{60a169cf-f2ae-4e21-9375-9677f11c1c6e}'; WPD_CONTENT_TYPE_UNSPECIFIED : TGuid = '{28d8d31e-249c-454e-aabc-34883168e634}'; WPD_CONTENT_TYPE_VIDEO : TGuid = '{9261b03c-3d78-4519-85e3-02c5e1f50bb9}'; WPD_CONTENT_TYPE_VIDEO_ALBUM : TGuid = '{012b0db7-d4c1-45d6-b081-94b87779614f}'; WPD_CONTENT_TYPE_WIRELESS_PROFILE : TGuid = '{0bac070a-9f5f-4da4-a8f6-3de44d68fd6c}'; WPD_CONTENT_TYPE_FOLDER : TGuid = '{27E2E392-A111-48E0-AB0C-E17705A05F85}'; {$IFDEF DEBUG} WPD_FUNCTIONAL_CATEGORY_ALL : TGuid = '{2d8a6512-a74c-448e-ba8a-f4ac07c49399}'; WPD_FUNCTIONAL_CATEGORY_AUDIO_CAPTURE : TGuid = '{3f2a1919-c7c2-4a00-855d-f57cf06debbb}'; WPD_FUNCTIONAL_CATEGORY_DEVICE : TGuid = '{08ea466b-e3a4-4336-a1f3-a44d2b5c438c}'; WPD_FUNCTIONAL_CATEGORY_NETWORK_CONFIGURATION : TGuid = '{48f4db72-7c6a-4ab0-9e1a-470e3cdbf26a}'; WPD_FUNCTIONAL_CATEGORY_RENDERING_INFORMATION : TGuid = '{08600ba4-a7ba-4a01-ab0e-0065d0a356d3}'; WPD_FUNCTIONAL_CATEGORY_SMS : TGuid = '{0044a0b1-c1e9-4afd-b358-a62c6117c9cf}'; WPD_FUNCTIONAL_CATEGORY_STILL_IMAGE_CAPTURE : TGuid = '{613ca327-ab93-4900-b4fa-895bb5874b79}'; WPD_FUNCTIONAL_CATEGORY_STORAGE : TGuid = '{23f05bbc-15de-4c2a-a55b-a9af5ce412ef}'; WPD_FUNCTIONAL_CATEGORY_VIDEO_CAPTURE : TGuid = '{e23e5f6b-7243-43aa-8df1-0eb3d968a918}'; WPD_FUNCTIONAL_OBJECT_PROPERTIES_V1 : TGuid = '{8f052d93-abca-4fc5-a5ac-b01df4dbe598}'; {$ENDIF} WPD_OBJECT_FORMAT_3GP : TGuid = '{b9840000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_AAC : TGuid = '{b9030000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_ABSTRACT_CONTACT : TGuid = '{bb810000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_ABSTRACT_CONTACT_GROUP : TGuid = '{ba060000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_ABSTRACT_MEDIA_CAST : TGuid = '{ba0b0000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_AIFF : TGuid = '{30070000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_ALL : TGuid = '{c1f62eb2-4bb3-479c-9cfa-05b5f3a57b22}'; WPD_OBJECT_FORMAT_ASF : TGuid = '{300c0000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_ASXPLAYLIST : TGuid = '{ba130000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_AUDIBLE : TGuid = '{b9040000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_AVI : TGuid = '{300a0000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_BMP : TGuid = '{38040000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_CIFF : TGuid = '{38050000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_DPOF : TGuid = '{30060000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_EXECUTABLE : TGuid = '{30030000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_EXIF : TGuid = '{38010000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_FLAC : TGuid = '{b9060000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_FLASHPIX : TGuid = '{38030000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_GIF : TGuid = '{38070000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_HTML : TGuid = '{30050000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_ICALENDAR : TGuid = '{be030000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_ICON : TGuid = '{077232ed-102c-4638-9c22-83f142bfc822}'; WPD_OBJECT_FORMAT_JFIF : TGuid = '{38080000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_JP2 : TGuid = '{380f0000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_JPX : TGuid = '{38100000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_M3UPLAYLIST : TGuid = '{ba110000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_M4A : TGuid = '{30aba7ac-6ffd-4c23-a359-3e9b52f3f1c8}'; WPD_OBJECT_FORMAT_MHT_COMPILED_HTML : TGuid = '{ba840000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_MICROSOFT_EXCEL : TGuid = '{ba850000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_MICROSOFT_POWERPOINT : TGuid = '{ba860000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_MICROSOFT_WFC : TGuid = '{b1040000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_MICROSOFT_WORD : TGuid = '{ba830000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_MP2 : TGuid = '{b9830000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_MP3 : TGuid = '{30090000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_MP4 : TGuid = '{b9820000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_MPEG : TGuid = '{300b0000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_MPLPLAYLIST : TGuid = '{ba120000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_NETWORK_ASSOCIATION : TGuid = '{b1020000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_OGG : TGuid = '{b9020000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_PCD : TGuid = '{38090000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_PICT : TGuid = '{380a0000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_PLSPLAYLIST : TGuid = '{ba140000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_PNG : TGuid = '{380b0000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_PROPERTIES_ONLY : TGuid = '{30010000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_SCRIPT : TGuid = '{30020000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_TEXT : TGuid = '{30040000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_TIFF : TGuid = '{380d0000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_TIFFEP : TGuid = '{38020000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_TIFFIT : TGuid = '{380e0000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_UNSPECIFIED : TGuid = '{30000000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_VCALENDAR1 : TGuid = '{be020000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_VCARD2 : TGuid = '{bb820000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_VCARD3 : TGuid = '{bb830000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_WAVE : TGuid = '{30080000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_WINDOWSIMAGEFORMAT : TGuid = '{b8810000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_WMA : TGuid = '{b9010000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_WMV : TGuid = '{b9810000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_WPLPLAYLIST : TGuid = '{ba100000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_X509V3CERTIFICATE : TGuid = '{b1030000-ae6c-4804-98ba-c57b46965fe7}'; WPD_OBJECT_FORMAT_XML : TGuid = '{ba820000-ae6c-4804-98ba-c57b46965fe7}'; WPD_PROPERTY_NULL_FMTID : TGuid = '{00000000-0000-0000-0000-000000000000}'; WPD_PROPERTY_NULL_PID = 0; WPD_OBJECT_ID_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_ID_PID = 2; WPD_OBJECT_PARENT_ID_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_PARENT_ID_PID = 3; WPD_OBJECT_NAME_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_NAME_PID = 4; WPD_OBJECT_PERSISTENT_UNIQUE_ID_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_PERSISTENT_UNIQUE_ID_PID = 5; WPD_OBJECT_FORMAT_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_FORMAT_PID = 6; WPD_OBJECT_CONTENT_TYPE_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_CONTENT_TYPE_PID = 7; WPD_OBJECT_ISHIDDEN_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_ISHIDDEN_PID = 9; WPD_OBJECT_ISSYSTEM_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_ISSYSTEM_PID = 10; WPD_OBJECT_SIZE_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_SIZE_PID = 11; WPD_OBJECT_ORIGINAL_FILE_NAME_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_ORIGINAL_FILE_NAME_PID = 12; WPD_OBJECT_NON_CONSUMABLE_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_NON_CONSUMABLE_PID = 13; WPD_OBJECT_REFERENCES_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_REFERENCES_PID = 14; WPD_OBJECT_KEYWORDS_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_KEYWORDS_PID = 15; WPD_OBJECT_SYNC_ID_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_SYNC_ID_PID = 16; WPD_OBJECT_IS_DRM_PROTECTED_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_IS_DRM_PROTECTED_PID = 17; WPD_OBJECT_DATE_CREATED_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_DATE_CREATED_PID = 18; WPD_OBJECT_DATE_MODIFIED_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_DATE_MODIFIED_PID = 19; WPD_OBJECT_DATE_AUTHORED_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_DATE_AUTHORED_PID = 20; WPD_OBJECT_BACK_REFERENCES_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_BACK_REFERENCES_PID = 21; WPD_OBJECT_CONTAINER_FUNCTIONAL_OBJECT_ID_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_CONTAINER_FUNCTIONAL_OBJECT_ID_PID = 23; WPD_OBJECT_GENERATE_THUMBNAIL_FROM_RESOURCE_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_GENERATE_THUMBNAIL_FROM_RESOURCE_PID = 24; WPD_OBJECT_HINT_LOCATION_DISPLAY_NAME_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_HINT_LOCATION_DISPLAY_NAME_PID = 25; WPD_OBJECT_CAN_DELETE_FMTID : TGuid = '{EF6B490D-5CD8-437A-AFFC-DA8B60EE4A3C}'; WPD_OBJECT_CAN_DELETE_PID = 26; WPD_CLIENT_NAME_FMTID : TGuid = '{204D9F0C-2292-4080-9F42-40664E70F859}'; WPD_CLIENT_NAME_PID = 2; WPD_CLIENT_MAJOR_VERSION_FMTID : TGuid = '{204D9F0C-2292-4080-9F42-40664E70F859}'; WPD_CLIENT_MAJOR_VERSION_PID = 3; WPD_CLIENT_MINOR_VERSION_FMTID : TGuid = '{204D9F0C-2292-4080-9F42-40664E70F859}'; WPD_CLIENT_MINOR_VERSION_PID = 4; WPD_CLIENT_REVISION_FMTID : TGuid = '{204D9F0C-2292-4080-9F42-40664E70F859}'; WPD_CLIENT_REVISION_PID = 5; WPD_CLIENT_DESIRED_ACCESS_FMTID : TGuid = '{204D9F0C-2292-4080-9F42-40664E70F859}'; WPD_CLIENT_DESIRED_ACCESS_PID = 9; WPD_DEVICE_FRIENDLY_NAME_FMTID : TGuid = '{26D4979A-E643-4626-9E2B-736DC0C92FDC}'; WPD_DEVICE_FRIENDLY_NAME_PID = 12; WPD_RESOURCE_DEFAULT_FMTID : TGuid = '{E81E79BE-34F0-41BF-B53F-F1A06AE87842}'; WPD_RESOURCE_DEFAULT_PID = 0; WPD_PROPERTY_ATTRIBUTE_FORM_FMTID : TGuid = '{ab7943d8-6332-445f-a00d-8d5ef1e96f37}'; WPD_PROPERTY_ATTRIBUTE_FORM_PID = 2; WPD_PROPERTY_ATTRIBUTE_CAN_READ_FMTID : TGuid = '{ab7943d8-6332-445f-a00d-8d5ef1e96f37}'; WPD_PROPERTY_ATTRIBUTE_CAN_READ_PID = 3; WPD_PROPERTY_ATTRIBUTE_CAN_WRITE_FMTID : TGuid = '{ab7943d8-6332-445f-a00d-8d5ef1e96f37}'; WPD_PROPERTY_ATTRIBUTE_CAN_WRITE_PID = 4; WPD_PROPERTY_ATTRIBUTE_CAN_DELETE_FMTID : TGuid = '{ab7943d8-6332-445f-a00d-8d5ef1e96f37}'; WPD_PROPERTY_ATTRIBUTE_CAN_DELETE_PID = 5; WPD_PROPERTY_ATTRIBUTE_DEFAULT_VALUE_FMTID : TGuid = '{ab7943d8-6332-445f-a00d-8d5ef1e96f37}'; WPD_PROPERTY_ATTRIBUTE_DEFAULT_VALUE_PID = 6; WPD_PROPERTY_ATTRIBUTE_FAST_PROPERTY_FMTID : TGuid = '{ab7943d8-6332-445f-a00d-8d5ef1e96f37}'; WPD_PROPERTY_ATTRIBUTE_FAST_PROPERTY_PID = 7; WPD_PROPERTY_ATTRIBUTE_RANGE_MIN_FMTID : TGuid = '{ab7943d8-6332-445f-a00d-8d5ef1e96f37}'; WPD_PROPERTY_ATTRIBUTE_RANGE_MIN_PID = 8; WPD_PROPERTY_ATTRIBUTE_RANGE_MAX_FMTID : TGuid = '{ab7943d8-6332-445f-a00d-8d5ef1e96f37}'; WPD_PROPERTY_ATTRIBUTE_RANGE_MAX_PID = 9; WPD_PROPERTY_ATTRIBUTE_RANGE_STEP_FMTID : TGuid = '{ab7943d8-6332-445f-a00d-8d5ef1e96f37}'; WPD_PROPERTY_ATTRIBUTE_RANGE_STEP_PID = 10; WPD_PROPERTY_ATTRIBUTE_ENUMERATION_ELEMENTS_FMTID : TGuid = '{ab7943d8-6332-445f-a00d-8d5ef1e96f37}'; WPD_PROPERTY_ATTRIBUTE_ENUMERATION_ELEMENTS_PID = 11; WPD_PROPERTY_ATTRIBUTE_REGULAR_EXPRESSION_FMTID : TGuid = '{ab7943d8-6332-445f-a00d-8d5ef1e96f37}'; WPD_PROPERTY_ATTRIBUTE_REGULAR_EXPRESSION_PID = 12; WPD_PROPERTY_ATTRIBUTE_MAX_SIZE_FMTID : TGuid = '{ab7943d8-6332-445f-a00d-8d5ef1e96f37}'; WPD_PROPERTY_ATTRIBUTE_MAX_SIZE_PID = 13; WPD_DEVICE_OBJECT_ID = 'DEVICE'; (* OTHER WPD CONSTS GUID_DEVINTERFACE_WPD : TGuid = '{6ac27878-a6fa-4155-ba85-f98f491d4f33}'; GUID_DEVINTERFACE_WPD_PRIVATE : TGuid = '{ba0c718f-4ded-49b7-bdd3-fabe28661211}'; GUID_DEVINTERFACE_WPD_SERVICE : TGuid = '{9ef44f80-3d64-4246-a6aa-206f328d1edc}'; WPD_API_OPTIONS_V1 : TGuid = '{10e54a3e-052d-4777-a13c-de7614be2bc4}'; WPD_APPOINTMENT_OBJECT_PROPERTIES_V1 : TGuid = '{f99efd03-431d-40d8-a1c9-4e220d9c88d3}'; WPD_CLASS_EXTENSION_OPTIONS_V1 : TGuid = '{6309ffef-a87c-4ca7-8434-797576e40a96}'; WPD_CLASS_EXTENSION_OPTIONS_V2 : TGuid = '{3e3595da-4d71-49fe-a0b4-d4406c3ae93f}'; WPD_CLASS_EXTENSION_V1 : TGuid = '{33fb0d11-64a3-4fac-b4c7-3dfeaa99b051}'; WPD_CLASS_EXTENSION_V2 : TGuid = '{7f0779b5-fa2b-4766-9cb2-f73ba30b6758}'; WPD_CLIENT_INFORMATION_PROPERTIES_V1 : TGuid = '{204d9f0c-2292-4080-9f42-40664e70f859}'; WPD_COMMON_INFORMATION_OBJECT_PROPERTIES_V1 : TGuid = '{b28ae94b-05a4-4e8e-be01-72cc7e099d8f}'; WPD_PROPERTY_COMMON_COMMAND_CATEGORY : TGuid = '{4d545058-1a2e-4106-a357-771e0819fc56}'; WPD_CONTACT_OBJECT_PROPERTIES_V1 : TGuid = '{fbd4fdab-987d-4777-b3f9-726185a9312b}'; WPD_DEVICE_PROPERTIES_V1 : TGuid = '{26d4979a-e643-4626-9e2b-736dc0c92fdc}'; WPD_DEVICE_PROPERTIES_V2 : TGuid = '{463dd662-7fc4-4291-911c-7f4c9cca9799}'; WPD_DOCUMENT_OBJECT_PROPERTIES_V1 : TGuid = '{0b110203-eb95-4f02-93e0-97c631493ad5}'; WPD_EMAIL_OBJECT_PROPERTIES_V1 : TGuid = '{41f8f65a-5484-4782-b13d-4740dd7c37c5}'; WPD_EVENT_ATTRIBUTES_V1 : TGuid = '{10c96578-2e81-4111-adde-e08ca6138f6d}'; WPD_EVENT_DEVICE_CAPABILITIES_UPDATED : TGuid = '{36885aa1-cd54-4daa-b3d0-afb3e03f5999}'; WPD_EVENT_DEVICE_REMOVED : TGuid = '{e4cbca1b-6918-48b9-85ee-02be7c850af9}'; WPD_EVENT_DEVICE_RESET : TGuid = '{7755cf53-c1ed-44f3-b5a2-451e2c376b27}'; WPD_EVENT_OBJECT_ADDED : TGuid = '{a726da95-e207-4b02-8d44-bef2e86cbffc}'; WPD_EVENT_OBJECT_REMOVED : TGuid = '{be82ab88-a52c-4823-96e5-d0272671fc38}'; WPD_EVENT_OBJECT_TRANSFER_REQUESTED : TGuid = '{8d16a0a1-f2c6-41da-8f19-5e53721adbf2}'; WPD_EVENT_OBJECT_UPDATED : TGuid = '{1445a759-2e01-485d-9f27-ff07dae697ab}'; WPD_EVENT_OPTIONS_V1 : TGuid = '{b3d8dad7-a361-4b83-8a48-5b02ce10713b}'; WPD_EVENT_PROPERTIES_V1 : TGuid = '{15ab1953-f817-4fef-a921-5676e838f6e0}'; WPD_EVENT_PROPERTIES_V2 : TGuid = '{52807b8a-4914-4323-9b9a-74f654b2b846}'; WPD_EVENT_SERVICE_METHOD_COMPLETE : TGuid = '{8a33f5f8-0acc-4d9b-9cc4-112d353b86ca}'; WPD_EVENT_STORAGE_FORMAT : TGuid = '{3782616b-22bc-4474-a251-3070f8d38857}'; WPD_FOLDER_OBJECT_PROPERTIES_V1 : TGuid = '{7e9a7abf-e568-4b34-aa2f-13bb12ab177d}'; WPD_FORMAT_ATTRIBUTES_V1 : TGuid = '{a0a02000-bcaf-4be8-b3f5-233f231cf58f}'; WPD_IMAGE_OBJECT_PROPERTIES_V1 : TGuid = '{63d64908-9fa1-479f-85ba-9952216447db}'; WPD_MEDIA_PROPERTIES_V1 : TGuid = '{2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8}'; WPD_MEMO_OBJECT_PROPERTIES_V1 : TGuid = '{5ffbfc7b-7483-41ad-afb9-da3f4e592b8d}'; WPD_METHOD_ATTRIBUTES_V1 : TGuid = '{f17a5071-f039-44af-8efe-432cf32e432a}'; WPD_MUSIC_OBJECT_PROPERTIES_V1 : TGuid = '{b324f56a-dc5d-46e5-b6df-d2ea414888c6}'; WPD_NETWORK_ASSOCIATION_PROPERTIES_V1 : TGuid = '{e4c93c1f-b203-43f1-a100-5a07d11b0274}'; WPD_OBJECT_PROPERTIES_V1 : TGuid = '{ef6b490d-5cd8-437a-affc-da8b60ee4a3c}'; WPD_PARAMETER_ATTRIBUTES_V1 : TGuid = '{e6864dd7-f325-45ea-a1d5-97cf73b6ca58}'; WPD_PROPERTY_ATTRIBUTES_V1 : TGuid = '{ab7943d8-6332-445f-a00d-8d5ef1e96f37}'; WPD_PROPERTY_ATTRIBUTES_V2 : TGuid = '{5d9da160-74ae-43cc-85a9-fe555a80798e}'; WPD_RENDERING_INFORMATION_OBJECT_PROPERTIES_V1 : TGuid = '{c53d039f-ee23-4a31-8590-7639879870b4}'; WPD_RESOURCE_ATTRIBUTES_V1 : TGuid = '{1eb6f604-9278-429f-93cc-5bb8c06656b6}'; WPD_SECTION_OBJECT_PROPERTIES_V1 : TGuid = '{516afd2b-c64e-44f0-98dc-bee1c88f7d66}'; WPD_SERVICE_PROPERTIES_V1 : TGuid = '{7510698a-cb54-481c-b8db-0d75c93f1c06}'; WPD_SMS_OBJECT_PROPERTIES_V1 : TGuid = '{7e1074cc-50ff-4dd1-a742-53be6f093a0d}'; WPD_STILL_IMAGE_CAPTURE_OBJECT_PROPERTIES_V1 : TGuid = '{58c571ec-1bcb-42a7-8ac5-bb291573a260}'; WPD_STORAGE_OBJECT_PROPERTIES_V1 : TGuid = '{01a3057a-74d6-4e80-bea7-dc4c212ce50a}'; WPD_TASK_OBJECT_PROPERTIES_V1 : TGuid = '{e354e95e-d8a0-4637-a03a-0cb26838dbc7}'; WPD_VIDEO_OBJECT_PROPERTIES_V1 : TGuid = '{346f2163-f998-4146-8b01-d19b4c00de9a}'; *) // ************************************************************************ // // Type Lib: C:\Windows\system32\PortableDeviceApi.dll (1) // HelpString: PortableDeviceApi 1.0 Type Library // ************************************************************************ // // *********************************************************************// // GUIDS declared in the TypeLibrary. Following prefixes are used: // Type Libraries : LIBID_xxxx // CoClasses : CLASS_xxxx // DISPInterfaces : DIID_xxxx // Non-DISP interfaces: IID_xxxx // *********************************************************************// const // TypeLibrary Major and minor versions PortableDeviceApiLibMajorVersion = 1; PortableDeviceApiLibMinorVersion = 0; LIBID_PortableDeviceApiLib: TGUID = '{1F001332-1A57-4934-BE31-AFFC99F4EE0A}'; IID_IPortableDevice: TGUID = '{625E2DF8-6392-4CF0-9AD1-3CFA5F17775C}'; CLASS_PortableDevice: TGUID = '{728A21C5-3D9E-48D7-9810-864848F0F404}'; IID_IPortableDeviceValues: TGUID = '{6848F6F2-3155-4F86-B6F5-263EEEAB3143}'; IID_ISequentialStream: TGUID = '{0C733A30-2A1C-11CE-ADE5-00AA0044773D}'; IID_IStream: TGUID = '{0000000C-0000-0000-C000-000000000046}'; IID_IStorage: TGUID = '{0000000B-0000-0000-C000-000000000046}'; IID_IEnumSTATSTG: TGUID = '{0000000D-0000-0000-C000-000000000046}'; IID_IRecordInfo: TGUID = '{0000002F-0000-0000-C000-000000000046}'; IID_ITypeInfo: TGUID = '{00020401-0000-0000-C000-000000000046}'; IID_ITypeComp: TGUID = '{00020403-0000-0000-C000-000000000046}'; IID_ITypeLib: TGUID = '{00020402-0000-0000-C000-000000000046}'; IID_IPortableDevicePropVariantCollection: TGUID = '{89B2E422-4F1B-4316-BCEF-A44AFEA83EB3}'; IID_IPortableDeviceKeyCollection: TGUID = '{DADA2357-E0AD-492E-98DB-DD61C53BA353}'; IID_IPortableDeviceValuesCollection: TGUID = '{6E3F2D79-4E07-48C4-8208-D8C2E5AF4A99}'; IID_IPropertyStore: TGUID = '{886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99}'; IID_IPortableDeviceContent: TGUID = '{6A96ED84-7C73-4480-9938-BF5AF477D426}'; IID_IEnumPortableDeviceObjectIDs: TGUID = '{10ECE955-CF41-4728-BFA0-41EEDF1BBF19}'; IID_IPortableDeviceProperties: TGUID = '{7F6D695C-03DF-4439-A809-59266BEEE3A6}'; IID_IPortableDeviceResources: TGUID = '{FD8878AC-D841-4D17-891C-E6829CDB6934}'; IID_IPortableDeviceCapabilities: TGUID = '{2C8C6DBF-E3DC-4061-BECC-8542E810D126}'; IID_IPortableDeviceEventCallback: TGUID = '{A8792A31-F385-493C-A893-40F64EB45F6E}'; IID_IPortableDeviceManager: TGUID = '{A1567595-4C2F-4574-A6FA-ECEF917B9A40}'; CLASS_PortableDeviceManager: TGUID = '{0AF10CEC-2ECD-4B92-9581-34F6AE0637F3}'; IID_IPortableDeviceService: TGUID = '{D3BD3A44-D7B5-40A9-98B7-2FA4D01DEC08}'; CLASS_PortableDeviceService: TGUID = '{EF5DB4C2-9312-422C-9152-411CD9C4DD84}'; IID_IPortableDeviceServiceCapabilities: TGUID = '{24DBD89D-413E-43E0-BD5B-197F3C56C886}'; IID_IPortableDeviceContent2: TGUID = '{9B4ADD96-F6BF-4034-8708-ECA72BF10554}'; IID_IPortableDeviceServiceMethods: TGUID = '{E20333C9-FD34-412D-A381-CC6F2D820DF7}'; IID_IPortableDeviceServiceMethodCallback: TGUID = '{C424233C-AFCE-4828-A756-7ED7A2350083}'; IID_IPortableDeviceDispatchFactory: TGUID = '{5E1EAFC3-E3D7-4132-96FA-759C0F9D1E0F}'; CLASS_PortableDeviceDispatchFactory: TGUID = '{43232233-8338-4658-AE01-0B4AE830B6B0}'; CLASS_PortableDeviceFTM: TGUID = '{F7C0039A-4762-488A-B4B3-760EF9A1BA9B}'; CLASS_PortableDeviceServiceFTM: TGUID = '{1649B154-C794-497A-9B03-F3F0121302F3}'; // *********************************************************************// // Declaration of Enumerations defined in Type Library // *********************************************************************// // Constants for enum tagTYPEKIND type tagTYPEKIND = TOleEnum; const TKIND_ENUM = $00000000; TKIND_RECORD = $00000001; TKIND_MODULE = $00000002; TKIND_INTERFACE = $00000003; TKIND_DISPATCH = $00000004; TKIND_COCLASS = $00000005; TKIND_ALIAS = $00000006; TKIND_UNION = $00000007; TKIND_MAX = $00000008; // Constants for enum tagDESCKIND type tagDESCKIND = TOleEnum; const DESCKIND_NONE = $00000000; DESCKIND_FUNCDESC = $00000001; DESCKIND_VARDESC = $00000002; DESCKIND_TYPECOMP = $00000003; DESCKIND_IMPLICITAPPOBJ = $00000004; DESCKIND_MAX = $00000005; // Constants for enum tagFUNCKIND type tagFUNCKIND = TOleEnum; const FUNC_VIRTUAL = $00000000; FUNC_PUREVIRTUAL = $00000001; FUNC_NONVIRTUAL = $00000002; FUNC_STATIC = $00000003; FUNC_DISPATCH = $00000004; // Constants for enum tagINVOKEKIND type tagINVOKEKIND = TOleEnum; const INVOKE_FUNC = $00000001; INVOKE_PROPERTYGET = $00000002; INVOKE_PROPERTYPUT = $00000004; INVOKE_PROPERTYPUTREF = $00000008; // Constants for enum tagCALLCONV type tagCALLCONV = TOleEnum; const CC_FASTCALL = $00000000; CC_CDECL = $00000001; CC_MSCPASCAL = $00000002; CC_PASCAL = $00000002; CC_MACPASCAL = $00000003; CC_STDCALL = $00000004; CC_FPFASTCALL = $00000005; CC_SYSCALL = $00000006; CC_MPWCDECL = $00000007; CC_MPWPASCAL = $00000008; CC_MAX = $00000009; // Constants for enum tagVARKIND type tagVARKIND = TOleEnum; const VAR_PERINSTANCE = $00000000; VAR_STATIC = $00000001; VAR_CONST = $00000002; VAR_DISPATCH = $00000003; // Constants for enum tagSYSKIND type tagSYSKIND = TOleEnum; const SYS_WIN16 = $00000000; SYS_WIN32 = $00000001; SYS_MAC = $00000002; SYS_WIN64 = $00000003; type // *********************************************************************// // Forward declaration of types defined in TypeLibrary // *********************************************************************// IPortableDevice = interface; IPortableDeviceValues = interface; ISequentialStream = interface; IStream = interface; IStorage = interface; IEnumSTATSTG = interface; IRecordInfo = interface; ITypeInfo = interface; ITypeComp = interface; ITypeLib = interface; IPortableDevicePropVariantCollection = interface; IPortableDeviceKeyCollection = interface; IPortableDeviceValuesCollection = interface; IPropertyStore = interface; IPortableDeviceContent = interface; IEnumPortableDeviceObjectIDs = interface; IPortableDeviceProperties = interface; IPortableDeviceResources = interface; IPortableDeviceCapabilities = interface; IPortableDeviceEventCallback = interface; IPortableDeviceManager = interface; IPortableDeviceService = interface; IPortableDeviceServiceCapabilities = interface; IPortableDeviceContent2 = interface; IPortableDeviceServiceMethods = interface; IPortableDeviceServiceMethodCallback = interface; IPortableDeviceDispatchFactory = interface; // *********************************************************************// // Declaration of CoClasses defined in Type Library // (NOTE: Here we map each CoClass to its Default Interface) // *********************************************************************// PortableDevice = IPortableDevice; PortableDeviceManager = IPortableDeviceManager; PortableDeviceService = IPortableDeviceService; PortableDeviceDispatchFactory = IPortableDeviceDispatchFactory; PortableDeviceFTM = IPortableDevice; PortableDeviceServiceFTM = IPortableDeviceService; // *********************************************************************// // Declaration of structures, unions and aliases. // *********************************************************************// wirePSAFEARRAY = ^PUserType5; wireSNB = ^tagRemSNB; PUserType6 = ^_FLAGGED_WORD_BLOB; {*} PUserType7 = ^_wireVARIANT; {*} PUserType14 = ^_wireBRECORD; {*} PUserType5 = ^_wireSAFEARRAY; {*} PPUserType1 = ^PUserType5; {*} PUserType11 = ^tagTYPEDESC; {*} PUserType12 = ^tagARRAYDESC; {*} PUserType2 = ^tag_inner_PROPVARIANT; {*} PUINT1 = ^LongWord; {*} PUserType1 = ^_WPDtagpropertykey; {*} PUserType3 = ^TGUID; {*} PByte1 = ^Byte; {*} PUserType4 = ^_FILETIME; {*} POleVariant1 = ^OleVariant; {*} PUserType8 = ^tagTYPEATTR; {*} PUserType9 = ^tagFUNCDESC; {*} PUserType10 = ^tagVARDESC; {*} PUserType13 = ^tagTLIBATTR; {*} _WPDtagpropertykey = packed record fmtid: TGUID; pid: LongWord; end; _LARGE_INTEGER = packed record QuadPart: Int64; end; _ULARGE_INTEGER = packed record QuadPart: Largeuint; end; _FILETIME = packed record dwLowDateTime: LongWord; dwHighDateTime: LongWord; end; tagCLIPDATA = packed record cbSize: LongWord; ulClipFmt: Integer; pClipData: ^Byte; end; tagBSTRBLOB = packed record cbSize: LongWord; pData: ^Byte; end; tagBLOB = packed record cbSize: LongWord; pBlobData: ^Byte; end; tagVersionedStream = packed record guidVersion: TGUID; pStream: IStream; end; tagSTATSTG = packed record pwcsName: PWideChar; type_: LongWord; cbSize: _ULARGE_INTEGER; mtime: _FILETIME; ctime: _FILETIME; atime: _FILETIME; grfMode: LongWord; grfLocksSupported: LongWord; clsid: TGUID; grfStateBits: LongWord; reserved: LongWord; end; tagRemSNB = packed record ulCntStr: LongWord; ulCntChar: LongWord; rgString: ^Word; end; tagCAC = packed record cElems: LongWord; pElems: ^Shortint; end; tagCAUB = packed record cElems: LongWord; pElems: ^Byte; end; _wireSAFEARR_BSTR = packed record Size: LongWord; aBstr: ^PUserType6; end; _wireSAFEARR_UNKNOWN = packed record Size: LongWord; apUnknown: ^IUnknown; end; _wireSAFEARR_DISPATCH = packed record Size: LongWord; apDispatch: ^IDispatch; end; _FLAGGED_WORD_BLOB = packed record fFlags: LongWord; clSize: LongWord; asData: ^Word; end; _wireSAFEARR_VARIANT = packed record Size: LongWord; aVariant: ^PUserType7; end; _wireBRECORD = packed record fFlags: LongWord; clSize: LongWord; pRecInfo: IRecordInfo; pRecord: ^Byte; end; __MIDL_IOleAutomationTypes_0005 = record case Integer of 0: (lptdesc: PUserType11); 1: (lpadesc: PUserType12); 2: (hreftype: LongWord); end; tagTYPEDESC = packed record DUMMYUNIONNAME: __MIDL_IOleAutomationTypes_0005; vt: Word; end; tagSAFEARRAYBOUND = packed record cElements: LongWord; lLbound: Integer; end; ULONG_PTR = LongWord; tagIDLDESC = packed record dwReserved: ULONG_PTR; wIDLFlags: Word; end; DWORD = LongWord; tagPARAMDESCEX = packed record cBytes: LongWord; varDefaultValue: OleVariant; end; tagPARAMDESC = packed record pparamdescex: ^tagPARAMDESCEX; wParamFlags: Word; end; tagELEMDESC = packed record tdesc: tagTYPEDESC; paramdesc: tagPARAMDESC; end; tagFUNCDESC = packed record memid: Integer; lprgscode: ^SCODE; lprgelemdescParam: ^tagELEMDESC; funckind: tagFUNCKIND; invkind: tagINVOKEKIND; callconv: tagCALLCONV; cParams: Smallint; cParamsOpt: Smallint; oVft: Smallint; cScodes: Smallint; elemdescFunc: tagELEMDESC; wFuncFlags: Word; end; __MIDL_IOleAutomationTypes_0006 = record case Integer of 0: (oInst: LongWord); 1: (lpvarValue: ^OleVariant); end; tagVARDESC = packed record memid: Integer; lpstrSchema: PWideChar; DUMMYUNIONNAME: __MIDL_IOleAutomationTypes_0006; elemdescVar: tagELEMDESC; wVarFlags: Word; varkind: tagVARKIND; end; tagTLIBATTR = packed record guid: TGUID; lcid: LongWord; syskind: tagSYSKIND; wMajorVerNum: Word; wMinorVerNum: Word; wLibFlags: Word; end; _wireSAFEARR_BRECORD = packed record Size: LongWord; aRecord: ^PUserType14; end; _wireSAFEARR_HAVEIID = packed record Size: LongWord; apUnknown: ^IUnknown; iid: TGUID; end; _BYTE_SIZEDARR = packed record clSize: LongWord; pData: ^Byte; end; _SHORT_SIZEDARR = packed record clSize: LongWord; pData: ^Word; end; _LONG_SIZEDARR = packed record clSize: LongWord; pData: ^LongWord; end; _HYPER_SIZEDARR = packed record clSize: LongWord; pData: ^Int64; end; tagCAI = packed record cElems: LongWord; pElems: ^Smallint; end; tagCAUI = packed record cElems: LongWord; pElems: ^Word; end; tagCAL = packed record cElems: LongWord; pElems: ^Integer; end; tagCAUL = packed record cElems: LongWord; pElems: ^LongWord; end; tagCAH = packed record cElems: LongWord; pElems: ^_LARGE_INTEGER; end; tagCAUH = packed record cElems: LongWord; pElems: ^_ULARGE_INTEGER; end; tagCAFLT = packed record cElems: LongWord; pElems: ^Single; end; tagCADBL = packed record cElems: LongWord; pElems: ^Double; end; tagCABOOL = packed record cElems: LongWord; pElems: ^WordBool; end; tagCASCODE = packed record cElems: LongWord; pElems: ^SCODE; end; tagCACY = packed record cElems: LongWord; pElems: ^Currency; end; tagCADATE = packed record cElems: LongWord; pElems: ^TDateTime; end; tagCAFILETIME = packed record cElems: LongWord; pElems: ^_FILETIME; end; tagCACLSID = packed record cElems: LongWord; pElems: ^TGUID; end; tagCACLIPDATA = packed record cElems: LongWord; pElems: ^tagCLIPDATA; end; tagCABSTR = packed record cElems: LongWord; pElems: ^WideString; end; tagCABSTRBLOB = packed record cElems: LongWord; pElems: ^tagBSTRBLOB; end; tagCALPSTR = packed record cElems: LongWord; pElems: ^PChar; end; tagCALPWSTR = packed record cElems: LongWord; pElems: ^PWideChar; end; tagCAPROPVARIANT = packed record cElems: LongWord; pElems: PUserType2; end; __MIDL___MIDL_itf_PortableDeviceApi_0001_0000_0001 = record case Integer of 0: (cVal: Shortint); 1: (bVal: Byte); 2: (iVal: Smallint); 3: (uiVal: Word); 4: (lVal: Integer); 5: (ulVal: LongWord); 6: (intVal: SYSINT); 7: (uintVal: SYSUINT); 8: (hVal: _LARGE_INTEGER); 9: (uhVal: _ULARGE_INTEGER); 10: (fltVal: Single); 11: (dblVal: Double); 12: (boolVal: WordBool); 13: (bool: WordBool); 14: (scode: SCODE); 15: (cyVal: Currency); 16: (date: TDateTime); 17: (filetime: _FILETIME); 18: (puuid: ^TGUID); 19: (pClipData: ^tagCLIPDATA); 20: (bstrVal: {!!WideString}Pointer); 21: (bstrblobVal: tagBSTRBLOB); 22: (blob: tagBLOB); 23: (pszVal: PChar); 24: (pwszVal: PWideChar); 25: (punkVal: {!!IUnknown}Pointer); 26: (pdispVal: {!!IDispatch}Pointer); 27: (pStream: {!!IStream}Pointer); 28: (pStorage: {!!IStorage}Pointer); 29: (pVersionedStream: ^tagVersionedStream); 30: (parray: wirePSAFEARRAY); 31: (cac: tagCAC); 32: (caub: tagCAUB); 33: (cai: tagCAI); 34: (caui: tagCAUI); 35: (cal: tagCAL); 36: (caul: tagCAUL); 37: (cah: tagCAH); 38: (cauh: tagCAUH); 39: (caflt: tagCAFLT); 40: (cadbl: tagCADBL); 41: (cabool: tagCABOOL); 42: (cascode: tagCASCODE); 43: (cacy: tagCACY); 44: (cadate: tagCADATE); 45: (cafiletime: tagCAFILETIME); 46: (cauuid: tagCACLSID); 47: (caclipdata: tagCACLIPDATA); 48: (cabstr: tagCABSTR); 49: (cabstrblob: tagCABSTRBLOB); 50: (calpstr: tagCALPSTR); 51: (calpwstr: tagCALPWSTR); 52: (capropvar: tagCAPROPVARIANT); 53: (pcVal: ^Shortint); 54: (pbVal: ^Byte); 55: (piVal: ^Smallint); 56: (puiVal: ^Word); 57: (plVal: ^Integer); 58: (pulVal: ^LongWord); 59: (pintVal: ^SYSINT); 60: (puintVal: ^SYSUINT); 61: (pfltVal: ^Single); 62: (pdblVal: ^Double); 63: (pboolVal: ^WordBool); 64: (pdecVal: ^TDecimal); 65: (pscode: ^SCODE); 66: (pcyVal: ^Currency); 67: (pdate: ^TDateTime); 68: (pbstrVal: ^WideString); 69: (ppunkVal: {!!^IUnknown}Pointer); 70: (ppdispVal: {!!^IDispatch}Pointer); 71: (pparray: ^wirePSAFEARRAY); 72: (pvarVal: PUserType2); end; tag_inner_PROPVARIANT = packed record vt: Word; wReserved1: Byte; wReserved2: Byte; wReserved3: LongWord; AsVariant: __MIDL___MIDL_itf_PortableDeviceApi_0001_0000_0001; end; __MIDL_IOleAutomationTypes_0004 = record case Integer of 0: (llVal: Int64); 1: (lVal: Integer); 2: (bVal: Byte); 3: (iVal: Smallint); 4: (fltVal: Single); 5: (dblVal: Double); 6: (boolVal: WordBool); 7: (scode: SCODE); 8: (cyVal: Currency); 9: (date: TDateTime); 10: (bstrVal: ^_FLAGGED_WORD_BLOB); 11: (punkVal: {!!IUnknown}Pointer); 12: (pdispVal: {!!IDispatch}Pointer); 13: (parray: ^PUserType5); 14: (brecVal: ^_wireBRECORD); 15: (pbVal: ^Byte); 16: (piVal: ^Smallint); 17: (plVal: ^Integer); 18: (pllVal: ^Int64); 19: (pfltVal: ^Single); 20: (pdblVal: ^Double); 21: (pboolVal: ^WordBool); 22: (pscode: ^SCODE); 23: (pcyVal: ^Currency); 24: (pdate: ^TDateTime); 25: (pbstrVal: ^PUserType6); 26: (ppunkVal: {!!^IUnknown}Pointer); 27: (ppdispVal: {!!^IDispatch}Pointer); 28: (pparray: ^PPUserType1); 29: (pvarVal: ^PUserType7); 30: (cVal: Shortint); 31: (uiVal: Word); 32: (ulVal: LongWord); 33: (ullVal: Largeuint); 34: (intVal: SYSINT); 35: (uintVal: SYSUINT); 36: (decVal: TDecimal); 37: (pdecVal: ^TDecimal); 38: (pcVal: ^Shortint); 39: (puiVal: ^Word); 40: (pulVal: ^LongWord); 41: (pullVal: ^Largeuint); 42: (pintVal: ^SYSINT); 43: (puintVal: ^SYSUINT); end; __MIDL_IOleAutomationTypes_0001 = record case Integer of 0: (BstrStr: _wireSAFEARR_BSTR); 1: (UnknownStr: _wireSAFEARR_UNKNOWN); 2: (DispatchStr: _wireSAFEARR_DISPATCH); 3: (VariantStr: _wireSAFEARR_VARIANT); 4: (RecordStr: _wireSAFEARR_BRECORD); 5: (HaveIidStr: _wireSAFEARR_HAVEIID); 6: (ByteStr: _BYTE_SIZEDARR); 7: (WordStr: _SHORT_SIZEDARR); 8: (LongStr: _LONG_SIZEDARR); 9: (HyperStr: _HYPER_SIZEDARR); end; _wireSAFEARRAY_UNION = packed record sfType: LongWord; u: __MIDL_IOleAutomationTypes_0001; end; _wireVARIANT = packed record clSize: LongWord; rpcReserved: LongWord; vt: Word; wReserved1: Word; wReserved2: Word; wReserved3: Word; DUMMYUNIONNAME: __MIDL_IOleAutomationTypes_0004; end; tagTYPEATTR = packed record guid: TGUID; lcid: LongWord; dwReserved: LongWord; memidConstructor: Integer; memidDestructor: Integer; lpstrSchema: PWideChar; cbSizeInstance: LongWord; typekind: tagTYPEKIND; cFuncs: Word; cVars: Word; cImplTypes: Word; cbSizeVft: Word; cbAlignment: Word; wTypeFlags: Word; wMajorVerNum: Word; wMinorVerNum: Word; tdescAlias: tagTYPEDESC; idldescType: tagIDLDESC; end; tagARRAYDESC = packed record tdescElem: tagTYPEDESC; cDims: Word; rgbounds: ^tagSAFEARRAYBOUND; end; _wireSAFEARRAY = packed record cDims: Word; fFeatures: Word; cbElements: LongWord; cLocks: LongWord; uArrayStructs: _wireSAFEARRAY_UNION; rgsabound: ^tagSAFEARRAYBOUND; end; // *********************************************************************// // Interface: IPortableDevice // Flags: (0) // GUID: {625E2DF8-6392-4CF0-9AD1-3CFA5F17775C} // *********************************************************************// IPortableDevice = interface(IUnknown) ['{625E2DF8-6392-4CF0-9AD1-3CFA5F17775C}'] function Open(pszPnPDeviceID: PWideChar; const pClientInfo: IPortableDeviceValues): HResult; stdcall; function SendCommand(dwFlags: LongWord; const pParameters: IPortableDeviceValues; out ppResults: IPortableDeviceValues): HResult; stdcall; function Content(out ppContent: IPortableDeviceContent): HResult; stdcall; function Capabilities(out ppCapabilities: IPortableDeviceCapabilities): HResult; stdcall; function Cancel: HResult; stdcall; function Close: HResult; stdcall; function Advise(dwFlags: LongWord; const pCallback: IPortableDeviceEventCallback; const pParameters: IPortableDeviceValues; out ppszCookie: PWideChar): HResult; stdcall; function Unadvise(pszCookie: PWideChar): HResult; stdcall; function GetPnPDeviceID(out ppszPnPDeviceID: PWideChar): HResult; stdcall; end; // *********************************************************************// // Interface: IPortableDeviceValues // Flags: (0) // GUID: {6848F6F2-3155-4F86-B6F5-263EEEAB3143} // *********************************************************************// IPortableDeviceValues = interface(IUnknown) ['{6848F6F2-3155-4F86-B6F5-263EEEAB3143}'] function GetCount(var pcelt: LongWord): HResult; stdcall; function GetAt(index: LongWord; var pKey: _WPDtagpropertykey; var pValue: tag_inner_PROPVARIANT): HResult; stdcall; function SetValue(var key: _WPDtagpropertykey; var pValue: tag_inner_PROPVARIANT): HResult; stdcall; function GetValue(var key: _WPDtagpropertykey; out pValue: tag_inner_PROPVARIANT): HResult; stdcall; function SetStringValue(var key: _WPDtagpropertykey; Value: PWideChar): HResult; stdcall; function GetStringValue(var key: _WPDtagpropertykey; out pValue: PWideChar): HResult; stdcall; function SetUnsignedIntegerValue(var key: _WPDtagpropertykey; Value: LongWord): HResult; stdcall; function GetUnsignedIntegerValue(var key: _WPDtagpropertykey; out pValue: LongWord): HResult; stdcall; function SetSignedIntegerValue(var key: _WPDtagpropertykey; Value: Integer): HResult; stdcall; function GetSignedIntegerValue(var key: _WPDtagpropertykey; out pValue: Integer): HResult; stdcall; function SetUnsignedLargeIntegerValue(var key: _WPDtagpropertykey; Value: Largeuint): HResult; stdcall; function GetUnsignedLargeIntegerValue(var key: _WPDtagpropertykey; out pValue: Largeuint): HResult; stdcall; function SetSignedLargeIntegerValue(var key: _WPDtagpropertykey; Value: Int64): HResult; stdcall; function GetSignedLargeIntegerValue(var key: _WPDtagpropertykey; out pValue: Int64): HResult; stdcall; function SetFloatValue(var key: _WPDtagpropertykey; Value: Single): HResult; stdcall; function GetFloatValue(var key: _WPDtagpropertykey; out pValue: Single): HResult; stdcall; function SetErrorValue(var key: _WPDtagpropertykey; Value: HResult): HResult; stdcall; function GetErrorValue(var key: _WPDtagpropertykey; out pValue: HResult): HResult; stdcall; function SetKeyValue(var key: _WPDtagpropertykey; var Value: _WPDtagpropertykey): HResult; stdcall; function GetKeyValue(var key: _WPDtagpropertykey; out pValue: _WPDtagpropertykey): HResult; stdcall; function SetBoolValue(var key: _WPDtagpropertykey; Value: Integer): HResult; stdcall; function GetBoolValue(var key: _WPDtagpropertykey; out pValue: Integer): HResult; stdcall; function SetIUnknownValue(var key: _WPDtagpropertykey; const pValue: IUnknown): HResult; stdcall; function GetIUnknownValue(var key: _WPDtagpropertykey; out ppValue: IUnknown): HResult; stdcall; function SetGuidValue(var key: _WPDtagpropertykey; var Value: TGUID): HResult; stdcall; function GetGuidValue(var key: _WPDtagpropertykey; out pValue: TGUID): HResult; stdcall; function SetBufferValue(var key: _WPDtagpropertykey; var pValue: Byte; cbValue: LongWord): HResult; stdcall; function GetBufferValue(var key: _WPDtagpropertykey; out ppValue: PByte1; out pcbValue: LongWord): HResult; stdcall; function SetIPortableDeviceValuesValue(var key: _WPDtagpropertykey; const pValue: IPortableDeviceValues): HResult; stdcall; function GetIPortableDeviceValuesValue(var key: _WPDtagpropertykey; out ppValue: IPortableDeviceValues): HResult; stdcall; function SetIPortableDevicePropVariantCollectionValue(var key: _WPDtagpropertykey; const pValue: IPortableDevicePropVariantCollection): HResult; stdcall; function GetIPortableDevicePropVariantCollectionValue(var key: _WPDtagpropertykey; out ppValue: IPortableDevicePropVariantCollection): HResult; stdcall; function SetIPortableDeviceKeyCollectionValue(var key: _WPDtagpropertykey; const pValue: IPortableDeviceKeyCollection): HResult; stdcall; function GetIPortableDeviceKeyCollectionValue(var key: _WPDtagpropertykey; out ppValue: IPortableDeviceKeyCollection): HResult; stdcall; function SetIPortableDeviceValuesCollectionValue(var key: _WPDtagpropertykey; const pValue: IPortableDeviceValuesCollection): HResult; stdcall; function GetIPortableDeviceValuesCollectionValue(var key: _WPDtagpropertykey; out ppValue: IPortableDeviceValuesCollection): HResult; stdcall; function RemoveValue(var key: _WPDtagpropertykey): HResult; stdcall; function CopyValuesFromPropertyStore(const pStore: IPropertyStore): HResult; stdcall; function CopyValuesToPropertyStore(const pStore: IPropertyStore): HResult; stdcall; function Clear: HResult; stdcall; end; // *********************************************************************// // Interface: ISequentialStream // Flags: (0) // GUID: {0C733A30-2A1C-11CE-ADE5-00AA0044773D} // *********************************************************************// ISequentialStream = interface(IUnknown) ['{0C733A30-2A1C-11CE-ADE5-00AA0044773D}'] function RemoteRead(out pv: Byte; cb: LongWord; out pcbRead: LongWord): HResult; stdcall; function RemoteWrite(var pv: Byte; cb: LongWord; out pcbWritten: LongWord): HResult; stdcall; end; // *********************************************************************// // Interface: IStream // Flags: (0) // GUID: {0000000C-0000-0000-C000-000000000046} // *********************************************************************// IStream = interface(ISequentialStream) ['{0000000C-0000-0000-C000-000000000046}'] function RemoteSeek(dlibMove: _LARGE_INTEGER; dwOrigin: LongWord; out plibNewPosition: _ULARGE_INTEGER): HResult; stdcall; function SetSize(libNewSize: _ULARGE_INTEGER): HResult; stdcall; function RemoteCopyTo(const pstm: IStream; cb: _ULARGE_INTEGER; out pcbRead: _ULARGE_INTEGER; out pcbWritten: _ULARGE_INTEGER): HResult; stdcall; function Commit(grfCommitFlags: LongWord): HResult; stdcall; function Revert: HResult; stdcall; function LockRegion(libOffset: _ULARGE_INTEGER; cb: _ULARGE_INTEGER; dwLockType: LongWord): HResult; stdcall; function UnlockRegion(libOffset: _ULARGE_INTEGER; cb: _ULARGE_INTEGER; dwLockType: LongWord): HResult; stdcall; function Stat(out pstatstg: tagSTATSTG; grfStatFlag: LongWord): HResult; stdcall; function Clone(out ppstm: IStream): HResult; stdcall; end; // *********************************************************************// // Interface: IStorage // Flags: (0) // GUID: {0000000B-0000-0000-C000-000000000046} // *********************************************************************// IStorage = interface(IUnknown) ['{0000000B-0000-0000-C000-000000000046}'] function CreateStream(pwcsName: PWideChar; grfMode: LongWord; reserved1: LongWord; reserved2: LongWord; out ppstm: IStream): HResult; stdcall; function RemoteOpenStream(pwcsName: PWideChar; cbReserved1: LongWord; var reserved1: Byte; grfMode: LongWord; reserved2: LongWord; out ppstm: IStream): HResult; stdcall; function CreateStorage(pwcsName: PWideChar; grfMode: LongWord; reserved1: LongWord; reserved2: LongWord; out ppstg: IStorage): HResult; stdcall; function OpenStorage(pwcsName: PWideChar; const pstgPriority: IStorage; grfMode: LongWord; var snbExclude: tagRemSNB; reserved: LongWord; out ppstg: IStorage): HResult; stdcall; function RemoteCopyTo(ciidExclude: LongWord; var rgiidExclude: TGUID; var snbExclude: tagRemSNB; const pstgDest: IStorage): HResult; stdcall; function MoveElementTo(pwcsName: PWideChar; const pstgDest: IStorage; pwcsNewName: PWideChar; grfFlags: LongWord): HResult; stdcall; function Commit(grfCommitFlags: LongWord): HResult; stdcall; function Revert: HResult; stdcall; function RemoteEnumElements(reserved1: LongWord; cbReserved2: LongWord; var reserved2: Byte; reserved3: LongWord; out ppenum: IEnumSTATSTG): HResult; stdcall; function DestroyElement(pwcsName: PWideChar): HResult; stdcall; function RenameElement(pwcsOldName: PWideChar; pwcsNewName: PWideChar): HResult; stdcall; function SetElementTimes(pwcsName: PWideChar; var pctime: _FILETIME; var patime: _FILETIME; var pmtime: _FILETIME): HResult; stdcall; function SetClass(var clsid: TGUID): HResult; stdcall; function SetStateBits(grfStateBits: LongWord; grfMask: LongWord): HResult; stdcall; function Stat(out pstatstg: tagSTATSTG; grfStatFlag: LongWord): HResult; stdcall; end; // *********************************************************************// // Interface: IEnumSTATSTG // Flags: (0) // GUID: {0000000D-0000-0000-C000-000000000046} // *********************************************************************// IEnumSTATSTG = interface(IUnknown) ['{0000000D-0000-0000-C000-000000000046}'] function RemoteNext(celt: LongWord; out rgelt: tagSTATSTG; out pceltFetched: LongWord): HResult; stdcall; function Skip(celt: LongWord): HResult; stdcall; function Reset: HResult; stdcall; function Clone(out ppenum: IEnumSTATSTG): HResult; stdcall; end; // *********************************************************************// // Interface: IRecordInfo // Flags: (0) // GUID: {0000002F-0000-0000-C000-000000000046} // *********************************************************************// IRecordInfo = interface(IUnknown) ['{0000002F-0000-0000-C000-000000000046}'] function RecordInit(out pvNew: Pointer): HResult; stdcall; function RecordClear(var pvExisting: Pointer): HResult; stdcall; function RecordCopy(var pvExisting: Pointer; out pvNew: Pointer): HResult; stdcall; function GetGuid(out pguid: TGUID): HResult; stdcall; function GetName(out pbstrName: WideString): HResult; stdcall; function GetSize(out pcbSize: LongWord): HResult; stdcall; function GetTypeInfo(out ppTypeInfo: ITypeInfo): HResult; stdcall; function GetField(var pvData: Pointer; szFieldName: PWideChar; out pvarField: OleVariant): HResult; stdcall; function GetFieldNoCopy(var pvData: Pointer; szFieldName: PWideChar; out pvarField: OleVariant; out ppvDataCArray: Pointer): HResult; stdcall; function PutField(wFlags: LongWord; var pvData: Pointer; szFieldName: PWideChar; var pvarField: OleVariant): HResult; stdcall; function PutFieldNoCopy(wFlags: LongWord; var pvData: Pointer; szFieldName: PWideChar; var pvarField: OleVariant): HResult; stdcall; function GetFieldNames(var pcNames: LongWord; out rgBstrNames: WideString): HResult; stdcall; function IsMatchingType(const pRecordInfo: IRecordInfo): Integer; stdcall; function RecordCreate: Pointer; stdcall; function RecordCreateCopy(var pvSource: Pointer; out ppvDest: Pointer): HResult; stdcall; function RecordDestroy(var pvRecord: Pointer): HResult; stdcall; end; // *********************************************************************// // Interface: ITypeInfo // Flags: (0) // GUID: {00020401-0000-0000-C000-000000000046} // *********************************************************************// ITypeInfo = interface(IUnknown) ['{00020401-0000-0000-C000-000000000046}'] function RemoteGetTypeAttr(out ppTypeAttr: PUserType8; out pDummy: DWORD): HResult; stdcall; function GetTypeComp(out ppTComp: ITypeComp): HResult; stdcall; function RemoteGetFuncDesc(index: SYSUINT; out ppFuncDesc: PUserType9; out pDummy: DWORD): HResult; stdcall; function RemoteGetVarDesc(index: SYSUINT; out ppVarDesc: PUserType10; out pDummy: DWORD): HResult; stdcall; function RemoteGetNames(memid: Integer; out rgBstrNames: WideString; cMaxNames: SYSUINT; out pcNames: SYSUINT): HResult; stdcall; function GetRefTypeOfImplType(index: SYSUINT; out pRefType: LongWord): HResult; stdcall; function GetImplTypeFlags(index: SYSUINT; out pImplTypeFlags: SYSINT): HResult; stdcall; function LocalGetIDsOfNames: HResult; stdcall; function LocalInvoke: HResult; stdcall; function RemoteGetDocumentation(memid: Integer; refPtrFlags: LongWord; out pbstrName: WideString; out pBstrDocString: WideString; out pdwHelpContext: LongWord; out pBstrHelpFile: WideString): HResult; stdcall; function RemoteGetDllEntry(memid: Integer; invkind: tagINVOKEKIND; refPtrFlags: LongWord; out pBstrDllName: WideString; out pbstrName: WideString; out pwOrdinal: Word): HResult; stdcall; function GetRefTypeInfo(hreftype: LongWord; out ppTInfo: ITypeInfo): HResult; stdcall; function LocalAddressOfMember: HResult; stdcall; function RemoteCreateInstance(var riid: TGUID; out ppvObj: IUnknown): HResult; stdcall; function GetMops(memid: Integer; out pBstrMops: WideString): HResult; stdcall; function RemoteGetContainingTypeLib(out ppTLib: ITypeLib; out pIndex: SYSUINT): HResult; stdcall; function LocalReleaseTypeAttr: HResult; stdcall; function LocalReleaseFuncDesc: HResult; stdcall; function LocalReleaseVarDesc: HResult; stdcall; end; // *********************************************************************// // Interface: ITypeComp // Flags: (0) // GUID: {00020403-0000-0000-C000-000000000046} // *********************************************************************// ITypeComp = interface(IUnknown) ['{00020403-0000-0000-C000-000000000046}'] function RemoteBind(szName: PWideChar; lHashVal: LongWord; wFlags: Word; out ppTInfo: ITypeInfo; out pDescKind: tagDESCKIND; out ppFuncDesc: PUserType9; out ppVarDesc: PUserType10; out ppTypeComp: ITypeComp; out pDummy: DWORD): HResult; stdcall; function RemoteBindType(szName: PWideChar; lHashVal: LongWord; out ppTInfo: ITypeInfo): HResult; stdcall; end; // *********************************************************************// // Interface: ITypeLib // Flags: (0) // GUID: {00020402-0000-0000-C000-000000000046} // *********************************************************************// ITypeLib = interface(IUnknown) ['{00020402-0000-0000-C000-000000000046}'] function RemoteGetTypeInfoCount(out pcTInfo: SYSUINT): HResult; stdcall; function GetTypeInfo(index: SYSUINT; out ppTInfo: ITypeInfo): HResult; stdcall; function GetTypeInfoType(index: SYSUINT; out pTKind: tagTYPEKIND): HResult; stdcall; function GetTypeInfoOfGuid(var guid: TGUID; out ppTInfo: ITypeInfo): HResult; stdcall; function RemoteGetLibAttr(out ppTLibAttr: PUserType13; out pDummy: DWORD): HResult; stdcall; function GetTypeComp(out ppTComp: ITypeComp): HResult; stdcall; function RemoteGetDocumentation(index: SYSINT; refPtrFlags: LongWord; out pbstrName: WideString; out pBstrDocString: WideString; out pdwHelpContext: LongWord; out pBstrHelpFile: WideString): HResult; stdcall; function RemoteIsName(szNameBuf: PWideChar; lHashVal: LongWord; out pfName: Integer; out pBstrLibName: WideString): HResult; stdcall; function RemoteFindName(szNameBuf: PWideChar; lHashVal: LongWord; out ppTInfo: ITypeInfo; out rgMemId: Integer; var pcFound: Word; out pBstrLibName: WideString): HResult; stdcall; function LocalReleaseTLibAttr: HResult; stdcall; end; // *********************************************************************// // Interface: IPortableDevicePropVariantCollection // Flags: (0) // GUID: {89B2E422-4F1B-4316-BCEF-A44AFEA83EB3} // *********************************************************************// IPortableDevicePropVariantCollection = interface(IUnknown) ['{89B2E422-4F1B-4316-BCEF-A44AFEA83EB3}'] function GetCount(var pcElems: LongWord): HResult; stdcall; function GetAt(dwIndex: LongWord; var pValue: tag_inner_PROPVARIANT): HResult; stdcall; function Add(var pValue: tag_inner_PROPVARIANT): HResult; stdcall; function GetType(out pvt: Word): HResult; stdcall; function ChangeType(vt: Word): HResult; stdcall; function Clear: HResult; stdcall; function RemoveAt(dwIndex: LongWord): HResult; stdcall; end; // *********************************************************************// // Interface: IPortableDeviceKeyCollection // Flags: (0) // GUID: {DADA2357-E0AD-492E-98DB-DD61C53BA353} // *********************************************************************// IPortableDeviceKeyCollection = interface(IUnknown) ['{DADA2357-E0AD-492E-98DB-DD61C53BA353}'] function GetCount(var pcElems: LongWord): HResult; stdcall; function GetAt(dwIndex: LongWord; var pKey: _WPDtagpropertykey): HResult; stdcall; function Add(var key: _WPDtagpropertykey): HResult; stdcall; function Clear: HResult; stdcall; function RemoveAt(dwIndex: LongWord): HResult; stdcall; end; // *********************************************************************// // Interface: IPortableDeviceValuesCollection // Flags: (0) // GUID: {6E3F2D79-4E07-48C4-8208-D8C2E5AF4A99} // *********************************************************************// IPortableDeviceValuesCollection = interface(IUnknown) ['{6E3F2D79-4E07-48C4-8208-D8C2E5AF4A99}'] function GetCount(var pcElems: LongWord): HResult; stdcall; function GetAt(dwIndex: LongWord; out ppValues: IPortableDeviceValues): HResult; stdcall; function Add(const pValues: IPortableDeviceValues): HResult; stdcall; function Clear: HResult; stdcall; function RemoveAt(dwIndex: LongWord): HResult; stdcall; end; // *********************************************************************// // Interface: IPropertyStore // Flags: (0) // GUID: {886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99} // *********************************************************************// IPropertyStore = interface(IUnknown) ['{886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99}'] function GetCount(out cProps: LongWord): HResult; stdcall; function GetAt(iProp: LongWord; out pKey: _WPDtagpropertykey): HResult; stdcall; function GetValue(var key: _WPDtagpropertykey; out pv: tag_inner_PROPVARIANT): HResult; stdcall; function SetValue(var key: _WPDtagpropertykey; var propvar: tag_inner_PROPVARIANT): HResult; stdcall; function Commit: HResult; stdcall; end; // *********************************************************************// // Interface: IPortableDeviceContent // Flags: (0) // GUID: {6A96ED84-7C73-4480-9938-BF5AF477D426} // *********************************************************************// IPortableDeviceContent = interface(IUnknown) ['{6A96ED84-7C73-4480-9938-BF5AF477D426}'] function EnumObjects(dwFlags: LongWord; pszParentObjectID: PWideChar; const pFilter: IPortableDeviceValues; out ppenum: IEnumPortableDeviceObjectIDs): HResult; stdcall; function Properties(out ppProperties: IPortableDeviceProperties): HResult; stdcall; function Transfer(out ppResources: IPortableDeviceResources): HResult; stdcall; function CreateObjectWithPropertiesOnly(const pValues: IPortableDeviceValues; var ppszObjectID: PWideChar): HResult; stdcall; function CreateObjectWithPropertiesAndData(const pValues: IPortableDeviceValues; out ppData: IStream; var pdwOptimalWriteBufferSize: LongWord; var ppszCookie: PWideChar): HResult; stdcall; function Delete(dwOptions: LongWord; const pObjectIDs: IPortableDevicePropVariantCollection; var ppResults: IPortableDevicePropVariantCollection): HResult; stdcall; function GetObjectIDsFromPersistentUniqueIDs(const pPersistentUniqueIDs: IPortableDevicePropVariantCollection; out ppObjectIDs: IPortableDevicePropVariantCollection): HResult; stdcall; function Cancel: HResult; stdcall; function Move(const pObjectIDs: IPortableDevicePropVariantCollection; pszDestinationFolderObjectID: PWideChar; var ppResults: IPortableDevicePropVariantCollection): HResult; stdcall; function Copy(const pObjectIDs: IPortableDevicePropVariantCollection; pszDestinationFolderObjectID: PWideChar; var ppResults: IPortableDevicePropVariantCollection): HResult; stdcall; end; // *********************************************************************// // Interface: IEnumPortableDeviceObjectIDs // Flags: (0) // GUID: {10ECE955-CF41-4728-BFA0-41EEDF1BBF19} // *********************************************************************// IEnumPortableDeviceObjectIDs = interface(IUnknown) ['{10ECE955-CF41-4728-BFA0-41EEDF1BBF19}'] function Next(cObjects: LongWord; out pObjIDs: PWideChar; var pcFetched: LongWord): HResult; stdcall; function Skip(cObjects: LongWord): HResult; stdcall; function Reset: HResult; stdcall; function Clone(out ppenum: IEnumPortableDeviceObjectIDs): HResult; stdcall; function Cancel: HResult; stdcall; end; // *********************************************************************// // Interface: IPortableDeviceProperties // Flags: (0) // GUID: {7F6D695C-03DF-4439-A809-59266BEEE3A6} // *********************************************************************// IPortableDeviceProperties = interface(IUnknown) ['{7F6D695C-03DF-4439-A809-59266BEEE3A6}'] function GetSupportedProperties(pszObjectID: PWideChar; out ppKeys: IPortableDeviceKeyCollection): HResult; stdcall; function GetPropertyAttributes(pszObjectID: PWideChar; var key: _WPDtagpropertykey; out ppAttributes: IPortableDeviceValues): HResult; stdcall; function GetValues(pszObjectID: PWideChar; const pKeys: IPortableDeviceKeyCollection; out ppValues: IPortableDeviceValues): HResult; stdcall; function SetValues(pszObjectID: PWideChar; const pValues: IPortableDeviceValues; out ppResults: IPortableDeviceValues): HResult; stdcall; function Delete(pszObjectID: PWideChar; const pKeys: IPortableDeviceKeyCollection): HResult; stdcall; function Cancel: HResult; stdcall; end; // *********************************************************************// // Interface: IPortableDeviceResources // Flags: (0) // GUID: {FD8878AC-D841-4D17-891C-E6829CDB6934} // *********************************************************************// IPortableDeviceResources = interface(IUnknown) ['{FD8878AC-D841-4D17-891C-E6829CDB6934}'] function GetSupportedResources(pszObjectID: PWideChar; out ppKeys: IPortableDeviceKeyCollection): HResult; stdcall; function GetResourceAttributes(pszObjectID: PWideChar; var key: _WPDtagpropertykey; out ppResourceAttributes: IPortableDeviceValues): HResult; stdcall; function GetStream(pszObjectID: PWideChar; var key: _WPDtagpropertykey; dwMode: LongWord; var pdwOptimalBufferSize: LongWord; out ppStream: IStream): HResult; stdcall; function Delete(pszObjectID: PWideChar; const pKeys: IPortableDeviceKeyCollection): HResult; stdcall; function Cancel: HResult; stdcall; function CreateResource(const pResourceAttributes: IPortableDeviceValues; out ppData: IStream; var pdwOptimalWriteBufferSize: LongWord; var ppszCookie: PWideChar): HResult; stdcall; end; // *********************************************************************// // Interface: IPortableDeviceCapabilities // Flags: (0) // GUID: {2C8C6DBF-E3DC-4061-BECC-8542E810D126} // *********************************************************************// IPortableDeviceCapabilities = interface(IUnknown) ['{2C8C6DBF-E3DC-4061-BECC-8542E810D126}'] function GetSupportedCommands(out ppCommands: IPortableDeviceKeyCollection): HResult; stdcall; function GetCommandOptions(var Command: _WPDtagpropertykey; out ppOptions: IPortableDeviceValues): HResult; stdcall; function GetFunctionalCategories(out ppCategories: IPortableDevicePropVariantCollection): HResult; stdcall; function GetFunctionalObjects(var Category: TGUID; out ppObjectIDs: IPortableDevicePropVariantCollection): HResult; stdcall; function GetSupportedContentTypes(var Category: TGUID; out ppContentTypes: IPortableDevicePropVariantCollection): HResult; stdcall; function GetSupportedFormats(var ContentType: TGUID; out ppFormats: IPortableDevicePropVariantCollection): HResult; stdcall; function GetSupportedFormatProperties(var Format: TGUID; out ppKeys: IPortableDeviceKeyCollection): HResult; stdcall; function GetFixedPropertyAttributes(var Format: TGUID; var key: _WPDtagpropertykey; out ppAttributes: IPortableDeviceValues): HResult; stdcall; function Cancel: HResult; stdcall; function GetSupportedEvents(out ppEvents: IPortableDevicePropVariantCollection): HResult; stdcall; function GetEventOptions(var Event: TGUID; out ppOptions: IPortableDeviceValues): HResult; stdcall; end; // *********************************************************************// // Interface: IPortableDeviceEventCallback // Flags: (0) // GUID: {A8792A31-F385-493C-A893-40F64EB45F6E} // *********************************************************************// IPortableDeviceEventCallback = interface(IUnknown) ['{A8792A31-F385-493C-A893-40F64EB45F6E}'] function OnEvent(const pEventParameters: IPortableDeviceValues): HResult; stdcall; end; // *********************************************************************// // Interface: IPortableDeviceManager // Flags: (0) // GUID: {A1567595-4C2F-4574-A6FA-ECEF917B9A40} // *********************************************************************// IPortableDeviceManager = interface(IUnknown) ['{A1567595-4C2F-4574-A6FA-ECEF917B9A40}'] function GetDevices(var pPnPDeviceIDs: PWideChar; var pcPnPDeviceIDs: LongWord): HResult; stdcall; function RefreshDeviceList: HResult; stdcall; function GetDeviceFriendlyName(pszPnPDeviceID: PWideChar; var pDeviceFriendlyName: Word; var pcchDeviceFriendlyName: LongWord): HResult; stdcall; function GetDeviceDescription(pszPnPDeviceID: PWideChar; var pDeviceDescription: Word; var pcchDeviceDescription: LongWord): HResult; stdcall; function GetDeviceManufacturer(pszPnPDeviceID: PWideChar; var pDeviceManufacturer: Word; var pcchDeviceManufacturer: LongWord): HResult; stdcall; function GetDeviceProperty(pszPnPDeviceID: PWideChar; pszDevicePropertyName: PWideChar; var pData: Byte; var pcbData: LongWord; var pdwType: LongWord): HResult; stdcall; function GetPrivateDevices(var pPnPDeviceIDs: PWideChar; var pcPnPDeviceIDs: LongWord): HResult; stdcall; end; // *********************************************************************// // Interface: IPortableDeviceService // Flags: (0) // GUID: {D3BD3A44-D7B5-40A9-98B7-2FA4D01DEC08} // *********************************************************************// IPortableDeviceService = interface(IUnknown) ['{D3BD3A44-D7B5-40A9-98B7-2FA4D01DEC08}'] function Open(pszPnPServiceID: PWideChar; const pClientInfo: IPortableDeviceValues): HResult; stdcall; function Capabilities(out ppCapabilities: IPortableDeviceServiceCapabilities): HResult; stdcall; function Content(out ppContent: IPortableDeviceContent2): HResult; stdcall; function Methods(out ppMethods: IPortableDeviceServiceMethods): HResult; stdcall; function Cancel: HResult; stdcall; function Close: HResult; stdcall; function GetServiceObjectID(out ppszServiceObjectID: PWideChar): HResult; stdcall; function GetPnPServiceID(out ppszPnPServiceID: PWideChar): HResult; stdcall; function Advise(dwFlags: LongWord; const pCallback: IPortableDeviceEventCallback; const pParameters: IPortableDeviceValues; out ppszCookie: PWideChar): HResult; stdcall; function Unadvise(pszCookie: PWideChar): HResult; stdcall; function SendCommand(dwFlags: LongWord; const pParameters: IPortableDeviceValues; out ppResults: IPortableDeviceValues): HResult; stdcall; end; // *********************************************************************// // Interface: IPortableDeviceServiceCapabilities // Flags: (0) // GUID: {24DBD89D-413E-43E0-BD5B-197F3C56C886} // *********************************************************************// IPortableDeviceServiceCapabilities = interface(IUnknown) ['{24DBD89D-413E-43E0-BD5B-197F3C56C886}'] function GetSupportedMethods(out ppMethods: IPortableDevicePropVariantCollection): HResult; stdcall; function GetSupportedMethodsByFormat(var Format: TGUID; out ppMethods: IPortableDevicePropVariantCollection): HResult; stdcall; function GetMethodAttributes(var Method: TGUID; out ppAttributes: IPortableDeviceValues): HResult; stdcall; function GetMethodParameterAttributes(var Method: TGUID; var Parameter: _WPDtagpropertykey; out ppAttributes: IPortableDeviceValues): HResult; stdcall; function GetSupportedFormats(out ppFormats: IPortableDevicePropVariantCollection): HResult; stdcall; function GetFormatAttributes(var Format: TGUID; out ppAttributes: IPortableDeviceValues): HResult; stdcall; function GetSupportedFormatProperties(var Format: TGUID; out ppKeys: IPortableDeviceKeyCollection): HResult; stdcall; function GetFormatPropertyAttributes(var Format: TGUID; var Property_: _WPDtagpropertykey; out ppAttributes: IPortableDeviceValues): HResult; stdcall; function GetSupportedEvents(out ppEvents: IPortableDevicePropVariantCollection): HResult; stdcall; function GetEventAttributes(var Event: TGUID; out ppAttributes: IPortableDeviceValues): HResult; stdcall; function GetEventParameterAttributes(var Event: TGUID; var Parameter: _WPDtagpropertykey; out ppAttributes: IPortableDeviceValues): HResult; stdcall; function GetInheritedServices(dwInheritanceType: LongWord; out ppServices: IPortableDevicePropVariantCollection): HResult; stdcall; function GetFormatRenderingProfiles(var Format: TGUID; out ppRenderingProfiles: IPortableDeviceValuesCollection): HResult; stdcall; function GetSupportedCommands(out ppCommands: IPortableDeviceKeyCollection): HResult; stdcall; function GetCommandOptions(var Command: _WPDtagpropertykey; out ppOptions: IPortableDeviceValues): HResult; stdcall; function Cancel: HResult; stdcall; end; // *********************************************************************// // Interface: IPortableDeviceContent2 // Flags: (0) // GUID: {9B4ADD96-F6BF-4034-8708-ECA72BF10554} // *********************************************************************// IPortableDeviceContent2 = interface(IPortableDeviceContent) ['{9B4ADD96-F6BF-4034-8708-ECA72BF10554}'] function UpdateObjectWithPropertiesAndData(pszObjectID: PWideChar; const pProperties: IPortableDeviceValues; out ppData: IStream; var pdwOptimalWriteBufferSize: LongWord): HResult; stdcall; end; // *********************************************************************// // Interface: IPortableDeviceServiceMethods // Flags: (0) // GUID: {E20333C9-FD34-412D-A381-CC6F2D820DF7} // *********************************************************************// IPortableDeviceServiceMethods = interface(IUnknown) ['{E20333C9-FD34-412D-A381-CC6F2D820DF7}'] function Invoke(var Method: TGUID; const pParameters: IPortableDeviceValues; var ppResults: IPortableDeviceValues): HResult; stdcall; function InvokeAsync(var Method: TGUID; const pParameters: IPortableDeviceValues; const pCallback: IPortableDeviceServiceMethodCallback): HResult; stdcall; function Cancel(const pCallback: IPortableDeviceServiceMethodCallback): HResult; stdcall; end; // *********************************************************************// // Interface: IPortableDeviceServiceMethodCallback // Flags: (0) // GUID: {C424233C-AFCE-4828-A756-7ED7A2350083} // *********************************************************************// IPortableDeviceServiceMethodCallback = interface(IUnknown) ['{C424233C-AFCE-4828-A756-7ED7A2350083}'] function OnComplete(hrStatus: HResult; const pResults: IPortableDeviceValues): HResult; stdcall; end; // *********************************************************************// // Interface: IPortableDeviceDispatchFactory // Flags: (0) // GUID: {5E1EAFC3-E3D7-4132-96FA-759C0F9D1E0F} // *********************************************************************// IPortableDeviceDispatchFactory = interface(IUnknown) ['{5E1EAFC3-E3D7-4132-96FA-759C0F9D1E0F}'] function GetDeviceDispatch(pszPnPDeviceID: PWideChar; out ppDeviceDispatch: IDispatch): HResult; stdcall; end; // *********************************************************************// // The Class CoPortableDevice provides a Create and CreateRemote method to // create instances of the default interface IPortableDevice exposed by // the CoClass PortableDevice. The functions are intended to be used by // clients wishing to automate the CoClass objects exposed by the // server of this typelibrary. // *********************************************************************// CoPortableDevice = class class function Create: IPortableDevice; class function CreateRemote(const MachineName: string): IPortableDevice; end; // *********************************************************************// // OLE Server Proxy class declaration // Server Object : TPortableDevice // Help String : PortableDevice Class // Default Interface: IPortableDevice // Def. Intf. DISP? : No // Event Interface: // TypeFlags : (2) CanCreate // *********************************************************************// {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} TPortableDeviceProperties= class; {$ENDIF} TPortableDevice = class(TOleServer) private FIntf: IPortableDevice; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps: TPortableDeviceProperties; function GetServerProperties: TPortableDeviceProperties; {$ENDIF} function GetDefaultInterface: IPortableDevice; protected procedure InitServerData; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Connect; override; procedure ConnectTo(svrIntf: IPortableDevice); procedure Disconnect; override; function Open(pszPnPDeviceID: PWideChar; const pClientInfo: IPortableDeviceValues): HResult; function SendCommand(dwFlags: LongWord; const pParameters: IPortableDeviceValues; out ppResults: IPortableDeviceValues): HResult; function Content(out ppContent: IPortableDeviceContent): HResult; function Capabilities(out ppCapabilities: IPortableDeviceCapabilities): HResult; function Cancel: HResult; function Close: HResult; function Advise(dwFlags: LongWord; const pCallback: IPortableDeviceEventCallback; const pParameters: IPortableDeviceValues; out ppszCookie: PWideChar): HResult; function Unadvise(pszCookie: PWideChar): HResult; function GetPnPDeviceID(out ppszPnPDeviceID: PWideChar): HResult; property DefaultInterface: IPortableDevice read GetDefaultInterface; published {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} property Server: TPortableDeviceProperties read GetServerProperties; {$ENDIF} end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} // *********************************************************************// // OLE Server Properties Proxy Class // Server Object : TPortableDevice // (This object is used by the IDE's Property Inspector to allow editing // of the properties of this server) // *********************************************************************// TPortableDeviceProperties = class(TPersistent) private FServer: TPortableDevice; function GetDefaultInterface: IPortableDevice; constructor Create(AServer: TPortableDevice); protected public property DefaultInterface: IPortableDevice read GetDefaultInterface; published end; {$ENDIF} // *********************************************************************// // The Class CoPortableDeviceManager provides a Create and CreateRemote method to // create instances of the default interface IPortableDeviceManager exposed by // the CoClass PortableDeviceManager. The functions are intended to be used by // clients wishing to automate the CoClass objects exposed by the // server of this typelibrary. // *********************************************************************// CoPortableDeviceManager = class class function Create: IPortableDeviceManager; class function CreateRemote(const MachineName: string): IPortableDeviceManager; end; // *********************************************************************// // OLE Server Proxy class declaration // Server Object : TPortableDeviceManager // Help String : PortableDeviceManager Class // Default Interface: IPortableDeviceManager // Def. Intf. DISP? : No // Event Interface: // TypeFlags : (2) CanCreate // *********************************************************************// {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} TPortableDeviceManagerProperties= class; {$ENDIF} TPortableDeviceManager = class(TOleServer) private FIntf: IPortableDeviceManager; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps: TPortableDeviceManagerProperties; function GetServerProperties: TPortableDeviceManagerProperties; {$ENDIF} function GetDefaultInterface: IPortableDeviceManager; protected procedure InitServerData; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Connect; override; procedure ConnectTo(svrIntf: IPortableDeviceManager); procedure Disconnect; override; function GetDevices(var pPnPDeviceIDs: PWideChar; var pcPnPDeviceIDs: LongWord): HResult; function RefreshDeviceList: HResult; function GetDeviceFriendlyName(pszPnPDeviceID: PWideChar; var pDeviceFriendlyName: Word; var pcchDeviceFriendlyName: LongWord): HResult; function GetDeviceDescription(pszPnPDeviceID: PWideChar; var pDeviceDescription: Word; var pcchDeviceDescription: LongWord): HResult; function GetDeviceManufacturer(pszPnPDeviceID: PWideChar; var pDeviceManufacturer: Word; var pcchDeviceManufacturer: LongWord): HResult; function GetDeviceProperty(pszPnPDeviceID: PWideChar; pszDevicePropertyName: PWideChar; var pData: Byte; var pcbData: LongWord; var pdwType: LongWord): HResult; function GetPrivateDevices(var pPnPDeviceIDs: PWideChar; var pcPnPDeviceIDs: LongWord): HResult; property DefaultInterface: IPortableDeviceManager read GetDefaultInterface; published {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} property Server: TPortableDeviceManagerProperties read GetServerProperties; {$ENDIF} end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} // *********************************************************************// // OLE Server Properties Proxy Class // Server Object : TPortableDeviceManager // (This object is used by the IDE's Property Inspector to allow editing // of the properties of this server) // *********************************************************************// TPortableDeviceManagerProperties = class(TPersistent) private FServer: TPortableDeviceManager; function GetDefaultInterface: IPortableDeviceManager; constructor Create(AServer: TPortableDeviceManager); protected public property DefaultInterface: IPortableDeviceManager read GetDefaultInterface; published end; {$ENDIF} // *********************************************************************// // The Class CoPortableDeviceService provides a Create and CreateRemote method to // create instances of the default interface IPortableDeviceService exposed by // the CoClass PortableDeviceService. The functions are intended to be used by // clients wishing to automate the CoClass objects exposed by the // server of this typelibrary. // *********************************************************************// CoPortableDeviceService = class class function Create: IPortableDeviceService; class function CreateRemote(const MachineName: string): IPortableDeviceService; end; // *********************************************************************// // OLE Server Proxy class declaration // Server Object : TPortableDeviceService // Help String : PortableDeviceService Class // Default Interface: IPortableDeviceService // Def. Intf. DISP? : No // Event Interface: // TypeFlags : (2) CanCreate // *********************************************************************// {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} TPortableDeviceServiceProperties= class; {$ENDIF} TPortableDeviceService = class(TOleServer) private FIntf: IPortableDeviceService; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps: TPortableDeviceServiceProperties; function GetServerProperties: TPortableDeviceServiceProperties; {$ENDIF} function GetDefaultInterface: IPortableDeviceService; protected procedure InitServerData; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Connect; override; procedure ConnectTo(svrIntf: IPortableDeviceService); procedure Disconnect; override; function Open(pszPnPServiceID: PWideChar; const pClientInfo: IPortableDeviceValues): HResult; function Capabilities(out ppCapabilities: IPortableDeviceServiceCapabilities): HResult; function Content(out ppContent: IPortableDeviceContent2): HResult; function Methods(out ppMethods: IPortableDeviceServiceMethods): HResult; function Cancel: HResult; function Close: HResult; function GetServiceObjectID(out ppszServiceObjectID: PWideChar): HResult; function GetPnPServiceID(out ppszPnPServiceID: PWideChar): HResult; function Advise(dwFlags: LongWord; const pCallback: IPortableDeviceEventCallback; const pParameters: IPortableDeviceValues; out ppszCookie: PWideChar): HResult; function Unadvise(pszCookie: PWideChar): HResult; function SendCommand(dwFlags: LongWord; const pParameters: IPortableDeviceValues; out ppResults: IPortableDeviceValues): HResult; property DefaultInterface: IPortableDeviceService read GetDefaultInterface; published {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} property Server: TPortableDeviceServiceProperties read GetServerProperties; {$ENDIF} end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} // *********************************************************************// // OLE Server Properties Proxy Class // Server Object : TPortableDeviceService // (This object is used by the IDE's Property Inspector to allow editing // of the properties of this server) // *********************************************************************// TPortableDeviceServiceProperties = class(TPersistent) private FServer: TPortableDeviceService; function GetDefaultInterface: IPortableDeviceService; constructor Create(AServer: TPortableDeviceService); protected public property DefaultInterface: IPortableDeviceService read GetDefaultInterface; published end; {$ENDIF} // *********************************************************************// // The Class CoPortableDeviceDispatchFactory provides a Create and CreateRemote method to // create instances of the default interface IPortableDeviceDispatchFactory exposed by // the CoClass PortableDeviceDispatchFactory. The functions are intended to be used by // clients wishing to automate the CoClass objects exposed by the // server of this typelibrary. // *********************************************************************// CoPortableDeviceDispatchFactory = class class function Create: IPortableDeviceDispatchFactory; class function CreateRemote(const MachineName: string): IPortableDeviceDispatchFactory; end; // *********************************************************************// // OLE Server Proxy class declaration // Server Object : TPortableDeviceDispatchFactory // Help String : PortableDeviceDispatchFactory Class // Default Interface: IPortableDeviceDispatchFactory // Def. Intf. DISP? : No // Event Interface: // TypeFlags : (2) CanCreate // *********************************************************************// {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} TPortableDeviceDispatchFactoryProperties= class; {$ENDIF} TPortableDeviceDispatchFactory = class(TOleServer) private FIntf: IPortableDeviceDispatchFactory; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps: TPortableDeviceDispatchFactoryProperties; function GetServerProperties: TPortableDeviceDispatchFactoryProperties; {$ENDIF} function GetDefaultInterface: IPortableDeviceDispatchFactory; protected procedure InitServerData; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Connect; override; procedure ConnectTo(svrIntf: IPortableDeviceDispatchFactory); procedure Disconnect; override; function GetDeviceDispatch(pszPnPDeviceID: PWideChar; out ppDeviceDispatch: IDispatch): HResult; property DefaultInterface: IPortableDeviceDispatchFactory read GetDefaultInterface; published {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} property Server: TPortableDeviceDispatchFactoryProperties read GetServerProperties; {$ENDIF} end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} // *********************************************************************// // OLE Server Properties Proxy Class // Server Object : TPortableDeviceDispatchFactory // (This object is used by the IDE's Property Inspector to allow editing // of the properties of this server) // *********************************************************************// TPortableDeviceDispatchFactoryProperties = class(TPersistent) private FServer: TPortableDeviceDispatchFactory; function GetDefaultInterface: IPortableDeviceDispatchFactory; constructor Create(AServer: TPortableDeviceDispatchFactory); protected public property DefaultInterface: IPortableDeviceDispatchFactory read GetDefaultInterface; published end; {$ENDIF} // *********************************************************************// // The Class CoPortableDeviceFTM provides a Create and CreateRemote method to // create instances of the default interface IPortableDevice exposed by // the CoClass PortableDeviceFTM. The functions are intended to be used by // clients wishing to automate the CoClass objects exposed by the // server of this typelibrary. // *********************************************************************// CoPortableDeviceFTM = class class function Create: IPortableDevice; class function CreateRemote(const MachineName: string): IPortableDevice; end; // *********************************************************************// // OLE Server Proxy class declaration // Server Object : TPortableDeviceFTM // Help String : PortableDeviceFTM Class // Default Interface: IPortableDevice // Def. Intf. DISP? : No // Event Interface: // TypeFlags : (2) CanCreate // *********************************************************************// {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} TPortableDeviceFTMProperties= class; {$ENDIF} TPortableDeviceFTM = class(TOleServer) private FIntf: IPortableDevice; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps: TPortableDeviceFTMProperties; function GetServerProperties: TPortableDeviceFTMProperties; {$ENDIF} function GetDefaultInterface: IPortableDevice; protected procedure InitServerData; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Connect; override; procedure ConnectTo(svrIntf: IPortableDevice); procedure Disconnect; override; function Open(pszPnPDeviceID: PWideChar; const pClientInfo: IPortableDeviceValues): HResult; function SendCommand(dwFlags: LongWord; const pParameters: IPortableDeviceValues; out ppResults: IPortableDeviceValues): HResult; function Content(out ppContent: IPortableDeviceContent): HResult; function Capabilities(out ppCapabilities: IPortableDeviceCapabilities): HResult; function Cancel: HResult; function Close: HResult; function Advise(dwFlags: LongWord; const pCallback: IPortableDeviceEventCallback; const pParameters: IPortableDeviceValues; out ppszCookie: PWideChar): HResult; function Unadvise(pszCookie: PWideChar): HResult; function GetPnPDeviceID(out ppszPnPDeviceID: PWideChar): HResult; property DefaultInterface: IPortableDevice read GetDefaultInterface; published {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} property Server: TPortableDeviceFTMProperties read GetServerProperties; {$ENDIF} end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} // *********************************************************************// // OLE Server Properties Proxy Class // Server Object : TPortableDeviceFTM // (This object is used by the IDE's Property Inspector to allow editing // of the properties of this server) // *********************************************************************// TPortableDeviceFTMProperties = class(TPersistent) private FServer: TPortableDeviceFTM; function GetDefaultInterface: IPortableDevice; constructor Create(AServer: TPortableDeviceFTM); protected public property DefaultInterface: IPortableDevice read GetDefaultInterface; published end; {$ENDIF} // *********************************************************************// // The Class CoPortableDeviceServiceFTM provides a Create and CreateRemote method to // create instances of the default interface IPortableDeviceService exposed by // the CoClass PortableDeviceServiceFTM. The functions are intended to be used by // clients wishing to automate the CoClass objects exposed by the // server of this typelibrary. // *********************************************************************// CoPortableDeviceServiceFTM = class class function Create: IPortableDeviceService; class function CreateRemote(const MachineName: string): IPortableDeviceService; end; // *********************************************************************// // OLE Server Proxy class declaration // Server Object : TPortableDeviceServiceFTM // Help String : PortableDeviceServiceFTM Class // Default Interface: IPortableDeviceService // Def. Intf. DISP? : No // Event Interface: // TypeFlags : (2) CanCreate // *********************************************************************// {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} TPortableDeviceServiceFTMProperties= class; {$ENDIF} TPortableDeviceServiceFTM = class(TOleServer) private FIntf: IPortableDeviceService; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps: TPortableDeviceServiceFTMProperties; function GetServerProperties: TPortableDeviceServiceFTMProperties; {$ENDIF} function GetDefaultInterface: IPortableDeviceService; protected procedure InitServerData; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Connect; override; procedure ConnectTo(svrIntf: IPortableDeviceService); procedure Disconnect; override; function Open(pszPnPServiceID: PWideChar; const pClientInfo: IPortableDeviceValues): HResult; function Capabilities(out ppCapabilities: IPortableDeviceServiceCapabilities): HResult; function Content(out ppContent: IPortableDeviceContent2): HResult; function Methods(out ppMethods: IPortableDeviceServiceMethods): HResult; function Cancel: HResult; function Close: HResult; function GetServiceObjectID(out ppszServiceObjectID: PWideChar): HResult; function GetPnPServiceID(out ppszPnPServiceID: PWideChar): HResult; function Advise(dwFlags: LongWord; const pCallback: IPortableDeviceEventCallback; const pParameters: IPortableDeviceValues; out ppszCookie: PWideChar): HResult; function Unadvise(pszCookie: PWideChar): HResult; function SendCommand(dwFlags: LongWord; const pParameters: IPortableDeviceValues; out ppResults: IPortableDeviceValues): HResult; property DefaultInterface: IPortableDeviceService read GetDefaultInterface; published {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} property Server: TPortableDeviceServiceFTMProperties read GetServerProperties; {$ENDIF} end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} // *********************************************************************// // OLE Server Properties Proxy Class // Server Object : TPortableDeviceServiceFTM // (This object is used by the IDE's Property Inspector to allow editing // of the properties of this server) // *********************************************************************// TPortableDeviceServiceFTMProperties = class(TPersistent) private FServer: TPortableDeviceServiceFTM; function GetDefaultInterface: IPortableDeviceService; constructor Create(AServer: TPortableDeviceServiceFTM); protected public property DefaultInterface: IPortableDeviceService read GetDefaultInterface; published end; {$ENDIF} resourcestring dtlServerPage = '(none)'; dtlOcxPage = '(none)'; class function CoPortableDevice.Create: IPortableDevice; begin Result := CreateComObject(CLASS_PortableDevice) as IPortableDevice; end; class function CoPortableDevice.CreateRemote(const MachineName: string): IPortableDevice; begin Result := CreateRemoteComObject(MachineName, CLASS_PortableDevice) as IPortableDevice; end; procedure TPortableDevice.InitServerData; const CServerData: TServerData = ( ClassID: '{728A21C5-3D9E-48D7-9810-864848F0F404}'; IntfIID: '{625E2DF8-6392-4CF0-9AD1-3CFA5F17775C}'; EventIID: ''; LicenseKey: nil; Version: 500); begin ServerData := @CServerData; end; procedure TPortableDevice.Connect; var punk: IUnknown; begin if FIntf = nil then begin punk := GetServer; Fintf:= punk as IPortableDevice; end; end; procedure TPortableDevice.ConnectTo(svrIntf: IPortableDevice); begin Disconnect; FIntf := svrIntf; end; procedure TPortableDevice.DisConnect; begin if Fintf <> nil then begin FIntf := nil; end; end; function TPortableDevice.GetDefaultInterface: IPortableDevice; begin if FIntf = nil then Connect; Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call "Connect" or "ConnectTo" before this operation'); Result := FIntf; end; constructor TPortableDevice.Create(AOwner: TComponent); begin inherited Create(AOwner); {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps := TPortableDeviceProperties.Create(Self); {$ENDIF} end; destructor TPortableDevice.Destroy; begin {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps.Free; {$ENDIF} inherited Destroy; end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} function TPortableDevice.GetServerProperties: TPortableDeviceProperties; begin Result := FProps; end; {$ENDIF} function TPortableDevice.Open(pszPnPDeviceID: PWideChar; const pClientInfo: IPortableDeviceValues): HResult; begin Result := DefaultInterface.Open(pszPnPDeviceID, pClientInfo); end; function TPortableDevice.SendCommand(dwFlags: LongWord; const pParameters: IPortableDeviceValues; out ppResults: IPortableDeviceValues): HResult; begin Result := DefaultInterface.SendCommand(dwFlags, pParameters, ppResults); end; function TPortableDevice.Content(out ppContent: IPortableDeviceContent): HResult; begin Result := DefaultInterface.Content(ppContent); end; function TPortableDevice.Capabilities(out ppCapabilities: IPortableDeviceCapabilities): HResult; begin Result := DefaultInterface.Capabilities(ppCapabilities); end; function TPortableDevice.Cancel: HResult; begin Result := DefaultInterface.Cancel; end; function TPortableDevice.Close: HResult; begin Result := DefaultInterface.Close; end; function TPortableDevice.Advise(dwFlags: LongWord; const pCallback: IPortableDeviceEventCallback; const pParameters: IPortableDeviceValues; out ppszCookie: PWideChar): HResult; begin Result := DefaultInterface.Advise(dwFlags, pCallback, pParameters, ppszCookie); end; function TPortableDevice.Unadvise(pszCookie: PWideChar): HResult; begin Result := DefaultInterface.Unadvise(pszCookie); end; function TPortableDevice.GetPnPDeviceID(out ppszPnPDeviceID: PWideChar): HResult; begin Result := DefaultInterface.GetPnPDeviceID(ppszPnPDeviceID); end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} constructor TPortableDeviceProperties.Create(AServer: TPortableDevice); begin inherited Create; FServer := AServer; end; function TPortableDeviceProperties.GetDefaultInterface: IPortableDevice; begin Result := FServer.DefaultInterface; end; {$ENDIF} class function CoPortableDeviceManager.Create: IPortableDeviceManager; begin Result := CreateComObject(CLASS_PortableDeviceManager) as IPortableDeviceManager; end; class function CoPortableDeviceManager.CreateRemote(const MachineName: string): IPortableDeviceManager; begin Result := CreateRemoteComObject(MachineName, CLASS_PortableDeviceManager) as IPortableDeviceManager; end; procedure TPortableDeviceManager.InitServerData; const CServerData: TServerData = ( ClassID: '{0AF10CEC-2ECD-4B92-9581-34F6AE0637F3}'; IntfIID: '{A1567595-4C2F-4574-A6FA-ECEF917B9A40}'; EventIID: ''; LicenseKey: nil; Version: 500); begin ServerData := @CServerData; end; procedure TPortableDeviceManager.Connect; var punk: IUnknown; begin if FIntf = nil then begin punk := GetServer; Fintf:= punk as IPortableDeviceManager; end; end; procedure TPortableDeviceManager.ConnectTo(svrIntf: IPortableDeviceManager); begin Disconnect; FIntf := svrIntf; end; procedure TPortableDeviceManager.DisConnect; begin if Fintf <> nil then begin FIntf := nil; end; end; function TPortableDeviceManager.GetDefaultInterface: IPortableDeviceManager; begin if FIntf = nil then Connect; Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call "Connect" or "ConnectTo" before this operation'); Result := FIntf; end; constructor TPortableDeviceManager.Create(AOwner: TComponent); begin inherited Create(AOwner); {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps := TPortableDeviceManagerProperties.Create(Self); {$ENDIF} end; destructor TPortableDeviceManager.Destroy; begin {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps.Free; {$ENDIF} inherited Destroy; end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} function TPortableDeviceManager.GetServerProperties: TPortableDeviceManagerProperties; begin Result := FProps; end; {$ENDIF} function TPortableDeviceManager.GetDevices(var pPnPDeviceIDs: PWideChar; var pcPnPDeviceIDs: LongWord): HResult; begin Result := DefaultInterface.GetDevices(pPnPDeviceIDs, pcPnPDeviceIDs); end; function TPortableDeviceManager.RefreshDeviceList: HResult; begin Result := DefaultInterface.RefreshDeviceList; end; function TPortableDeviceManager.GetDeviceFriendlyName(pszPnPDeviceID: PWideChar; var pDeviceFriendlyName: Word; var pcchDeviceFriendlyName: LongWord): HResult; begin Result := DefaultInterface.GetDeviceFriendlyName(pszPnPDeviceID, pDeviceFriendlyName, pcchDeviceFriendlyName); end; function TPortableDeviceManager.GetDeviceDescription(pszPnPDeviceID: PWideChar; var pDeviceDescription: Word; var pcchDeviceDescription: LongWord): HResult; begin Result := DefaultInterface.GetDeviceDescription(pszPnPDeviceID, pDeviceDescription, pcchDeviceDescription); end; function TPortableDeviceManager.GetDeviceManufacturer(pszPnPDeviceID: PWideChar; var pDeviceManufacturer: Word; var pcchDeviceManufacturer: LongWord): HResult; begin Result := DefaultInterface.GetDeviceManufacturer(pszPnPDeviceID, pDeviceManufacturer, pcchDeviceManufacturer); end; function TPortableDeviceManager.GetDeviceProperty(pszPnPDeviceID: PWideChar; pszDevicePropertyName: PWideChar; var pData: Byte; var pcbData: LongWord; var pdwType: LongWord): HResult; begin Result := DefaultInterface.GetDeviceProperty(pszPnPDeviceID, pszDevicePropertyName, pData, pcbData, pdwType); end; function TPortableDeviceManager.GetPrivateDevices(var pPnPDeviceIDs: PWideChar; var pcPnPDeviceIDs: LongWord): HResult; begin Result := DefaultInterface.GetPrivateDevices(pPnPDeviceIDs, pcPnPDeviceIDs); end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} constructor TPortableDeviceManagerProperties.Create(AServer: TPortableDeviceManager); begin inherited Create; FServer := AServer; end; function TPortableDeviceManagerProperties.GetDefaultInterface: IPortableDeviceManager; begin Result := FServer.DefaultInterface; end; {$ENDIF} class function CoPortableDeviceService.Create: IPortableDeviceService; begin Result := CreateComObject(CLASS_PortableDeviceService) as IPortableDeviceService; end; class function CoPortableDeviceService.CreateRemote(const MachineName: string): IPortableDeviceService; begin Result := CreateRemoteComObject(MachineName, CLASS_PortableDeviceService) as IPortableDeviceService; end; procedure TPortableDeviceService.InitServerData; const CServerData: TServerData = ( ClassID: '{EF5DB4C2-9312-422C-9152-411CD9C4DD84}'; IntfIID: '{D3BD3A44-D7B5-40A9-98B7-2FA4D01DEC08}'; EventIID: ''; LicenseKey: nil; Version: 500); begin ServerData := @CServerData; end; procedure TPortableDeviceService.Connect; var punk: IUnknown; begin if FIntf = nil then begin punk := GetServer; Fintf:= punk as IPortableDeviceService; end; end; procedure TPortableDeviceService.ConnectTo(svrIntf: IPortableDeviceService); begin Disconnect; FIntf := svrIntf; end; procedure TPortableDeviceService.DisConnect; begin if Fintf <> nil then begin FIntf := nil; end; end; function TPortableDeviceService.GetDefaultInterface: IPortableDeviceService; begin if FIntf = nil then Connect; Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call "Connect" or "ConnectTo" before this operation'); Result := FIntf; end; constructor TPortableDeviceService.Create(AOwner: TComponent); begin inherited Create(AOwner); {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps := TPortableDeviceServiceProperties.Create(Self); {$ENDIF} end; destructor TPortableDeviceService.Destroy; begin {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps.Free; {$ENDIF} inherited Destroy; end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} function TPortableDeviceService.GetServerProperties: TPortableDeviceServiceProperties; begin Result := FProps; end; {$ENDIF} function TPortableDeviceService.Open(pszPnPServiceID: PWideChar; const pClientInfo: IPortableDeviceValues): HResult; begin Result := DefaultInterface.Open(pszPnPServiceID, pClientInfo); end; function TPortableDeviceService.Capabilities(out ppCapabilities: IPortableDeviceServiceCapabilities): HResult; begin Result := DefaultInterface.Capabilities(ppCapabilities); end; function TPortableDeviceService.Content(out ppContent: IPortableDeviceContent2): HResult; begin Result := DefaultInterface.Content(ppContent); end; function TPortableDeviceService.Methods(out ppMethods: IPortableDeviceServiceMethods): HResult; begin Result := DefaultInterface.Methods(ppMethods); end; function TPortableDeviceService.Cancel: HResult; begin Result := DefaultInterface.Cancel; end; function TPortableDeviceService.Close: HResult; begin Result := DefaultInterface.Close; end; function TPortableDeviceService.GetServiceObjectID(out ppszServiceObjectID: PWideChar): HResult; begin Result := DefaultInterface.GetServiceObjectID(ppszServiceObjectID); end; function TPortableDeviceService.GetPnPServiceID(out ppszPnPServiceID: PWideChar): HResult; begin Result := DefaultInterface.GetPnPServiceID(ppszPnPServiceID); end; function TPortableDeviceService.Advise(dwFlags: LongWord; const pCallback: IPortableDeviceEventCallback; const pParameters: IPortableDeviceValues; out ppszCookie: PWideChar): HResult; begin Result := DefaultInterface.Advise(dwFlags, pCallback, pParameters, ppszCookie); end; function TPortableDeviceService.Unadvise(pszCookie: PWideChar): HResult; begin Result := DefaultInterface.Unadvise(pszCookie); end; function TPortableDeviceService.SendCommand(dwFlags: LongWord; const pParameters: IPortableDeviceValues; out ppResults: IPortableDeviceValues): HResult; begin Result := DefaultInterface.SendCommand(dwFlags, pParameters, ppResults); end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} constructor TPortableDeviceServiceProperties.Create(AServer: TPortableDeviceService); begin inherited Create; FServer := AServer; end; function TPortableDeviceServiceProperties.GetDefaultInterface: IPortableDeviceService; begin Result := FServer.DefaultInterface; end; {$ENDIF} class function CoPortableDeviceDispatchFactory.Create: IPortableDeviceDispatchFactory; begin Result := CreateComObject(CLASS_PortableDeviceDispatchFactory) as IPortableDeviceDispatchFactory; end; class function CoPortableDeviceDispatchFactory.CreateRemote(const MachineName: string): IPortableDeviceDispatchFactory; begin Result := CreateRemoteComObject(MachineName, CLASS_PortableDeviceDispatchFactory) as IPortableDeviceDispatchFactory; end; procedure TPortableDeviceDispatchFactory.InitServerData; const CServerData: TServerData = ( ClassID: '{43232233-8338-4658-AE01-0B4AE830B6B0}'; IntfIID: '{5E1EAFC3-E3D7-4132-96FA-759C0F9D1E0F}'; EventIID: ''; LicenseKey: nil; Version: 500); begin ServerData := @CServerData; end; procedure TPortableDeviceDispatchFactory.Connect; var punk: IUnknown; begin if FIntf = nil then begin punk := GetServer; Fintf:= punk as IPortableDeviceDispatchFactory; end; end; procedure TPortableDeviceDispatchFactory.ConnectTo(svrIntf: IPortableDeviceDispatchFactory); begin Disconnect; FIntf := svrIntf; end; procedure TPortableDeviceDispatchFactory.DisConnect; begin if Fintf <> nil then begin FIntf := nil; end; end; function TPortableDeviceDispatchFactory.GetDefaultInterface: IPortableDeviceDispatchFactory; begin if FIntf = nil then Connect; Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call "Connect" or "ConnectTo" before this operation'); Result := FIntf; end; constructor TPortableDeviceDispatchFactory.Create(AOwner: TComponent); begin inherited Create(AOwner); {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps := TPortableDeviceDispatchFactoryProperties.Create(Self); {$ENDIF} end; destructor TPortableDeviceDispatchFactory.Destroy; begin {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps.Free; {$ENDIF} inherited Destroy; end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} function TPortableDeviceDispatchFactory.GetServerProperties: TPortableDeviceDispatchFactoryProperties; begin Result := FProps; end; {$ENDIF} function TPortableDeviceDispatchFactory.GetDeviceDispatch(pszPnPDeviceID: PWideChar; out ppDeviceDispatch: IDispatch): HResult; begin Result := DefaultInterface.GetDeviceDispatch(pszPnPDeviceID, ppDeviceDispatch); end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} constructor TPortableDeviceDispatchFactoryProperties.Create(AServer: TPortableDeviceDispatchFactory); begin inherited Create; FServer := AServer; end; function TPortableDeviceDispatchFactoryProperties.GetDefaultInterface: IPortableDeviceDispatchFactory; begin Result := FServer.DefaultInterface; end; {$ENDIF} class function CoPortableDeviceFTM.Create: IPortableDevice; begin Result := CreateComObject(CLASS_PortableDeviceFTM) as IPortableDevice; end; class function CoPortableDeviceFTM.CreateRemote(const MachineName: string): IPortableDevice; begin Result := CreateRemoteComObject(MachineName, CLASS_PortableDeviceFTM) as IPortableDevice; end; procedure TPortableDeviceFTM.InitServerData; const CServerData: TServerData = ( ClassID: '{F7C0039A-4762-488A-B4B3-760EF9A1BA9B}'; IntfIID: '{625E2DF8-6392-4CF0-9AD1-3CFA5F17775C}'; EventIID: ''; LicenseKey: nil; Version: 500); begin ServerData := @CServerData; end; procedure TPortableDeviceFTM.Connect; var punk: IUnknown; begin if FIntf = nil then begin punk := GetServer; Fintf:= punk as IPortableDevice; end; end; procedure TPortableDeviceFTM.ConnectTo(svrIntf: IPortableDevice); begin Disconnect; FIntf := svrIntf; end; procedure TPortableDeviceFTM.DisConnect; begin if Fintf <> nil then begin FIntf := nil; end; end; function TPortableDeviceFTM.GetDefaultInterface: IPortableDevice; begin if FIntf = nil then Connect; Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call "Connect" or "ConnectTo" before this operation'); Result := FIntf; end; constructor TPortableDeviceFTM.Create(AOwner: TComponent); begin inherited Create(AOwner); {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps := TPortableDeviceFTMProperties.Create(Self); {$ENDIF} end; destructor TPortableDeviceFTM.Destroy; begin {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps.Free; {$ENDIF} inherited Destroy; end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} function TPortableDeviceFTM.GetServerProperties: TPortableDeviceFTMProperties; begin Result := FProps; end; {$ENDIF} function TPortableDeviceFTM.Open(pszPnPDeviceID: PWideChar; const pClientInfo: IPortableDeviceValues): HResult; begin Result := DefaultInterface.Open(pszPnPDeviceID, pClientInfo); end; function TPortableDeviceFTM.SendCommand(dwFlags: LongWord; const pParameters: IPortableDeviceValues; out ppResults: IPortableDeviceValues): HResult; begin Result := DefaultInterface.SendCommand(dwFlags, pParameters, ppResults); end; function TPortableDeviceFTM.Content(out ppContent: IPortableDeviceContent): HResult; begin Result := DefaultInterface.Content(ppContent); end; function TPortableDeviceFTM.Capabilities(out ppCapabilities: IPortableDeviceCapabilities): HResult; begin Result := DefaultInterface.Capabilities(ppCapabilities); end; function TPortableDeviceFTM.Cancel: HResult; begin Result := DefaultInterface.Cancel; end; function TPortableDeviceFTM.Close: HResult; begin Result := DefaultInterface.Close; end; function TPortableDeviceFTM.Advise(dwFlags: LongWord; const pCallback: IPortableDeviceEventCallback; const pParameters: IPortableDeviceValues; out ppszCookie: PWideChar): HResult; begin Result := DefaultInterface.Advise(dwFlags, pCallback, pParameters, ppszCookie); end; function TPortableDeviceFTM.Unadvise(pszCookie: PWideChar): HResult; begin Result := DefaultInterface.Unadvise(pszCookie); end; function TPortableDeviceFTM.GetPnPDeviceID(out ppszPnPDeviceID: PWideChar): HResult; begin Result := DefaultInterface.GetPnPDeviceID(ppszPnPDeviceID); end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} constructor TPortableDeviceFTMProperties.Create(AServer: TPortableDeviceFTM); begin inherited Create; FServer := AServer; end; function TPortableDeviceFTMProperties.GetDefaultInterface: IPortableDevice; begin Result := FServer.DefaultInterface; end; {$ENDIF} class function CoPortableDeviceServiceFTM.Create: IPortableDeviceService; begin Result := CreateComObject(CLASS_PortableDeviceServiceFTM) as IPortableDeviceService; end; class function CoPortableDeviceServiceFTM.CreateRemote(const MachineName: string): IPortableDeviceService; begin Result := CreateRemoteComObject(MachineName, CLASS_PortableDeviceServiceFTM) as IPortableDeviceService; end; procedure TPortableDeviceServiceFTM.InitServerData; const CServerData: TServerData = ( ClassID: '{1649B154-C794-497A-9B03-F3F0121302F3}'; IntfIID: '{D3BD3A44-D7B5-40A9-98B7-2FA4D01DEC08}'; EventIID: ''; LicenseKey: nil; Version: 500); begin ServerData := @CServerData; end; procedure TPortableDeviceServiceFTM.Connect; var punk: IUnknown; begin if FIntf = nil then begin punk := GetServer; Fintf:= punk as IPortableDeviceService; end; end; procedure TPortableDeviceServiceFTM.ConnectTo(svrIntf: IPortableDeviceService); begin Disconnect; FIntf := svrIntf; end; procedure TPortableDeviceServiceFTM.DisConnect; begin if Fintf <> nil then begin FIntf := nil; end; end; function TPortableDeviceServiceFTM.GetDefaultInterface: IPortableDeviceService; begin if FIntf = nil then Connect; Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call "Connect" or "ConnectTo" before this operation'); Result := FIntf; end; constructor TPortableDeviceServiceFTM.Create(AOwner: TComponent); begin inherited Create(AOwner); {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps := TPortableDeviceServiceFTMProperties.Create(Self); {$ENDIF} end; destructor TPortableDeviceServiceFTM.Destroy; begin {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps.Free; {$ENDIF} inherited Destroy; end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} function TPortableDeviceServiceFTM.GetServerProperties: TPortableDeviceServiceFTMProperties; begin Result := FProps; end; {$ENDIF} function TPortableDeviceServiceFTM.Open(pszPnPServiceID: PWideChar; const pClientInfo: IPortableDeviceValues): HResult; begin Result := DefaultInterface.Open(pszPnPServiceID, pClientInfo); end; function TPortableDeviceServiceFTM.Capabilities(out ppCapabilities: IPortableDeviceServiceCapabilities): HResult; begin Result := DefaultInterface.Capabilities(ppCapabilities); end; function TPortableDeviceServiceFTM.Content(out ppContent: IPortableDeviceContent2): HResult; begin Result := DefaultInterface.Content(ppContent); end; function TPortableDeviceServiceFTM.Methods(out ppMethods: IPortableDeviceServiceMethods): HResult; begin Result := DefaultInterface.Methods(ppMethods); end; function TPortableDeviceServiceFTM.Cancel: HResult; begin Result := DefaultInterface.Cancel; end; function TPortableDeviceServiceFTM.Close: HResult; begin Result := DefaultInterface.Close; end; function TPortableDeviceServiceFTM.GetServiceObjectID(out ppszServiceObjectID: PWideChar): HResult; begin Result := DefaultInterface.GetServiceObjectID(ppszServiceObjectID); end; function TPortableDeviceServiceFTM.GetPnPServiceID(out ppszPnPServiceID: PWideChar): HResult; begin Result := DefaultInterface.GetPnPServiceID(ppszPnPServiceID); end; function TPortableDeviceServiceFTM.Advise(dwFlags: LongWord; const pCallback: IPortableDeviceEventCallback; const pParameters: IPortableDeviceValues; out ppszCookie: PWideChar): HResult; begin Result := DefaultInterface.Advise(dwFlags, pCallback, pParameters, ppszCookie); end; function TPortableDeviceServiceFTM.Unadvise(pszCookie: PWideChar): HResult; begin Result := DefaultInterface.Unadvise(pszCookie); end; function TPortableDeviceServiceFTM.SendCommand(dwFlags: LongWord; const pParameters: IPortableDeviceValues; out ppResults: IPortableDeviceValues): HResult; begin Result := DefaultInterface.SendCommand(dwFlags, pParameters, ppResults); end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} constructor TPortableDeviceServiceFTMProperties.Create(AServer: TPortableDeviceServiceFTM); begin inherited Create; FServer := AServer; end; function TPortableDeviceServiceFTMProperties.GetDefaultInterface: IPortableDeviceService; begin Result := FServer.DefaultInterface; end; {$ENDIF} // TIEPortableDevices Helper Methods // Return the ID of the root function GetFirstStorageID(PortableDev: IPortableDevice): WideString; var Content: IPortableDeviceContent; ObjectIDs: IEnumPortableDeviceObjectIDs; ObjectID: PWideChar; iFetched: Cardinal; begin Result := WPD_DEVICE_OBJECT_ID; if PortableDev.Content( Content ) <> S_OK then exit; if Content.EnumObjects( 0, '', nil, ObjectIDs ) = S_OK then begin ObjectIDs.Reset; ObjectIDs.Next( 1, ObjectID, iFetched ); if iFetched > 0 then Result := ObjectID; end end; // Connect to the specified device and fill PortableDev function ConnectToDevice(sDeviceID: WideString; var PortableDev: IPortableDevice; var sLastError: string; Logger: TLogger): Boolean; const CLIENT_NAME : WideString = 'MyClient'; CLIENT_MAJOR_VER = 1; CLIENT_MINOR_VER = 0; CLIENT_REVISION = 0; var DeviceValues: IPortableDeviceValues; hRes: HResult; PropKey: _WPDtagpropertykey; begin Result := False; Logger( 'Connecting to: ' + sDeviceID ); PortableDev := CoPortableDevice.Create; try // Create device value DeviceValues := CreateComObject( CLASS_PortableDeviceValues ) as IPortableDeviceValues; if VarIsClear( DeviceValues ) then begin Logger( 'DeviceValues: Invalid' ); Exit; end; Logger( 'DeviceValues: Valid' ); // Set properties PropKey.fmtid := WPD_CLIENT_NAME_FMTID; PropKey.pid := WPD_CLIENT_NAME_PID; DeviceValues.SetStringValue( PropKey, PWideChar( CLIENT_NAME )); PropKey.fmtid := WPD_CLIENT_MAJOR_VERSION_FMTID; PropKey.pid := WPD_CLIENT_MAJOR_VERSION_PID; DeviceValues.SetUnsignedIntegerValue( PropKey, CLIENT_MAJOR_VER ); PropKey.fmtid := WPD_CLIENT_MINOR_VERSION_FMTID; PropKey.pid := WPD_CLIENT_MINOR_VERSION_PID; DeviceValues.SetUnsignedIntegerValue( PropKey, CLIENT_MINOR_VER ); PropKey.fmtid := WPD_CLIENT_REVISION_FMTID; PropKey.pid := WPD_CLIENT_REVISION_PID; DeviceValues.SetUnsignedIntegerValue( PropKey, CLIENT_REVISION ); // Open device hRes := PortableDev.Open( PWideChar( sDeviceID ), DeviceValues ); if hRes = E_ACCESSDENIED then begin // Attempt to open for read-only access PropKey.fmtid := WPD_CLIENT_DESIRED_ACCESS_FMTID; PropKey.pid := WPD_CLIENT_DESIRED_ACCESS_PID; DeviceValues.SetUnsignedIntegerValue(PropKey, GENERIC_READ ); hRes := PortableDev.Open( PWideChar( sDeviceID ), DeviceValues ); end; Result := hRes = S_OK; if Result then Logger( 'Connected to: ' + sDeviceID ) else begin Logger( 'PortableDev.Open Failure: ' + IntToStr( hRes )); sLastError := format( 'Unable to open device (%d)', [ hRes ] ); end; finally DeviceValues := nil; end; end; // Return the friendly name for a device function GetDeviceFriendlyName(PMan: TPortableDeviceManager; sDeviceID: WideString): WideString; var iLength: LongWord; iResult: Integer; begin Result := ''; iLength := 0; iResult := PMan.GetDeviceFriendlyName( PWideChar( sDeviceID ), Word( nil^ ), iLength ); if iResult = S_OK then begin if iLength > 0 then begin SetLength( Result, iLength ); ZeroMemory( PWideChar( Result ), iLength ); PMan.GetDeviceFriendlyName( PWideChar( sDeviceID ), PWord(PWideChar( Result ))^, iLength ); Result := Trim( Result ); end; end; end; // Return the description for a device function GetDeviceDescription(PMan: TPortableDeviceManager; sDeviceID: WideString): WideString; var iLength: LongWord; iResult: Integer; begin Result := ''; iLength := 0; iResult := PMan.GetDeviceDescription( PWideChar( sDeviceID ), Word( nil^ ), iLength ); if iResult = S_OK then begin if iLength > 0 then begin SetLength( Result, iLength ); ZeroMemory( PWideChar( Result ), iLength ); PMan.GetDeviceDescription( PWideChar( sDeviceID ), PWord( PWideChar( Result ))^, iLength ); Result := Trim( Result ); end; end; end; // Return the manufacturer for a device function GetDeviceManufacturer(PMan: TPortableDeviceManager; sDeviceID: WideString): WideString; var iLength: LongWord; iResult: Integer; begin Result := ''; iLength := 0; iResult := PMan.GetDeviceManufacturer(PWideChar( sDeviceID ), Word( nil^ ), iLength ); if iResult = S_OK then begin if iLength > 0 then begin SetLength( Result, iLength ); ZeroMemory( PWideChar( Result ), iLength ); PMan.GetDeviceManufacturer( PWideChar( sDeviceID ), PWord( PWideChar( Result ))^, iLength ); Result := Trim( Result ); end; end; end; // Determine if PropValues for object returns folder content type function IsFolder(PropValues: IPortableDeviceValues): Boolean; var PropKey: _WPDtagpropertykey; PropGuid: TGUID; begin Result := False; if VarIsClear( PropValues ) then exit; PropKey.fmtid := WPD_OBJECT_CONTENT_TYPE_FMTID; PropKey.pid := WPD_OBJECT_CONTENT_TYPE_PID; if PropValues.GetGuidValue( PropKey, PropGuid ) = S_OK then begin if IsEqualGUID( PropGuid, WPD_CONTENT_TYPE_FOLDER ) or IsEqualGUID( PropGuid, WPD_CONTENT_TYPE_FUNCTIONAL_OBJECT ) then Result := True; end; end; // Return a TIEWPDObject for an object function GetObjectProperties(Prop: IPortableDeviceProperties; ObjectID: PWideChar) : TIEWPDObject; var ObjectName, ObjectOriginalName : PWideChar; Keys: IPortableDeviceKeyCollection; PropValues: IPortableDeviceValues; PropKey: _WPDtagpropertykey; begin ObjectName := ''; ObjectOriginalName := ''; Prop.GetSupportedProperties( ObjectID, Keys ); Prop.GetValues( ObjectID, Keys, PropValues ); // Get the name of the object if not VarIsClear( PropValues ) then begin PropKey.fmtid := WPD_OBJECT_ORIGINAL_FILE_NAME_FMTID; PropKey.pid := WPD_OBJECT_ORIGINAL_FILE_NAME_PID; PropValues.GetStringValue( PropKey, ObjectOriginalName ); if Length( Trim( ObjectOriginalName )) = 0 then ObjectOriginalName := ObjectID; PropKey.fmtid := WPD_OBJECT_NAME_FMTID; PropKey.pid := WPD_OBJECT_NAME_PID; PropValues.GetStringValue( PropKey, ObjectName ); end; Result.ID := ObjectID; Result.FriendlyName := ObjectName; Result.Filename := ObjectOriginalName; Result.Path := ObjectName; // Filled correctly later if IsFolder( PropValues ) then Result.ObjectType := iewFolder else Result.ObjectType := iewFile; end; // Return true if sText contains/equals sSearchText // sSearchText can be FIND (exact match), FIND* (match at start) or *FIND* (match anywhere in filename) // NOT case-sensitive function IsSearchMatch(const sSearchText, sText : WideString) : boolean; var sPosText: WideString; begin Result := ( sSearchText <> '' ) and ( sText <> '' ); if Result = False then exit; sPosText := WideUpperCase( sSearchText ); if sPosText[ 1 ] = '*' then Delete( sPosText, 1, 1 ); if sPosText[ Length( sPosText ) ] = '*' then SetLength( sPosText, Length( sPosText ) - 1 ); // MATCH TEXT ANYWHERE if sSearchText[ 1 ] = '*' then Result := Pos( sPosText, WideUpperCase( sText )) > 0 else // MATCH AT BEGINING if sSearchText[ Length( sSearchText ) ] = '*' then Result := Pos( sPosText, WideUpperCase( sText )) = 1 else // EXACT MATCH Result := sPosText = WideUpperCase( sText ); end; // INTERNAL FOLDER ENUMERATION METHOD // iCurrentDepth = 0: First leve, 1: second level, etc // iMaxDepth = 0, current folder only. iMaxDepth = 1. Current folder and first level of children, iMaxDepth = -1 all folders function _EnumerateFolder(Content: IPortableDeviceContent; var aObjects: TList; sParentID: WideString; sParentPath: WideString; iCurrentDepth, iMaxDepth : Integer; GetTypes: TIEWPDObjectTypes; var sLastError : string; Logger: TLogger; const sSearchText : WideString = ''; const sFileExtensions : String = '') : Boolean; var ObjectIDs: IEnumPortableDeviceObjectIDs; ObjectID : PWideChar; iFetched : Cardinal; Prop: IPortableDeviceProperties; ObjectPath: WideString; iResult: Integer; aObject : TIEWPDObject; pIEObject: PIEWPDObject; bDoAdd: Boolean; begin Result := True; if VarIsClear( Content ) then exit; // Retrieve content properties Content.Properties( Prop ); // Enumerate objects iResult := Content.EnumObjects( 0, PWideChar( sParentID ), nil, ObjectIDs ); if iResult <> S_OK then begin Logger( 'EnumObjects Failure: ' + IntToStr( iResult )); sLastError := format( 'Unable to enumerate objects (%d)', [ iResult ] ); if iCurrentDepth = 0 then Result := False; exit; end; // Parse objects Logger( 'Enumerate Folder: ' + sParentID ); ObjectIDs.Reset; ObjectIDs.Next( 1, ObjectID, iFetched ); While iFetched > 0 do begin // Retrieve object properties aObject := GetObjectProperties( Prop, ObjectID ); if Length( sParentPath ) > 0 then ObjectPath := IncludeTrailingPathDelimiter( sParentPath ) + aObject.FriendlyName else ObjectPath := aObject.FriendlyName; bDoAdd := aObject.ObjectType in GetTypes; if bDoAdd and ( sFileExtensions <> '' ) then bDoAdd := IEFilenameInExtensions( aObject.Filename, sFileExtensions ); if bDoAdd and ( sSearchText <> '' ) then begin // Use full filename for files (as has extension), but friendly name for folders if aObject.ObjectType = iewFile then bDoAdd := IsSearchMatch( sSearchText, aObject.Filename ) else bDoAdd := IsSearchMatch( sSearchText, aObject.FriendlyName ); end; if bDoAdd then begin New( pIEObject ); pIEObject^.ID := ObjectID; // Object id - full path to object pIEObject^.FriendlyName := aObject.FriendlyName; // Object name pIEObject^.Filename := aObject.Filename; // Folder/file name pIEObject^.Path := ObjectPath; // Full path to object pIEObject^.ObjectType := aObject.ObjectType; // Folder or file? aObjects.add( pIEObject ); end; // Enumerate sub-folder? if ( aObject.ObjectType = iewFolder ) then if ( iMaxDepth = -1 ) or ( iCurrentDepth < iMaxDepth ) then begin Logger( format( 'Process sub-folder at depth %d', [ iCurrentDepth + 1 ] )); Result := _EnumerateFolder( Content, aObjects, ObjectID, ObjectPath, iCurrentDepth + 1, iMaxDepth, GetTypes, sLastError, Logger, sSearchText, sFileExtensions ); end; // Fetch next ObjectIDs.Next( 1, ObjectID, iFetched ); end; end; // Translate a path and return a folder ID if found function _LocateFolderPath( Content: IPortableDeviceContent; const sParentID: WideString; sFindPath, sParentPath: WideString; var sDestFolderID: WideString; Logger: TLogger): Boolean; var ObjectIDs: IEnumPortableDeviceObjectIDs; ObjectID : PWideChar; iFetched: Cardinal; Prop: IPortableDeviceProperties; sCurrent: WideString; iResult: Integer; aObject : TIEWPDObject; begin Result := False; if VarIsClear( content ) then exit; // Retrieve content properties Content.Properties( Prop ); iResult := Content.EnumObjects( 0, PWideChar( sParentID ), nil, ObjectIDs ); if iResult <> S_OK then begin Logger( 'EnumObjects Failure: ' + IntToStr( iResult )); exit; end; // Parse objects Logger( 'Enumerate Folder: ' + sParentID ); ObjectIDs.Reset; ObjectIDs.Next( 1, ObjectID, iFetched ); While iFetched > 0 do begin // Retrieve object properties aObject := GetObjectProperties( Prop, ObjectID ); // We only care about folders if aObject.ObjectType = iewFolder then begin sCurrent := IncludeTrailingPathDelimiter( sParentPath + aObject.FriendlyName ); if SameText( sCurrent, sFindPath ) then begin sDestFolderID := ObjectID; Result := True; exit; end else // is this folder on the right path? if Pos( WideUpperCase( sCurrent ), WideUpperCase( sFindPath )) = 1 then begin // Check sub-folders Logger( 'Process sub-folder...' ); Result := _LocateFolderPath( Content, ObjectID, sFindPath, sCurrent, sDestFolderID, Logger ); if Result then exit; end; end; // Fetch next ObjectIDs.Next( 1, ObjectID, iFetched ); end; end; // Convert a WideString value to a tag_inner_PROPVARIANT procedure WideStringToPropVariant(sVal: WideString; var PropVarValue: tag_inner_PROPVARIANT); var pValues: IPortableDeviceValues; PropKey: _WPDtagpropertykey; begin pValues := CreateComObject( CLASS_PortableDeviceValues ) as IPortableDeviceValues; if VarIsClear( pValues ) then Exit; try // Convert WideString value to IPortableDeviceValues object PropKey.fmtid := WPD_OBJECT_ID_FMTID; PropKey.pid := WPD_OBJECT_ID_PID; pValues.SetStringValue( PropKey, PWideChar( sVal )); // Return as a PROPVARIANT pValues.GetValue( PropKey, PropVarValue ); finally pValues := nil; end; end; // Convert a tag_inner_PROPVARIANT value to a WideString procedure PropVariantToString(PropVarValue: tag_inner_PROPVARIANT; var sVal: WideString); var pValues: IPortableDeviceValues; PropKey: _WPDtagpropertykey; hRes: HResult; pVal: PWideChar; begin sVal := ''; pValues := CreateComObject( CLASS_PortableDeviceValues ) as IPortableDeviceValues; if VarIsClear( pValues ) then Exit; try // Convert PROPVARIANT to IPortableDeviceValues object PropKey.fmtid := WPD_OBJECT_ID_FMTID; PropKey.pid := WPD_OBJECT_ID_PID; pValues.SetValue( PropKey, PropVarValue ); // Check for error if PropVarValue.vt = VT_ERROR then begin pValues.GetErrorValue( PropKey, hRes ); sVal := SysErrorMessage( hRes ); end else begin // Return as WideString pValues.GetStringValue( PropKey, pVal ); sVal := pVal; end; finally pValues := nil; end; end; // Null a PROPVARIANT var procedure InitPropVariant(out pvar: PROPVARIANT); begin ZeroMemory( @pvar, SizeOf( PROPVARIANT )); end; // Specify a sFileID for one file (ssFileIDs must be nil) or ssFileIDs for multiple files // Note: Can delete folder if bDeleteSubObjects = true function _DeleteFromDevice(const sDeviceID : WideString; sFileID: WideString; ssFileIDs : TStrings; bDeleteSubObjects: Boolean; var sResultText: WideString; var sLastError : string; Logger: TLogger): Integer; var bSuccess: Boolean; PortableDev: IPortableDevice; Content: IPortableDeviceContent; PropKey: tag_inner_PROPVARIANT; pFiles, pRes: IPortableDevicePropVariantCollection; iCount: Cardinal; dwOptions: LongWord; I: Integer; // Add file name to deletion list procedure _AddFile(const sID: WideString); begin InitPropVariant( ActiveX.PROPVARIANT( PropKey )); WideStringToPropVariant( sID, PropKey ); pFiles.Add( PropKey ); end; begin Result := -1; sLastError := ''; sResultText := ''; try if ConnectToDevice( sDeviceID, PortableDev, sLastError, Logger ) = False then exit; try // Read Content of device if PortableDev.Content( Content ) <> S_OK then exit; pFiles := CreateComObject( CLASS_PortableDevicePropVariantCollection ) as IPortableDevicePropVariantCollection; if VarIsClear( pFiles ) then Exit; pRes := CreateComObject( CLASS_PortableDevicePropVariantCollection ) as IPortableDevicePropVariantCollection; if VarIsClear( pRes ) then Exit; // TStrings? if assigned( ssFileIDs ) = False then // Just one file to delete _AddFile( sFileID ) else // Delete list of files for I := 0 to ssFileIDs.Count - 1 do _AddFile( ssFileIDs[ I ] ); // DELETE Logger( 'Deleting file: ' + sFileID ); // With recursion? dwOptions := 0; if bDeleteSubObjects then dwOptions := 1; bSuccess := Content.Delete( dwOptions, pFiles, pRes ) = S_OK; pRes.GetCount( iCount ); if bSuccess then Result := iCount; if iCount > 0 then begin InitPropVariant( ActiveX.PROPVARIANT( PropKey )); pRes.GetAt( 0, PropKey ); PropVariantToString( PropKey, sResultText ); Logger( 'Delete: ' + sResultText ); end; finally PortableDev.Close; end; finally pFiles := nil; pRes := nil; PortableDev := nil; end; end; { TIEPortableDevices } constructor TIEPortableDevices.Create; begin inherited Create; fDevicesInitialized := False; fObjectsInitialized := False; fSorted := True; fHideEmptyDevices := False; end; destructor TIEPortableDevices.Destroy(); begin Clear; FreeAndNil( fObjects ); FreeAndNil( fDevices ); inherited; end; {!! TIEPortableDevices.DeviceIDToIndex Declaration function DeviceIDToIndex(const sDeviceID: WideString): Integer; Description Return the index of the device in the Devices list with the specified ID. Result is -1 if the ID is not valid. Example // Get the friendly name of the selected device in a listbox sFriendlyName := Devices[ DeviceIDToIndex( lbxDevices.Items[ lbxDevices.ItemIndex ] ) ].FriendlyName; !!} function TIEPortableDevices.DeviceIDToIndex(const sDeviceID: WideString): Integer; var I: Integer; begin Result := -1; CheckDevicesInitialized; for I := 0 to fDevices.Count - 1 do if PIEPortableDevice( fDevices[ I ] )^.ID = sDeviceID then begin Result := I; Exit; end; end; {!! TIEPortableDevices.Objects Declaration property Objects[Index: Integer]: ; (read-only) Description An array of all objects found in the current folder of the active device. The objects list is filled after a successful call to any of the following: - - - - - - Or by setting Examples // Navigate to folder and fill list box with its object IDs procedure TfrmMain.OpenFolder(const sFolderID : WideString); var I: Integer; begin fPortableDevices.ActiveFolderID := sFolderID; lbxObjects.Items.Clear; for I := 0 to fPortableDevices.ObjectCount - 1 do lbxObjects.Items.Add( fPortableDevices.Objects[ I ].ID ); end; // Save the selection to a file and launch it Idx := fPortableDevices.ObjectIDToIndex( lbxObjects.Items[ lbxObjects.ItemIndex ] ); aObject := fPortableDevices.Objects[ Idx ]; if aObject.ObjectType <> iewFolder then begin sFilename := IncludeTrailingBackSlash( ExtractFilePath( Application.ExeName )) + aObject.Filename; if fPortableDevices.CopyFileFromDevice(SelectedDeviceID, aObject.ID, sFileName) then ShellExecute( Handle, 'open', PChar( sFileName ), nil, nil, SW_MAXIMIZE ); end; !!} function TIEPortableDevices.GetObjects(Index: Integer): TIEWPDObject; begin CheckObjectsInitialized; if assigned( fObjects ) and ( Index >= 0 ) and ( Index < fObjects.Count ) then begin Result := TIEWPDObject( fObjects[ Index ]^ ); end else begin Result.ID := ''; Result.FriendlyName := ''; Result.Filename := ''; Result.Path := ''; Result.ObjectType := iewFile; end; end; {!! TIEPortableDevices.ObjectCount Declaration property ObjectCount : Integer; (read-only) Description Returns the number of objects in the Object list. Example // Navigate to folder and fill listbox with its object IDs procedure TfrmMain.OpenFolder(const sFolderID : WideString); var I: Integer; begin fPortableDevices.ActiveFolderID := sFolderID; lbxObjects.Items.Clear; for I := 0 to fPortableDevices.ObjectCount - 1 do lbxObjects.Items.Add( fPortableDevices.Objects[ I ].ID ); end; !!} function TIEPortableDevices.GetObjectCount: Integer; begin Result := 0; CheckObjectsInitialized; if assigned( fObjects ) then result := fObjects.Count; end; {!! TIEPortableDevices.ObjectIDToIndex Declaration function ObjectIDToIndex(const sObjectID: WideString): Integer; Description Returns the index of the object in the Objects list with the specified ID. Result is -1 if the ID is not valid. Example // Get the friendly name of the selected object in listbox sFriendlyName := Objects[ ObjectIDToIndex( lbxObjects.Items[ lbxObjects.ItemIndex ] ) ].FriendlyName; !!} function TIEPortableDevices.ObjectIDToIndex(const sObjectID: WideString): Integer; var I: Integer; begin Result := -1; CheckObjectsInitialized; if assigned( fObjects ) = False then exit; for I := 0 to fObjects.Count - 1 do if PIEWPDObject( fObjects[ I ] )^.ID = sObjectID then begin Result := I; Exit; end; end; {!! TIEPortableDevices.ObjectIsFolder Declaration function ObjectIsFolder(const sObjectID : WideString) : Boolean; overload; function ObjectIsFolder(Index: Integer): Boolean; overload; Description Returns true if the object of the specified ID or index in the objects list is a folder (i.e. ObjectType is iewFolder). This is the same as calling: bIsFolder := IEPortableDevices.Objects[ ObjectIDToIndex( sObjectID ) ].ObjectType = iewFolder; Example // Open folder on double click procedure TfrmMain.lbxObjectsDblClick(Sender: TObject); var Idx: Integer; aObject: TIEWPDObject; begin if ( lbxObjects.ItemIndex >= 0 ) and fPortableDevices.ObjectIsFolder( lbxObjects.Items[ lbxObjects.ItemIndex ] ) then begin // Fill Objects with items in this folder if fPortableDevices.NavigateToFolderID( lbxObjects.Items[ lbxObjects.ItemIndex ] ) then begin lbxObjects.Items.Clear; for I := 0 to fPortableDevices.ObjectCount - 1 do lbxObjects.Items.Add( fPortableDevices.Objects[ I ].ID ); end; end; end; !!} function TIEPortableDevices.ObjectIsFolder(const sObjectID: WideString): Boolean; begin Result := ObjectIsFolder( ObjectIDToIndex( sObjectID )); end; function TIEPortableDevices.ObjectIsFolder(Index: Integer): Boolean; begin result := False; CheckObjectsInitialized; if assigned( fObjects ) and ( Index >= 0 ) and ( Index < fObjects.Count ) then Result := TIEWPDObject( fObjects[ Index ]^ ).ObjectType = iewFolder; end; // Sort method: Alphabetical by name, folders before files function CompareNames(Object1, Object2: Pointer): Integer; var bObject1IsFolder, bObject2IsFolder : Boolean; begin bObject1IsFolder := PIEWPDObject( Object1 )^.ObjectType = iewFolder; bObject2IsFolder := PIEWPDObject( Object2 )^.ObjectType = iewFolder; // Folders always appear before files if bObject1IsFolder <> bObject2IsFolder then begin if bObject1IsFolder then Result := -1 else Result := 1; end else begin // Sort by friendly name (so folders sort correctly) Result := CompareText( PIEWPDObject( Object1 )^.FriendlyName, PIEWPDObject( Object2 )^.FriendlyName ); end; end; {!! TIEPortableDevices.NavigateToFolderID Declaration function NavigateToFolderID(const sFolderID : WideString; bIncludeSubFolders : Boolean = False; GetTypes: = [iewFile, iewFolder]) : Boolean; overload; function NavigateToFolderID(const sDeviceID, sFolderID : WideString; bIncludeSubFolders : Boolean = False; GetTypes: = [iewFile, iewFolder]) : Boolean; overload; Description Navigates to a folder specified by an Object ID and fills the objects list. The ID can be any object in the objects list of ObjectType = iewFolder. Parameter Description sDeviceID The device to open (if not specified then the active device is used) sFolderID The ID of a folder object to open. Can be '' to open the device root folder bIncludeSubFolders Whether to also retrieve objects in sub-folders GetTypes They type of objects to returns, files (iewFile), folders (iewFolder) or both
Result is false if an error was detected. You can check
for detail on the failure. ActiveDeviceID and ActiveFolderID will be updated after calling NavigateToFolderID. Use of NavigateToFolderID(const sDeviceID, sFolderID ); is the same as setting: ActiveDeviceID := sDeviceID; ActiveFolderID := sFolderID; Example // Open folder on double click procedure TfrmMain.lbxObjectsDblClick(Sender: TObject); var Idx: Integer; aObject: TIEWPDObject; begin if ( lbxObjects.ItemIndex >= 0 ) and fPortableDevices.ObjectIsFolder( lbxObjects.Items[ lbxObjects.ItemIndex ] ) then begin // Fill Objects with items in this folder if fPortableDevices.NavigateToFolderID( lbxObjects.Items[ lbxObjects.ItemIndex ] ) then begin lbxObjects.Items.Clear; for I := 0 to fPortableDevices.ObjectCount - 1 do lbxObjects.Items.Add( fPortableDevices.Objects[ I ].ID ); end; end; end; !!} function TIEPortableDevices.NavigateToFolderID(const sDeviceID, sFolderID: WideString; bIncludeSubFolders : Boolean = False; GetTypes: TIEWPDObjectTypes = [iewFile, iewFolder]): Boolean; var PortableDev: IPortableDevice; Content: IPortableDeviceContent; iMaxDepth: Integer; begin Result := False; fLastError := ''; if sDeviceID <> '' then fActiveDeviceID := sDeviceID; fActiveFolderID := sFolderID; fObjectsInitialized := True; ClearObjectList; try if ConnectToDevice( fActiveDeviceID, PortableDev, fLastError, AddToLog ) = False then exit; try // Read content of device if PortableDev.Content( Content ) = S_OK then begin iMaxDepth := 0; if bIncludeSubFolders then iMaxDepth := -1; // if sFolderID = '' then navigate to root if sFolderID = '' then Result := _EnumerateFolder( Content, fObjects, GetFirstStorageID( PortableDev ), '', 0, iMaxDepth, GetTypes, fLastError, AddToLog ) else Result := _EnumerateFolder( Content, fObjects, sFolderID, sFolderID, 0, iMaxDepth, GetTypes, fLastError, AddToLog ); end; finally PortableDev.Close; end; // Don't sort if we are parsing sub-folders as it will take too long if fSorted and ( bIncludeSubFolders = False ) then fObjects.Sort( @CompareNames ); finally PortableDev := nil; end; end; function TIEPortableDevices.NavigateToFolderID(const sFolderID : WideString; bIncludeSubFolders : Boolean = False; GetTypes: TIEWPDObjectTypes = [iewFile, iewFolder]) : Boolean; begin Result := NavigateToFolderID( '', sFolderID, bIncludeSubFolders, GetTypes ); end; {!! TIEPortableDevices.NavigateToFolderPath Declaration function NavigateToFolderPath(const sPath : WideString; bIncludeSubFolders : Boolean = False; GetTypes: = [iewFile, iewFolder]) : Boolean; overload; function NavigateToFolderPath(const sDeviceID, sPath : WideString; bIncludeSubFolders : Boolean = False; GetTypes: = [iewFile, iewFolder]) : Boolean; overload; Description Navigates to a device folder specified by a path and fills the objects list. A path is a list of folders specified by their FriendlyName and delimited by a slash. e.g. Card\DCIM\ for the image folder on a smartphone. Parameter Description sDeviceID The device to open (if not specified then the active device is used) sPath The path to open on that device bIncludeSubFolders Whether to also retrieve objects in sub-folders GetTypes They type of objects to returns, files (iewFile), folders (iewFolder) or both
Result is false if an error was detected. You can check
for detail on the failure. Example // Add all files in the DCIM folder and its sub-folders if fPortableDevices.NavigateToFolderPath( 'Card\DCIM\', True, iewFile ) then begin lbxObjects.Items.Clear; for I := 0 to fPortableDevices.ObjectCount - 1 do lbxObjects.Items.Add( fPortableDevices.Objects[ I ].ID ); end; !!} function TIEPortableDevices.NavigateToFolderPath(const sDeviceID, sPath : WideString; bIncludeSubFolders : Boolean = False; GetTypes: TIEWPDObjectTypes = [iewFile, iewFolder]) : Boolean; var PortableDev: IPortableDevice; Content: IPortableDeviceContent; sFoundFolderID : WideString; sParentID: WideString; begin Result := False; fLastError := ''; sFoundFolderID := ''; if sPath = '' then exit; if sDeviceID <> '' then fActiveDeviceID := sDeviceID; try if ConnectToDevice( fActiveDeviceID, PortableDev, fLastError, AddToLog ) = False then exit; try // Read content of device if PortableDev.Content( Content ) = S_OK then begin sParentID := GetFirstStorageID( PortableDev ); // Note: Find Path must have trailing backslash! if _LocateFolderPath( Content, sParentID, IEAddBackSlash( sPath ), '', sFoundFolderID, AddToLog ) then Result := NavigateToFolderID( fActiveDeviceID, sFoundFolderID, bIncludeSubFolders ) else fLastError := 'Unable to locate path: ' + sPath; end; finally PortableDev.Close; end; finally PortableDev := nil; end; end; function TIEPortableDevices.NavigateToFolderPath(const sPath : WideString; bIncludeSubFolders : Boolean = False; GetTypes: TIEWPDObjectTypes = [iewFile, iewFolder]) : Boolean; begin Result := NavigateToFolderPath( '', sPath, bIncludeSubFolders, GetTypes ); end; {!! TIEPortableDevices.NavigateToParent Declaration function NavigateToParent : Boolean; Description Opens the parent of the active folder. The objects list will be filled if this method succeeds Result is false if an error was detected. You can check for detail on the failure. Note: Use to check whether the current folder has a parent Example // Go to the parent of the displayed folder procedure TfrmMain.btnOpenParentClick(Sender: TObject); var I: Integer; begin if fPortableDevices.NavigateToParent() then begin lbxObjects.Items.Clear; for I := 0 to fPortableDevices.ObjectCount - 1 do lbxObjects.Items.Add( fPortableDevices.Objects[ I ].ID ); end; end; !!} function TIEPortableDevices.NavigateToParent() : Boolean; var aProps : TIEWPDObjectAdvancedProps; begin Result := False; if fActiveFolderID = '' then exit; if GetObjectAdvancedProps( fActiveFolderID, aProps ) then Result := NavigateToFolderID( fActiveDeviceID, aProps.ParentID ); end; {!! TIEPortableDevices.FindFilesOfType Declaration function FindFilesOfType(const sDeviceID, sFolderID: WideString; sFileExtensions: String; iMaxDepth : Integer = 0): Boolean; overload; function FindFilesOfType(const sFolderID: WideString; sFileExtensions: String; iMaxDepth : Integer = 0): Boolean; overload; Description Searches for files of the specified file extensions and fills the objects list. Parameter Description sDeviceID The device to open (if not specified then the active device is used) sFolderID The ID of a folder to search. Can be '' to search the whole device sFileExtensions The file types to return, in the format '*.jpg;*.jpeg;*.bmp;' iMaxDepth How many folders to search below the current folder, -1: Search all sub-folders, 0: Search only the specified folder, 1: Search the specified folder and the next level of sub-folders, etc.
Result is false if an error was detected. You can check
for detail on the failure. Note: Will only return files, i.e. objects of type iewFile Example // Return all images in the camera folder of a smart phone sFolderID := PathToFolderID( 'Card\DCIM\'; if sFolderID <> '' then if FindFilesOfType( sFolderID, '*.jpg;*.jpeg' ) then begin lbxObjects.Items.Clear; for I := 0 to fPortableDevices.ObjectCount - 1 do lbxObjects.Items.Add( fPortableDevices.Objects[ I ].ID ); end; !!} function TIEPortableDevices.FindFilesOfType(const sDeviceID, sFolderID: WideString; sFileExtensions: String; iMaxDepth : Integer = 0): Boolean; var PortableDev: IPortableDevice; Content: IPortableDeviceContent; begin Result := False; fLastError := ''; if sDeviceID <> '' then fActiveDeviceID := sDeviceID; fActiveFolderID := sFolderID; fObjectsInitialized := True; ClearObjectList; if fActiveDeviceID = '' then exit; try if ConnectToDevice( fActiveDeviceID, PortableDev, fLastError, AddToLog ) = False then exit; try // Read content of device if PortableDev.Content( Content ) = S_OK then begin // if sFolderID = '' then navigate to root if sFolderID = '' then Result := _EnumerateFolder( Content, fObjects, GetFirstStorageID( PortableDev ), '', 0, iMaxDepth, [ iewFile ], fLastError, AddToLog, '', sFileExtensions ) else Result := _EnumerateFolder( Content, fObjects, sFolderID, sFolderID, 0, iMaxDepth, [ iewFile ], fLastError, AddToLog, '', sFileExtensions ); end; finally PortableDev.Close; end; // Don't sort if we are parsing too many Objects as it will take too long if fSorted and ( fObjects.Count < 5000 ) then fObjects.Sort( @CompareNames ); finally PortableDev := nil; end; end; function TIEPortableDevices.FindFilesOfType(const sFolderID: WideString; sFileExtensions: String; iMaxDepth : Integer = 0): Boolean; begin Result := FindFilesOfType( '', sFolderID, sFileExtensions, iMaxDepth ); end; {!! TIEPortableDevices.FindFilesByName Declaration function FindFilesByName(const sFolderID, sSearchText: WideString; GetTypes: = [iewFile, iewFolder]; iMaxDepth : Integer = 0): Boolean; overload; function FindFilesByName(const sDeviceID, sFolderID, sSearchText: WideString; GetTypes: = [iewFile, iewFolder]; iMaxDepth : Integer = 0): Boolean; overload; Description Searches for files with the specified text and fill the objects list. Parameter Description sDeviceID The device to open (if not specified then the active device is used) sFolderID The ID of a folder to search. Can be '' to search the whole device sSearchText The text to search for, including wildcards. *TEXT* returns objects containing TEXT, TEXT* returns objects starting with TEXT, TEXT returns only objects with TEXT as their whole name GetTypes They type of objects to returns, files (iewFile), folders (iewFolder) or both iMaxDepth How many folders to search below the current folder, -1: Search all sub-folders, 0: Search only the specified folder, 1: Search the specified folder and the next level of sub-folders, etc.
Result is false if an error was detected. You can check
for detail on the failure. Note: Searches are NOT case-sensitive. File objects are checked using the "FileName" property, folder objects are checked against their "FriendlyName" Example // Return all files and folders in the current folder containing the word "Potato" if FindFilesByName( sFolderID, '*potato*', [iewFile, iewFolder], 0 ) then begin lbxObjects.Items.Clear; for I := 0 to fPortableDevices.ObjectCount - 1 do lbxObjects.Items.Add( fPortableDevices.Objects[ I ].ID ); end; // Return all files on the device of the exact filename "Image.jpg" if FindFilesByName( sFolderID, 'Image.jpg' ) then begin lbxObjects.Items.Clear; for I := 0 to fPortableDevices.ObjectCount - 1 do lbxObjects.Items.Add( fPortableDevices.Objects[ I ].ID ); end; // Return all folders that start with the word "Temp" if FindFilesByName( sFolderID, 'Temp*', iewFolder ) then begin lbxObjects.Items.Clear; for I := 0 to fPortableDevices.ObjectCount - 1 do lbxObjects.Items.Add( fPortableDevices.Objects[ I ].ID ); end; !!} function TIEPortableDevices.FindFilesByName(const sDeviceID, sFolderID, sSearchText: WideString; GetTypes: TIEWPDObjectTypes = [iewFile, iewFolder]; iMaxDepth : Integer = 0): Boolean; var PortableDev: IPortableDevice; Content: IPortableDeviceContent; begin Result := False; fLastError := ''; if sDeviceID <> '' then fActiveDeviceID := sDeviceID; fActiveFolderID := sFolderID; fObjectsInitialized := True; ClearObjectList; if fActiveDeviceID = '' then exit; try if ConnectToDevice( fActiveDeviceID, PortableDev, fLastError, AddToLog ) = False then exit; try // Read content of device if PortableDev.Content( Content ) = S_OK then begin // if sFolderID = '' then navigate to root if sFolderID = '' then Result := _EnumerateFolder( Content, fObjects, GetFirstStorageID( PortableDev ), '', 0, iMaxDepth, GetTypes, fLastError, AddToLog, sSearchText, '' ) else Result := _EnumerateFolder( Content, fObjects, sFolderID, sFolderID, 0, iMaxDepth, GetTypes, fLastError, AddToLog, sSearchText, '' ); end; finally PortableDev.Close; end; // Don't sort if we are parsing too many Objects as it will take too long if fSorted and ( fObjects.Count < 5000 ) then fObjects.Sort( @CompareNames ); finally PortableDev := nil; end; end; function TIEPortableDevices.FindFilesByName(const sFolderID, sSearchText: WideString; GetTypes: TIEWPDObjectTypes = [iewFile, iewFolder]; iMaxDepth : Integer = 0): Boolean; begin Result := FindFilesByName( '', sFolderID, sSearchText, GetTypes, iMaxDepth ); end; {!! TIEPortableDevices.PathToFolderID Declaration function PathToFolderID(const sPath : WideString) : WideString; overload; function PathToFolderID(const sDeviceID, sPath : WideString) : WideString; overload; Description Locate a folder by path and returns its ID. A path is a list of folders specified by their FriendlyName and delimited by a slash. e.g. Card\DCIM\ for the image folder on a smartphone. Parameter Description sDeviceID The device to check (if not specified then the active device is used) sPath The path to locate on that device
Result is '' if the path could not be found. Example // Return all images in the camera folder of a smart phone sFolderID := PathToFolderID( 'Card\DCIM\'; if sFolderID <> '' then if FindFilesOfType( sFolderID', '*.jpg;*.jpeg' ) then begin lbxObjects.Items.Clear; for I := 0 to fPortableDevices.ObjectCount - 1 do lbxObjects.Items.Add( fPortableDevices.Objects[ I ].ID ); end; !!} function TIEPortableDevices.PathToFolderID(const sDeviceID, sPath : WideString) : WideString; var PortableDev: IPortableDevice; Content: IPortableDeviceContent; sFoundFolderID : WideString; sParentID: WideString; begin Result := ''; fLastError := ''; sFoundFolderID := ''; if sPath = '' then exit; if sDeviceID <> '' then fActiveDeviceID := sDeviceID; try if ConnectToDevice( fActiveDeviceID, PortableDev, fLastError, AddToLog ) = False then exit; try // Read content of device if PortableDev.Content( Content ) = S_OK then begin sParentID := GetFirstStorageID( PortableDev ); // Note: Find Path must have trailing backslash! if _LocateFolderPath( Content, sParentID, IEAddBackSlash( sPath ), '', sFoundFolderID, AddToLog ) then Result := sFoundFolderID else fLastError := 'Unable to locate path: ' + sPath; end; finally PortableDev.Close; end; finally PortableDev := nil; end; end; function TIEPortableDevices.PathToFolderID(const sPath : WideString) : WideString; begin Result := PathToFolderID( '', sPath ); end; // Dispose of all Objects in object list and clear procedure TIEPortableDevices.ClearObjectList(); var i: Integer; begin if assigned( fObjects ) then begin for i := fObjects.Count - 1 downto 0 do Dispose( fObjects[ i ] ); fObjects.Clear; end; end; // Dispose of all objects in device and object lists and clear procedure TIEPortableDevices.Clear(); var i: Integer; begin ClearObjectList; if fDevicesInitialized then begin for i := fDevices.Count - 1 downto 0 do Dispose( fDevices[ i ] ); fDevices.Clear; fDevicesInitialized := False; end; end; // Wrapper for OnLog event procedure TIEPortableDevices.AddToLog(const sMsg : String); begin if assigned( fOnLog ) then fOnLog( Self, sMsg ); end; {!! TIEPortableDevices.CanNavigateToParent Declaration property CanNavigateToParent : Boolean; (read-only) Description Returns true if there is a parent of the active folder. I.e. so that
will succeed. Example // Enable the "Go Up" button if there is a parent of the current folder btnOpenParent.Enabled := IEPortableDevices.CanNavigateToParent; !!} function TIEPortableDevices.GetCanNavigateToParent: Boolean; begin Result := ( fActiveFolderID <> '' ) and ( fActiveFolderID <> WPD_DEVICE_OBJECT_ID ); end; {!! TIEPortableDevices.Devices Declaration property Devices[Index: Integer]: ; (read-only) Description An array of all devices connected to the PC. It is filled automatically or can be refreshed by calling . Example // Refresh the list of devices procedure TfrmMain.RefreshDeviceList(); var I: Integer; begin lbxObjects.Items.Clear; if fPortableDevices.RefreshDevices = False then raise Exception.create( 'Unable to get devices: ' + fPortableDevices.LastError); lbxDevices.Items.Clear; for I := 0 to fPortableDevices.DeviceCount - 1 do lbxDevices.Items.Add( fPortableDevices.Devices[ I ].ID ); end; !!} function TIEPortableDevices.GetDevices(Index: Integer): TIEPortableDevice; begin CheckDevicesInitialized; if ( Index >= 0 ) and ( Index < fDevices.Count ) then begin Result := TIEPortableDevice( fDevices[ Index ]^ ); end else begin Result.ID := ''; Result.FriendlyName := ''; Result.Description := ''; Result.Manufacturer := ''; Result.IsDrive := False; end; end; {!! TIEPortableDevices.DeviceCount Declaration property DeviceCount : Integer; (read-only) Description Returns the number of devices in the device list. Example // Refresh the list of devices procedure TfrmMain.RefreshDeviceList(); var I: Integer; begin lbxObjects.Items.Clear; if fPortableDevices.RefreshDevices = False then raise Exception.create( 'Unable to get devices: ' + fPortableDevices.LastError); lbxDevices.Items.Clear; for I := 0 to fPortableDevices.DeviceCount - 1 do lbxDevices.Items.Add( fPortableDevices.Devices[ I ].ID ); end; !!} function TIEPortableDevices.GetDeviceCount: Integer; begin CheckDevicesInitialized; Result := fDevices.Count; end; // Fill the device list if its empty procedure TIEPortableDevices.CheckDevicesInitialized(); begin if ( fDevicesInitialized = False ) or ( fDevices.Count = 0 ) then RefreshDevices(); end; // Fill the object list if its empty procedure TIEPortableDevices.CheckObjectsInitialized; begin if fObjectsInitialized = False then NavigateToFolderID( fActiveDeviceID, fActiveFolderID ); end; // Return true if any objects are found on the specified device function TIEPortableDevices.DeviceContainsObjects(const sDeviceID : WideString) : Boolean; var PortableDev: IPortableDevice; Content: IPortableDeviceContent; sParentID: WideString; Prop: IPortableDeviceProperties; ObjectIDs: IEnumPortableDeviceObjectIDs; ObjectID : PWideChar; iFetched : Cardinal; begin Result := False; if sDeviceID = '' then exit; try if ConnectToDevice( sDeviceID, PortableDev, fLastError, AddToLog ) = False then exit; try if PortableDev.Content( Content ) = S_OK then begin if VarIsClear( Content ) then exit; // Retrieve content properties Content.Properties( Prop ); // Enumerate objects sParentID := GetFirstStorageID( PortableDev ); if Content.EnumObjects( 0, PWideChar( sParentID ), nil, ObjectIDs ) <> S_OK then exit; // Any objects found? ObjectIDs.Reset; ObjectIDs.Next( 1, ObjectID, iFetched ); Result := iFetched > 0; end; finally PortableDev.Close; end; finally PortableDev := nil; end; end; {!! TIEPortableDevices.RefreshDevices Declaration function RefreshDevices() : Boolean; Description Forces a recheck for connected devices. The device list is filled automatically, but will not detect newly connected or disconnected devices. Calling RefreshDevices will force the list to be refreshed. Result is false if an error was detected. You can check for detail on the failure. Example // Refresh the list of devices procedure TfrmMain.RefreshDeviceList(); var I: Integer; begin lbxObjects.Items.Clear; if fPortableDevices.RefreshDevices = False then raise Exception.create( 'Unable to get devices: ' + fPortableDevices.LastError ); lbxDevices.Items.Clear; for I := 0 to fPortableDevices.DeviceCount - 1 do lbxDevices.Items.Add( fPortableDevices.Devices[ I ].ID ); end; !!} function TIEPortableDevices.RefreshDevices() : Boolean; var i, iResult: Integer; WPDManager: TPortableDeviceManager; iDeviceCount: LongWord; pDevices: array of PWideChar; sDeviceID : WideString; pIEDevice: PIEPortableDevice; bAddDevice: Boolean; begin Result := False; fLastError := ''; if not assigned( fDevices ) then begin fDevices := TList.Create; fObjects := TList.Create; end; Clear; fDevicesInitialized := True; fObjectsInitialized := False; try WPDManager := TPortableDeviceManager.Create( nil ); try iResult := WPDManager.RefreshDeviceList; if iResult <> S_OK then raise EIEException.create( format( 'Failed to refresh device list (%d)', [ iResult ] )); iDeviceCount := 1; iResult := WPDManager.GetDevices( PWideChar( nil^ ), iDeviceCount ); if iResult <> S_OK then raise EIEException.create( format( 'Failed to get device (%d)', [ iResult ] )); AddToLog( 'Device count: '+ IntToStr( iDeviceCount )); if iDeviceCount > 0 then begin SetLength( pDevices, iDeviceCount ); iResult := WPDManager.GetDevices( pDevices[ 0 ], iDeviceCount ); if iResult <> S_OK then raise EIEException.create( format( 'Failed to get device (%d)', [ iResult ] )); AddToLog( 'Enumerate devices' ); for i := 0 to iDeviceCount - 1 do begin sDeviceID := Trim( pDevices[ i ] ); AddToLog( 'Device ID: ' + sDeviceID ); bAddDevice := sDeviceID <> ''; if bAddDevice and fHideEmptyDevices then bAddDevice := DeviceContainsObjects( sDeviceID ); if bAddDevice then begin New( pIEDevice ); pIEDevice^.ID := sDeviceID; pIEDevice^.FriendlyName := GetDeviceFriendlyName( WPDManager, pDevices[ i ] ); AddToLog( 'FriendlyName: ' + pIEDevice^.FriendlyName ); pIEDevice^.Description := GetDeviceDescription ( WPDManager, pDevices[ i ] ); AddToLog( 'DeviceDescription: ' + pIEDevice^.Description ); pIEDevice^.Manufacturer := GetDeviceManufacturer( WPDManager, pDevices[ i ] ); AddToLog( 'DeviceManufacturer: ' + pIEDevice^.Manufacturer ); pIEDevice^.IsDrive := Pos( WideString(':\'), pIEDevice^.FriendlyName ) > 0; if pIEDevice^.FriendlyName = '' then pIEDevice^.FriendlyName := pIEDevice^.ID; fDevices.add( pIEDevice ); end; end; end; Result := True; finally WPDManager.Free; end; except on E: Exception do begin AddToLog( 'Exception: (' + e.Message + ')' ); fLastError := e.message; end; end; end; {!! TIEPortableDevices.ActiveDeviceID Declaration property ActiveDeviceID : WideString; (read/write) Description Returns the ID of the device that is currently being read. I.e. if you have called then ActiveDeviceID will be the Device ID that you passed. You can also specify a device ID to navigate to the root of that device. I.e. ActiveDeviceID := sDevice; Is the same as: NavigateToFolderPath( sDevice, '' ); Will return '' if no device is active. Example // Display the active device edtCurrentDevice.Text := IEPortableDevices.LookupDeviceFriendlyName( IEPortableDevices.ActiveDeviceID ); !!} procedure TIEPortableDevices.SetActiveDeviceID(const Value: WideString); begin if fActiveDeviceID <> Value then begin fActiveDeviceID := Value; fActiveFolderID := ''; fObjectsInitialized := False; end; end; {!! TIEPortableDevices.ActiveFolderID Declaration property ActiveFolderID : WideString; (read/write) Description Returns the ID of the folder that is currently being read (the source of ). I.e. if you have called then ActiveFolderID will be the Folder ID that you passed. You can also specify a folder ID to navigate to that folder on the active device. ActiveDeviceID := sFolderID; Is the same as: NavigateToFolderPath( ActiveDeviceID, sFolderID); If '' is returned then the active folder is the device root Example // Display the current folder edtCurrentFolder.Text := fPortableDevices.LookupItemFriendlyName( fPortableDevices.ActiveFolderID ); !!} // can be '' for root! procedure TIEPortableDevices.SetActiveFolderID(const Value: WideString); begin if fActiveFolderID <> Value then begin fActiveFolderID := Value; fObjectsInitialized := False; end; end; {!! TIEPortableDevices.CopyFileFromDevice Declaration function CopyFileFromDevice(const sDeviceID, sObjectID, sDestFilename: WideString): Boolean; 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. sFileID The ID of the file to copy (ID cannot point to a folder) sDestFilename The local filename to copy the file to
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; !!} function TIEPortableDevices.CopyFileFromDevice(const sDeviceID, sObjectID, sDestFilename: WideString): Boolean; var PortableDev: IPortableDevice; Content: IPortableDeviceContent; Resources: IPortableDeviceResources; iTransferSize, iReadBytes: Cardinal; PropKey: _WPDtagpropertykey; DevStream: IStream; FileStream: TFileStream; Buff: array[0..(1024-1)] of Byte; begin Result := False; fLastError := ''; try if ConnectToDevice( sDeviceID, PortableDev, fLastError, AddToLog ) = False then exit; try // Read content of device if PortableDev.Content( Content ) <> S_OK then exit; AddToLog( 'Content: Valid' ); if Content.Transfer( Resources ) = S_OK then begin iTransferSize := 0; PropKey.fmtid := WPD_RESOURCE_DEFAULT_FMTID; PropKey.pid := WPD_RESOURCE_DEFAULT_PID; // Request stream if Resources.GetStream( PWideChar( sObjectID ), PropKey, 0, iTransferSize, DevStream ) = S_OK then begin AddToLog( 'Stream: Valid' ); FileStream := TFileStream.Create( sDestFilename, fmCreate ); try //read source stream using buffer repeat DevStream.RemoteRead( Buff[ 0 ], 1024, iReadBytes ); if iReadBytes > 0 then FileStream.Write( Buff[ 0 ], iReadBytes ); until ( iReadBytes = 0 ); Result := True; finally FileStream.Free; end; end; end; finally DevStream := nil; PortableDev.Close; end; finally PortableDev := nil; end; end; {!! TIEPortableDevices.CopyStreamFromDevice Declaration function CopyStreamFromDevice(const sDeviceID, sObjectID: Widestring; var ssDestStream: TMemoryStream): Boolean; 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. sFileID The ID of the file to copy (ID cannot point to a folder) ssDestStream The stream that will be filled filename to copy the file to
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; !!} function TIEPortableDevices.CopyStreamFromDevice(const sDeviceID, sObjectID: Widestring; var ssDestStream: TMemoryStream): Boolean; var PortableDev: IPortableDevice; Content: IPortableDeviceContent; Resources: IPortableDeviceResources; iTransferSize, iReadBytes: Cardinal; PropKey: _WPDtagpropertykey; DevStream: IStream; Buff: array[0..(1024-1)] of Byte; begin Result := False; fLastError := ''; try if ConnectToDevice( sDeviceID, PortableDev, fLastError, AddToLog ) = False then exit; try // Read content of device if PortableDev.Content( Content ) <> S_OK then exit; AddToLog( 'Content: Valid' ); if Content.Transfer( Resources ) = S_OK then begin iTransferSize := 0; PropKey.fmtid := WPD_RESOURCE_DEFAULT_FMTID; PropKey.pid := WPD_RESOURCE_DEFAULT_PID; // Request stream if Resources.GetStream( PWideChar( sObjectID ), PropKey, 0, iTransferSize, DevStream ) = S_OK then begin AddToLog( 'Stream: Valid' ); if ssDestStream = nil then ssDestStream := TMemoryStream.Create; //read source stream using buffer repeat DevStream.RemoteRead( Buff[ 0 ], 1024, iReadBytes ); if iReadBytes > 0 then ssDestStream.Write( Buff[ 0 ], iReadBytes ); until ( iReadBytes = 0 ); ssDestStream.Position := 0; Result := True; end; end; finally DevStream := nil; PortableDev.Close; end; finally PortableDev := nil; end; end; {!! TIEPortableDevices.Cancel Declaration function Cancel(): Boolean; Description Abort any active processing on the current device. Example procedure TfrmMain.btnCancel(Sender: TObject); begin IEPortableDevices.Cancel(); end; !!} function TIEPortableDevices.Cancel(): Boolean; var PortableDev: IPortableDevice; begin Result := False; if fActiveDeviceID = '' then exit; try if ConnectToDevice( fActiveDeviceID, PortableDev, fLastError, AddToLog ) then try Result := PortableDev.Cancel() = S_OK; finally PortableDev.Close; end; finally PortableDev := nil; end; end; {!! TIEPortableDevices.CopyFileToDevice Declaration function CopyFileToDevice(const sDeviceID, sFolderID, sSourceFilename: WideString): Boolean; Description Copy a local file to a the folder of the specified sFolderID on a device. Parameter Description sDeviceID The ID of the device to copy to (e.g. sFolderID The ID of the folder to copy to (ID cannot point to a file) sSourceFilename The local filename to copy to the device
Note: Only files can be copied, not folders. Example // Prompt the user to specify a file to copy to the current folder procedure TfrmMain.btnCopyToDeviceClick(Sender: TObject); begin // No active folder (or root) if IEPortableDevices.ActiveFolderID = '' then exit; // Prompt for a file to copy if OpenDialog1.Execute = False then exit; // Copy to folder on device if IEPortableDevices.CopyFileToDevice( IEPortableDevices.ActiveDeviceID, IEPortableDevices.ActiveFolderID, OpenDialog1.FileName) then ShowMessage( 'File successfully copied to device' ) else ShowMessage( 'Failed to copy file to device!' ); end; !!} function TIEPortableDevices.CopyFileToDevice(const sDeviceID, sFolderID, sSourceFilename: WideString): Boolean; var PortableDev: IPortableDevice; Content: IPortableDeviceContent; iTransferSize, iReadBytes, iWritten: Cardinal; DevStream: IStream; PropValues: IPortableDeviceValues; FileStream: TFileStream; Buff: array[0..(1024-1)] of Byte; pCookie: PWideChar; iResult: Integer; PropKey: _WPDtagpropertykey; sFilename : WideString; begin Result := False; fLastError := ''; try if ConnectToDevice( sDeviceID, PortableDev, fLastError, AddToLog ) = False then exit; try // Read content of device if PortableDev.Content( Content ) <> S_OK then exit; // Required properties of content PropValues := CreateComObject( CLASS_PortableDeviceValues ) as IPortableDeviceValues; if VarIsClear( PropValues ) then Exit; AddToLog( 'Copying ' + sSourceFilename + ' to folder: '+sFolderID ); FileStream := TFileStream.Create( sSourceFilename, fmOpenRead ); try sFilename := ExtractFileName( sSourceFilename ); // Parent ID PropKey.fmtid := WPD_OBJECT_PARENT_ID_FMTID; PropKey.pid := WPD_OBJECT_PARENT_ID_PID; PropValues.SetStringValue( PropKey, PWideChar( sFolderID )); // Object name PropKey.fmtid := WPD_OBJECT_NAME_FMTID; PropKey.pid := WPD_OBJECT_NAME_PID; PropValues.SetStringValue( PropKey, PWideChar( sFilename )); // Filename PropKey.fmtid := WPD_OBJECT_ORIGINAL_FILE_NAME_FMTID; PropKey.pid := WPD_OBJECT_ORIGINAL_FILE_NAME_PID; PropValues.SetStringValue( PropKey, PWideChar( sFilename )); // Stream size PropKey.fmtid := WPD_OBJECT_SIZE_FMTID; PropKey.pid := WPD_OBJECT_SIZE_PID; PropValues.SetUnsignedLargeIntegerValue( PropKey, FileStream.Size ); // Create device stream iTransferSize := 0; Content.CreateObjectWithPropertiesAndData( PropValues, DevStream, iTransferSize, pCookie ); if VarIsClear( DevStream ) then Exit; AddToLog( 'Stream: Valid' ); // Read source stream using buffer. Transfer to device stream repeat iReadBytes := FileStream.Read( Buff[ 0 ], 1024 ); AddToLog( 'Bytes read: ' + IntToStr( iReadBytes )); if iReadBytes > 0 then begin iResult := DevStream.RemoteWrite( Buff[ 0 ], iReadBytes, iWritten ); if iResult <> S_OK then AddToLog( 'Write failure: ' + IntToStr( iResult )); end; until ( iReadBytes = 0 ); // Commit stream Result := DevStream.Commit( 0 ) = S_OK; if Result then AddToLog( 'File copied' ) else AddToLog( 'Commit failure!' ); finally FileStream.Free; end; finally DevStream := nil; PortableDev.Close; end; finally PortableDev := nil; end; end; {!! TIEPortableDevices.DeleteFromDevice Declaration function DeleteFromDevice(const sDeviceID, sObjectID : WideString; bDeleteSubObjects: Boolean = True): Integer; overload; function DeleteFromDevice(const sDeviceID, sObjectID : WideString; bDeleteSubObjects: Boolean; var sResultText: WideString): Integer; overload; function DeleteFromDevice(const sDeviceID : WideString; ssObjectIDs : TStrings; bDeleteSubObjects: Boolean = True): Integer; overload; function DeleteFromDevice(const sDeviceID : WideString; ssObjectIDs : TStrings; bDeleteSubObjects: Boolean; var sResultText: WideString): Integer; overload; Description Delete files or folders from a device. Parameter Description sDeviceID The ID of the device to delete from (e.g. sObjectID or ssObjectIDs The ID(s) of the file(s) or folder(s) to delete (e.g. bDeleteSubObjects If sObjectID is a folder, then enabling bDeleteSubObjects will also delete all objects in sub-folders sResultText Is filled with a response from the WPD API regarding the success or failure of the action (e.g. "1 file was successfully deleted)
Result is a count of the files deleted, or -1 if an error was encountered. Examples // Delete the current folder and all sub-folders IEPortableDevices.DeleteFromDevice( IEPortableDevices.ActiveDeviceID, IEPortableDevices.ActiveFolderID, True ); // Delete the selected file or folder procedure TfrmMain.btnDeleteFromDeviceClick(Sender: TObject); var sResultText: WideString; Idx: Integer; aObject: TIEWPDObject; begin if lbxObjects.ItemIndex < 0 then exit; Idx := fPortableDevices.ObjectIDToIndex( lbxObjects.Items[ lbxObjects.ItemIndex ] ); aObject := fPortableDevices.Objects[ Idx ]; if MessageDlg( 'Are you sure you want to delete the file: ' + aObject.Filename, mtConfirmation, [ mbYes, mbNo ], 0 ) = mrYes then begin ShowTempHourglass; // Note: bDeleteSubObjects is true, so if a folder is selected it will also delete any files in it if IEPortableDevices.DeleteFromDevice( IEPortableDevices.ActiveDeviceID, aObject.ID, True, sResultText ) > -1 then lbxObjects.Items.Delete( lbxObjects.ItemIndex ); ShowMessage( sResultText ); end; end; // Delete all displayed files procedure TfrmMain.btnDeleteAllClick(Sender: TObject); var sResultText: WideString; iCount: Integer; begin if lbxObjects.Items.Count = 0 then exit; if MessageDlg( format( 'Are you sure you want to delete the %d files in this folder?', [ lbxObjects.Items.Count ] ), mtConfirmation, [ mbYes, mbNo ], 0 ) = mrYes then begin ShowTempHourglass; iCount := IEPortableDevices.DeleteFromDevice( IEPortableDevices.ActiveDeviceID, lbxObjects.Items, True, sResultText ); if iCount = -1 then ShowMessage( sResultText ) else begin lbxObjects.Items.Clear; ShowMessage( format( '%d files were successfully deleted', [ iCount ] )); end; end; end; !!} function TIEPortableDevices.DeleteFromDevice(const sDeviceID : WideString; ssObjectIDs : TStrings; bDeleteSubObjects: Boolean; var sResultText: WideString): Integer; begin Result := _DeleteFromDevice( sDeviceID, '', ssObjectIDs, bDeleteSubObjects, sResultText, fLastError, AddToLog ); end; function TIEPortableDevices.DeleteFromDevice(const sDeviceID : WideString; ssObjectIDs : TStrings; bDeleteSubObjects: Boolean = True): Integer; var sResultText: WideString; begin Result := _DeleteFromDevice( sDeviceID, '', ssObjectIDs, bDeleteSubObjects, sResultText, fLastError, AddToLog ); end; function TIEPortableDevices.DeleteFromDevice(const sDeviceID, sObjectID : WideString; bDeleteSubObjects: Boolean = True): Integer; var sResultText: WideString; begin Result := _DeleteFromDevice( sDeviceID, sObjectID, nil, bDeleteSubObjects, sResultText, fLastError, AddToLog ); end; function TIEPortableDevices.DeleteFromDevice(const sDeviceID, sObjectID : WideString; bDeleteSubObjects: Boolean; var sResultText: WideString): Integer; begin Result := _DeleteFromDevice( sDeviceID, sObjectID, nil, bDeleteSubObjects, sResultText, fLastError, AddToLog ); end; // Convert a GUID value to TWPDObjectFormat function StrToObjectFormat(const sFormatID: WideString): TWPDObjectFormat; var g: TGuid; begin Result := _WPD_OBJECT_FORMAT_UNKNOWN; if sFormatID = '' then Exit; try g := StringToGUID( sFormatID ); if IsEqualGUID( WPD_OBJECT_FORMAT_3GP, g ) then Result := _WPD_OBJECT_FORMAT_3GP else if IsEqualGUID( WPD_OBJECT_FORMAT_AAC, g ) then Result := _WPD_OBJECT_FORMAT_AAC else if IsEqualGUID( WPD_OBJECT_FORMAT_ABSTRACT_CONTACT, g ) then Result := _WPD_OBJECT_FORMAT_ABSTRACT_CONTACT else if IsEqualGUID( WPD_OBJECT_FORMAT_ABSTRACT_CONTACT_GROUP, g ) then Result := _WPD_OBJECT_FORMAT_ABSTRACT_CONTACT_GROUP else if IsEqualGUID( WPD_OBJECT_FORMAT_ABSTRACT_MEDIA_CAST, g ) then Result := _WPD_OBJECT_FORMAT_ABSTRACT_MEDIA_CAST else if IsEqualGUID( WPD_OBJECT_FORMAT_AIFF, g ) then Result := _WPD_OBJECT_FORMAT_AIFF else if IsEqualGUID( WPD_OBJECT_FORMAT_ALL, g ) then Result := _WPD_OBJECT_FORMAT_ALL else if IsEqualGUID( WPD_OBJECT_FORMAT_ASF, g ) then Result := _WPD_OBJECT_FORMAT_ASF else if IsEqualGUID( WPD_OBJECT_FORMAT_ASXPLAYLIST, g ) then Result := _WPD_OBJECT_FORMAT_ASXPLAYLIST else if IsEqualGUID( WPD_OBJECT_FORMAT_AUDIBLE, g ) then Result := _WPD_OBJECT_FORMAT_AUDIBLE else if IsEqualGUID( WPD_OBJECT_FORMAT_AVI, g ) then Result := _WPD_OBJECT_FORMAT_AVI else if IsEqualGUID( WPD_OBJECT_FORMAT_BMP, g ) then Result := _WPD_OBJECT_FORMAT_BMP else if IsEqualGUID( WPD_OBJECT_FORMAT_CIFF, g ) then Result := _WPD_OBJECT_FORMAT_CIFF else if IsEqualGUID( WPD_OBJECT_FORMAT_DPOF, g ) then Result := _WPD_OBJECT_FORMAT_DPOF else if IsEqualGUID( WPD_OBJECT_FORMAT_EXECUTABLE, g ) then Result := _WPD_OBJECT_FORMAT_EXECUTABLE else if IsEqualGUID( WPD_OBJECT_FORMAT_EXIF, g ) then Result := _WPD_OBJECT_FORMAT_EXIF else if IsEqualGUID( WPD_OBJECT_FORMAT_FLAC, g ) then Result := _WPD_OBJECT_FORMAT_FLAC else if IsEqualGUID( WPD_OBJECT_FORMAT_FLASHPIX, g ) then Result := _WPD_OBJECT_FORMAT_FLASHPIX else if IsEqualGUID( WPD_OBJECT_FORMAT_GIF, g ) then Result := _WPD_OBJECT_FORMAT_GIF else if IsEqualGUID( WPD_OBJECT_FORMAT_HTML, g ) then Result := _WPD_OBJECT_FORMAT_HTML else if IsEqualGUID( WPD_OBJECT_FORMAT_ICALENDAR, g ) then Result := _WPD_OBJECT_FORMAT_ICALENDAR else if IsEqualGUID( WPD_OBJECT_FORMAT_ICON, g ) then Result := _WPD_OBJECT_FORMAT_ICON else if IsEqualGUID( WPD_OBJECT_FORMAT_JFIF, g ) then Result := _WPD_OBJECT_FORMAT_JFIF else if IsEqualGUID( WPD_OBJECT_FORMAT_JP2, g ) then Result := _WPD_OBJECT_FORMAT_JP2 else if IsEqualGUID( WPD_OBJECT_FORMAT_JPX, g ) then Result := _WPD_OBJECT_FORMAT_JPX else if IsEqualGUID( WPD_OBJECT_FORMAT_M3UPLAYLIST, g ) then Result := _WPD_OBJECT_FORMAT_M3UPLAYLIST else if IsEqualGUID( WPD_OBJECT_FORMAT_M4A, g ) then Result := _WPD_OBJECT_FORMAT_M4A else if IsEqualGUID( WPD_OBJECT_FORMAT_MHT_COMPILED_HTML, g ) then Result := _WPD_OBJECT_FORMAT_MHT_COMPILED_HTML else if IsEqualGUID( WPD_OBJECT_FORMAT_MICROSOFT_EXCEL, g ) then Result := _WPD_OBJECT_FORMAT_MICROSOFT_EXCEL else if IsEqualGUID( WPD_OBJECT_FORMAT_MICROSOFT_POWERPOINT, g ) then Result := _WPD_OBJECT_FORMAT_MICROSOFT_POWERPOINT else if IsEqualGUID( WPD_OBJECT_FORMAT_MICROSOFT_WFC, g ) then Result := _WPD_OBJECT_FORMAT_MICROSOFT_WFC else if IsEqualGUID( WPD_OBJECT_FORMAT_MICROSOFT_WORD, g ) then Result := _WPD_OBJECT_FORMAT_MICROSOFT_WORD else if IsEqualGUID( WPD_OBJECT_FORMAT_MP2, g ) then Result := _WPD_OBJECT_FORMAT_MP2 else if IsEqualGUID( WPD_OBJECT_FORMAT_MP3, g ) then Result := _WPD_OBJECT_FORMAT_MP3 else if IsEqualGUID( WPD_OBJECT_FORMAT_MP4, g ) then Result := _WPD_OBJECT_FORMAT_MP4 else if IsEqualGUID( WPD_OBJECT_FORMAT_MPEG, g ) then Result := _WPD_OBJECT_FORMAT_MPEG else if IsEqualGUID( WPD_OBJECT_FORMAT_MPLPLAYLIST, g ) then Result := _WPD_OBJECT_FORMAT_MPLPLAYLIST else if IsEqualGUID( WPD_OBJECT_FORMAT_NETWORK_ASSOCIATION, g ) then Result := _WPD_OBJECT_FORMAT_NETWORK_ASSOCIATION else if IsEqualGUID( WPD_OBJECT_FORMAT_OGG, g ) then Result := _WPD_OBJECT_FORMAT_OGG else if IsEqualGUID( WPD_OBJECT_FORMAT_PCD, g ) then Result := _WPD_OBJECT_FORMAT_PCD else if IsEqualGUID( WPD_OBJECT_FORMAT_PICT, g ) then Result := _WPD_OBJECT_FORMAT_PICT else if IsEqualGUID( WPD_OBJECT_FORMAT_PLSPLAYLIST, g ) then Result := _WPD_OBJECT_FORMAT_PLSPLAYLIST else if IsEqualGUID( WPD_OBJECT_FORMAT_PNG, g ) then Result := _WPD_OBJECT_FORMAT_PNG else if IsEqualGUID( WPD_OBJECT_FORMAT_PROPERTIES_ONLY, g ) then Result := _WPD_OBJECT_FORMAT_PROPERTIES_ONLY else if IsEqualGUID( WPD_OBJECT_FORMAT_SCRIPT, g ) then Result := _WPD_OBJECT_FORMAT_SCRIPT else if IsEqualGUID( WPD_OBJECT_FORMAT_TEXT, g ) then Result := _WPD_OBJECT_FORMAT_TEXT else if IsEqualGUID( WPD_OBJECT_FORMAT_TIFF, g ) then Result := _WPD_OBJECT_FORMAT_TIFF else if IsEqualGUID( WPD_OBJECT_FORMAT_TIFFEP, g ) then Result := _WPD_OBJECT_FORMAT_TIFFEP else if IsEqualGUID( WPD_OBJECT_FORMAT_TIFFIT, g ) then Result := _WPD_OBJECT_FORMAT_TIFFIT else if IsEqualGUID( WPD_OBJECT_FORMAT_UNSPECIFIED, g ) then Result := _WPD_OBJECT_FORMAT_UNSPECIFIED else if IsEqualGUID( WPD_OBJECT_FORMAT_VCALENDAR1, g ) then Result := _WPD_OBJECT_FORMAT_VCALENDAR1 else if IsEqualGUID( WPD_OBJECT_FORMAT_VCARD2, g ) then Result := _WPD_OBJECT_FORMAT_VCARD2 else if IsEqualGUID( WPD_OBJECT_FORMAT_VCARD3, g ) then Result := _WPD_OBJECT_FORMAT_VCARD3 else if IsEqualGUID( WPD_OBJECT_FORMAT_WAVE, g ) then Result := _WPD_OBJECT_FORMAT_WAVE else if IsEqualGUID( WPD_OBJECT_FORMAT_WINDOWSIMAGEFORMAT, g ) then Result := _WPD_OBJECT_FORMAT_WINDOWSIMAGEFORMAT else if IsEqualGUID( WPD_OBJECT_FORMAT_WMA, g ) then Result := _WPD_OBJECT_FORMAT_WMA else if IsEqualGUID( WPD_OBJECT_FORMAT_WMV, g ) then Result := _WPD_OBJECT_FORMAT_WMV else if IsEqualGUID( WPD_OBJECT_FORMAT_WPLPLAYLIST, g ) then Result := _WPD_OBJECT_FORMAT_WPLPLAYLIST else if IsEqualGUID( WPD_OBJECT_FORMAT_X509V3CERTIFICATE, g ) then Result := _WPD_OBJECT_FORMAT_X509V3CERTIFICATE else if IsEqualGUID( WPD_OBJECT_FORMAT_XML, g ) then Result := _WPD_OBJECT_FORMAT_XML else if IsEqualGUID( WPD_OBJECT_FORMAT_WMV, g ) then Result := _WPD_OBJECT_FORMAT_WMV except // ERROR end; end; // Convert a GUID value to TWPDContentType function StrToContentType(const sContentID : WideString): TWPDContentType; var g: TGuid; begin Result := _WPD_CONTENT_TYPE_UNKNOWN; if sContentID = '' then Exit; try g := StringToGUID( sContentID ); if IsEqualGUID( WPD_CONTENT_TYPE_ALL, g ) then Result := _WPD_CONTENT_TYPE_ALL else if IsEqualGUID( WPD_CONTENT_TYPE_APPOINTMENT, g ) then Result := _WPD_CONTENT_TYPE_APPOINTMENT else if IsEqualGUID( WPD_CONTENT_TYPE_AUDIO, g ) then Result := _WPD_CONTENT_TYPE_AUDIO else if IsEqualGUID( WPD_CONTENT_TYPE_AUDIO_ALBUM, g ) then Result := _WPD_CONTENT_TYPE_AUDIO_ALBUM else if IsEqualGUID( WPD_CONTENT_TYPE_CALENDAR, g ) then Result := _WPD_CONTENT_TYPE_CALENDAR else if IsEqualGUID( WPD_CONTENT_TYPE_CERTIFICATE, g ) then Result := _WPD_CONTENT_TYPE_CERTIFICATE else if IsEqualGUID( WPD_CONTENT_TYPE_CONTACT, g ) then Result := _WPD_CONTENT_TYPE_CONTACT else if IsEqualGUID( WPD_CONTENT_TYPE_CONTACT_GROUP, g ) then Result := _WPD_CONTENT_TYPE_CONTACT_GROUP else if IsEqualGUID( WPD_CONTENT_TYPE_DOCUMENT, g ) then Result := _WPD_CONTENT_TYPE_DOCUMENT else if IsEqualGUID( WPD_CONTENT_TYPE_EMAIL, g ) then Result := _WPD_CONTENT_TYPE_EMAIL else if IsEqualGUID( WPD_CONTENT_TYPE_FUNCTIONAL_OBJECT, g ) then Result := _WPD_CONTENT_TYPE_FUNCTIONAL_OBJECT else if IsEqualGUID( WPD_CONTENT_TYPE_GENERIC_FILE, g ) then Result := _WPD_CONTENT_TYPE_GENERIC_FILE else if IsEqualGUID( WPD_CONTENT_TYPE_GENERIC_MESSAGE, g ) then Result := _WPD_CONTENT_TYPE_GENERIC_MESSAGE else if IsEqualGUID( WPD_CONTENT_TYPE_IMAGE, g ) then Result := _WPD_CONTENT_TYPE_IMAGE else if IsEqualGUID( WPD_CONTENT_TYPE_IMAGE_ALBUM, g ) then Result := _WPD_CONTENT_TYPE_IMAGE_ALBUM else if IsEqualGUID( WPD_CONTENT_TYPE_MEDIA_CAST, g ) then Result := _WPD_CONTENT_TYPE_MEDIA_CAST else if IsEqualGUID( WPD_CONTENT_TYPE_MEMO, g ) then Result := _WPD_CONTENT_TYPE_MEMO else if IsEqualGUID( WPD_CONTENT_TYPE_MIXED_CONTENT_ALBUM, g ) then Result := _WPD_CONTENT_TYPE_MIXED_CONTENT_ALBUM else if IsEqualGUID( WPD_CONTENT_TYPE_NETWORK_ASSOCIATION, g ) then Result := _WPD_CONTENT_TYPE_NETWORK_ASSOCIATION else if IsEqualGUID( WPD_CONTENT_TYPE_PLAYLIST, g ) then Result := _WPD_CONTENT_TYPE_PLAYLIST else if IsEqualGUID( WPD_CONTENT_TYPE_PROGRAM, g ) then Result := _WPD_CONTENT_TYPE_PROGRAM else if IsEqualGUID( WPD_CONTENT_TYPE_SECTION, g ) then Result := _WPD_CONTENT_TYPE_SECTION else if IsEqualGUID( WPD_CONTENT_TYPE_TASK, g ) then Result := _WPD_CONTENT_TYPE_TASK else if IsEqualGUID( WPD_CONTENT_TYPE_TELEVISION, g ) then Result := _WPD_CONTENT_TYPE_TELEVISION else if IsEqualGUID( WPD_CONTENT_TYPE_UNSPECIFIED, g ) then Result := _WPD_CONTENT_TYPE_UNSPECIFIED else if IsEqualGUID( WPD_CONTENT_TYPE_VIDEO, g ) then Result := _WPD_CONTENT_TYPE_VIDEO else if IsEqualGUID( WPD_CONTENT_TYPE_VIDEO_ALBUM, g ) then Result := _WPD_CONTENT_TYPE_VIDEO_ALBUM else if IsEqualGUID( WPD_CONTENT_TYPE_WIRELESS_PROFILE, g ) then Result := _WPD_CONTENT_TYPE_WIRELESS_PROFILE else if IsEqualGUID( WPD_CONTENT_TYPE_FOLDER, g ) then Result := _WPD_CONTENT_TYPE_FOLDER; except // ERROR end; end; {!! TIEPortableDevices.GetObjectAdvancedProps Declaration function GetObjectAdvancedProps(const sDeviceID, sObjectID: WideString; out DestProps : ): Boolean; overload; function GetObjectAdvancedProps(const sObjectID: WideString; out DestProps : ): Boolean; overload; function GetObjectAdvancedProps(Index: Integer; out DestProps : ): Boolean; overload; Description Returns more detail about an object on the device, such as its size, date, etc. You can specify either the ID of an object on the active device or its index in the list. Result is false if retrieval of details failed. Example procedure TfrmMain.btnShowObjectPropsClick(Sender: TObject); var aProps: TIEWPDObjectAdvancedProps; begin if IEPortableDevices.GetObjectAdvancedProps( SelectedObjectID, aProps ) = False then raise Exception.create( 'Cannot access object properties' ); memInfo.Clear;; memInfo.Lines.Add( 'WPD_OBJECT_ID: ' + aProps.ObjectID ); memInfo.Lines.Add( 'WPD_OBJECT_PARENT_ID: ' + aProps.ParentID ); memInfo.Lines.Add( 'WPD_OBJECT_NAME: ' + aProps.ObjectName ); memInfo.Lines.Add( 'WPD_OBJECT_PERSISTENT_UNIQUE_ID: ' + aProps.PersistentUniqueID ); memInfo.Lines.Add( 'WPD_OBJECT_FORMAT: '+ IntToStr( ord( aProps.ObjectFormat ))); memInfo.Lines.Add( 'WPD_OBJECT_CONTENT_TYPE: '+ IntToStr( ord( aProps.ContentType ))); memInfo.Lines.Add( 'WPD_OBJECT_ISHIDDEN: ' + BoolToStr( aProps.IsHidden )); memInfo.Lines.Add( 'WPD_OBJECT_ISSYSTEM: ' + BoolToStr( aProps.IsSystem )); memInfo.Lines.Add( 'WPD_OBJECT_DATE_CREATED: ' + DateTimeToStr( aProps.DateCreated )); memInfo.Lines.Add( 'WPD_OBJECT_DATE_MODIFIED: ' + DateTimeToStr( aProps.DateModified )); end; !!} function TIEPortableDevices.GetObjectAdvancedProps(const sDeviceID, sObjectID: WideString; out DestProps : TIEWPDObjectAdvancedProps): Boolean; var PropKeys: IPortableDeviceKeyCollection; PropValues: IPortableDeviceValues; procedure _AddProperty(fmtid: TGUID; pid: LongWord); var PropKey: _WPDtagpropertykey; begin PropKey.fmtid := fmtid; PropKey.pid := pid; propKeys.Add( PropKey ); end; function _GetStringValue(fmtid: TGUID; pid: LongWord) : PWideChar; var PropKey: _WPDtagpropertykey; begin PropKey.fmtid := fmtid; PropKey.pid := pid; PropValues.GetStringValue( PropKey, Result ); end; function _GetBoolValue(fmtid: TGUID; pid: LongWord) : Boolean; var PropKey: _WPDtagpropertykey; iBool: Integer; begin PropKey.fmtid := fmtid; PropKey.pid := pid; PropValues.GetBoolValue( PropKey, iBool ); Result := iBool > 0; end; function _GetDateTimeValue(fmtid: TGUID; pid: LongWord) : TDateTime; var PropKey: _WPDtagpropertykey; aValue: tag_inner_PROPVARIANT; begin PropKey.fmtid := fmtid; PropKey.pid := pid; PropValues.GetValue( PropKey, aValue ); Result := aValue.AsVariant.date; end; function _GetUnsignedLargeIntegerValue(fmtid: TGUID; pid: LongWord) : Largeuint; var PropKey: _WPDtagpropertykey; pValue: Largeuint; begin PropKey.fmtid := fmtid; PropKey.pid := pid; PropValues.GetUnsignedLargeIntegerValue( PropKey, pValue ); Result := pValue; end; var PortableDev: IPortableDevice; Content: IPortableDeviceContent; Prop: IPortableDeviceProperties; begin Result := False; if sDeviceID = '' then exit; try if ConnectToDevice( sDeviceID, PortableDev, fLastError, AddToLog ) = False then exit; try // Read content of device if ( PortableDev.Content( Content ) <> S_OK ) or VarIsClear( Content ) then exit; Content.Properties( Prop ); if VarIsClear( prop ) then exit; PropKeys := CreateComObject( CLSID_PortableDeviceKeyCollection ) as IPortableDeviceKeyCollection; if VarIsClear( PropKeys ) then Exit; // Add each property we are interested in _AddProperty( WPD_OBJECT_PARENT_ID_FMTID, WPD_OBJECT_PARENT_ID_PID ); _AddProperty( WPD_OBJECT_NAME_FMTID, WPD_OBJECT_NAME_PID ); _AddProperty( WPD_OBJECT_ORIGINAL_FILE_NAME_FMTID, WPD_OBJECT_ORIGINAL_FILE_NAME_PID ); _AddProperty( WPD_OBJECT_PERSISTENT_UNIQUE_ID_FMTID, WPD_OBJECT_PERSISTENT_UNIQUE_ID_PID ); _AddProperty( WPD_OBJECT_FORMAT_FMTID, WPD_OBJECT_FORMAT_PID ); _AddProperty( WPD_OBJECT_CONTENT_TYPE_FMTID, WPD_OBJECT_CONTENT_TYPE_PID ); _AddProperty( WPD_OBJECT_ISHIDDEN_FMTID, WPD_OBJECT_ISHIDDEN_PID ); _AddProperty( WPD_OBJECT_ISSYSTEM_FMTID, WPD_OBJECT_ISSYSTEM_PID ); _AddProperty( WPD_OBJECT_DATE_CREATED_FMTID, WPD_OBJECT_DATE_CREATED_PID ); _AddProperty( WPD_OBJECT_DATE_MODIFIED_FMTID, WPD_OBJECT_DATE_MODIFIED_PID ); _AddProperty( WPD_OBJECT_SIZE_FMTID, WPD_OBJECT_SIZE_PID ); prop.GetValues( PWideChar( sObjectID ), propKeys, PropValues ); if VarIsClear( PropValues ) then exit; DestProps.ObjectID := sObjectID; DestProps.ParentID := _GetStringValue( WPD_OBJECT_PARENT_ID_FMTID, WPD_OBJECT_PARENT_ID_PID ); DestProps.FriendlyName := _GetStringValue( WPD_OBJECT_NAME_FMTID, WPD_OBJECT_NAME_PID ); DestProps.Filename := _GetStringValue( WPD_OBJECT_ORIGINAL_FILE_NAME_FMTID, WPD_OBJECT_ORIGINAL_FILE_NAME_PID ); DestProps.PersistentUniqueID := _GetStringValue( WPD_OBJECT_PERSISTENT_UNIQUE_ID_FMTID, WPD_OBJECT_PERSISTENT_UNIQUE_ID_PID ); DestProps.ObjectFormat := StrToObjectFormat( _GetStringValue( WPD_OBJECT_FORMAT_FMTID, WPD_OBJECT_FORMAT_PID )); DestProps.ContentType := StrToContentType( _GetStringValue( WPD_OBJECT_CONTENT_TYPE_FMTID, WPD_OBJECT_CONTENT_TYPE_PID )); DestProps.IsHidden := _GetBoolValue( WPD_OBJECT_ISHIDDEN_FMTID, WPD_OBJECT_ISHIDDEN_PID ); DestProps.IsSystem := _GetBoolValue( WPD_OBJECT_ISSYSTEM_FMTID, WPD_OBJECT_ISSYSTEM_PID ); DestProps.DateCreated := _GetDateTimeValue( WPD_OBJECT_DATE_CREATED_FMTID, WPD_OBJECT_DATE_CREATED_PID ); DestProps.DateModified := _GetDateTimeValue( WPD_OBJECT_DATE_MODIFIED_FMTID, WPD_OBJECT_DATE_MODIFIED_PID ); DestProps.SizeBytes := _GetUnsignedLargeIntegerValue( WPD_OBJECT_DATE_MODIFIED_FMTID, WPD_OBJECT_DATE_MODIFIED_PID ); result := True; finally PortableDev.Close; end; finally PortableDev := nil; end; end; function TIEPortableDevices.GetObjectAdvancedProps(const sObjectID: WideString; out DestProps : TIEWPDObjectAdvancedProps): Boolean; begin Result := GetObjectAdvancedProps( fActiveDeviceID, sObjectID, DestProps ); end; function TIEPortableDevices.GetObjectAdvancedProps(Index: Integer; out DestProps: TIEWPDObjectAdvancedProps): Boolean; begin CheckObjectsInitialized; Result := GetObjectAdvancedProps( fActiveDeviceID, Objects[ Index ].ID, DestProps ); end; {!! TIEPortableDevices.LookupObjectFriendlyName Declaration function LookupObjectFriendlyName(const sObjectID : WideString): WideString; overload; function LookupObjectFriendlyName(const sDeviceID, sObjectID : WideString): WideString; overload; Description Returns the friendly name for a file or folder on a device. Same as TIEWPDObject.FriendlyName. If sDeviceID is not specified it assumes the active device. Example // Display the current folder name edtCurrentFolder.Text := IEPortableDevices.LookupObjectFriendlyName( IEPortableDevices.ActiveDeviceID, IEPortableDevices.ActiveFolderID ); !!} function TIEPortableDevices.LookupObjectFriendlyName(const sDeviceID, sObjectID : WideString): WideString; var PropKeys: IPortableDeviceKeyCollection; PropValues: IPortableDeviceValues; PropKey: _WPDtagpropertykey; PortableDev: IPortableDevice; Content: IPortableDeviceContent; Prop: IPortableDeviceProperties; pValue: PWideChar; begin Result := ''; if sDeviceID <> '' then fActiveDeviceID := sDeviceID; if fActiveDeviceID = '' then exit; try if ConnectToDevice( fActiveDeviceID, PortableDev, fLastError, AddToLog ) = False then exit; try // Read content of device if ( PortableDev.Content( Content ) <> S_OK ) or VarIsClear( Content ) then exit; Content.Properties( Prop ); if VarIsClear( prop ) then exit; PropKeys := CreateComObject( CLSID_PortableDeviceKeyCollection ) as IPortableDeviceKeyCollection; if VarIsClear( PropKeys ) then Exit; PropKey.fmtid := WPD_OBJECT_NAME_FMTID; PropKey.pid := WPD_OBJECT_NAME_PID; propKeys.Add( PropKey ); prop.GetValues( PWideChar( sObjectID ), propKeys, PropValues ); if VarIsClear( PropValues ) = False then begin PropKey.fmtid := WPD_OBJECT_NAME_FMTID; PropKey.pid := WPD_OBJECT_NAME_PID; PropValues.GetStringValue( PropKey, pValue ); Result := pValue; end; finally PortableDev.Close; end; finally PortableDev := nil; end; end; function TIEPortableDevices.LookupObjectFriendlyName(const sObjectID : WideString): WideString; begin Result := LookupObjectFriendlyName( '', sObjectID ); end; {!! TIEPortableDevices.LookupDeviceFriendlyName Declaration function LookupDeviceFriendlyName(const sDeviceID : WideString): WideString; Description Returns the friendly name for a device. The same result could be achieved using: sFriendlyName := Devices[ DeviceIDToIndex( sDeviceID ) ].FriendlyName; Example // Custom drawing of a listbox that contains Device IDs procedure TfrmMain.lbxDevicesDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); var sDeviceID: WideString; begin sDeviceID := lbxDevices.Items[ Index ]; IEDrawComboListBoxItem(TListBox(Control ), Rect, fPortableDevices.LookUpDeviceFriendlyName( sDeviceID ), imlGlyphs, IMG_DEVICE ); end; !!} function TIEPortableDevices.LookupDeviceFriendlyName(const sDeviceID : WideString): WideString; var Idx: Integer; begin Result := ''; Idx := DeviceIDToIndex( sDeviceID ); if Idx >= 0 then Result := Devices[ Idx ].FriendlyName; end; {$IFDEF DEBUG} // Converts a GUID to a description function FunctionalCategoryToStr(const sCategoryID: WideString): WideString; var g: TGuid; begin Result := sCategoryID; if sCategoryID = '' then Exit; try g := StringToGUID( sCategoryID ); if IsEqualGUID( WPD_FUNCTIONAL_CATEGORY_ALL, g ) then Result := 'WPD_FUNCTIONAL_CATEGORY_ALL' else if IsEqualGUID( WPD_FUNCTIONAL_CATEGORY_AUDIO_CAPTURE, g ) then Result := 'WPD_FUNCTIONAL_CATEGORY_AUDIO_CAPTURE' else if IsEqualGUID( WPD_FUNCTIONAL_CATEGORY_DEVICE, g ) then Result := 'WPD_FUNCTIONAL_CATEGORY_DEVICE' else if IsEqualGUID( WPD_FUNCTIONAL_CATEGORY_NETWORK_CONFIGURATION, g ) then Result := 'WPD_FUNCTIONAL_CATEGORY_NETWORK_CONFIGURATION' else if IsEqualGUID( WPD_FUNCTIONAL_CATEGORY_RENDERING_INFORMATION, g ) then Result := 'WPD_FUNCTIONAL_CATEGORY_RENDERING_INFORMATION' else if IsEqualGUID( WPD_FUNCTIONAL_CATEGORY_SMS, g ) then Result := 'WPD_FUNCTIONAL_CATEGORY_SMS' else if IsEqualGUID( WPD_FUNCTIONAL_CATEGORY_STILL_IMAGE_CAPTURE, g ) then Result := 'WPD_FUNCTIONAL_CATEGORY_STILL_IMAGE_CAPTURE' else if IsEqualGUID( WPD_FUNCTIONAL_CATEGORY_STORAGE, g ) then Result := 'WPD_FUNCTIONAL_CATEGORY_STORAGE' else if IsEqualGUID( WPD_FUNCTIONAL_CATEGORY_VIDEO_CAPTURE, g ) then Result := 'WPD_FUNCTIONAL_CATEGORY_VIDEO_CAPTURE'; except // ERROR end; end; {$ENDIF} {$IFDEF DEBUG} // Converts a GUID to a description function SupportedCommandToStr(g: TGuid): WideString; begin Result := GUIDToString( g ); try if IsEqualGUID( WPD_CATEGORY_COMMON, g ) then Result := 'WPD_CATEGORY_COMMON' else if IsEqualGUID( WPD_CATEGORY_CAPABILITIES, g ) then Result := 'WPD_CATEGORY_CAPABILITIES' else if IsEqualGUID( WPD_CATEGORY_DEVICE_HINTS, g ) then Result := 'WPD_CATEGORY_DEVICE_HINTS' else if IsEqualGUID( WPD_CATEGORY_MEDIA_CAPTURE, g ) then Result := 'WPD_CATEGORY_MEDIA_CAPTURE' else if IsEqualGUID( WPD_CATEGORY_NETWORK_CONFIGURATION, g ) then Result := 'WPD_CATEGORY_NETWORK_CONFIGURATION' else if IsEqualGUID( WPD_CATEGORY_NULL, g ) then Result := 'WPD_CATEGORY_NULL' else if IsEqualGUID( WPD_CATEGORY_OBJECT_ENUMERATION, g ) then Result := 'WPD_CATEGORY_OBJECT_ENUMERATION' else if IsEqualGUID( WPD_CATEGORY_OBJECT_MANAGEMENT, g ) then Result := 'WPD_CATEGORY_OBJECT_MANAGEMENT' else if IsEqualGUID( WPD_CATEGORY_OBJECT_PROPERTIES, g ) then Result := 'WPD_CATEGORY_OBJECT_PROPERTIES' else if IsEqualGUID( WPD_CATEGORY_OBJECT_PROPERTIES_BULK, g ) then Result := 'WPD_CATEGORY_OBJECT_PROPERTIES_BULK' else if IsEqualGUID( WPD_CATEGORY_OBJECT_RESOURCES, g ) then Result := 'WPD_CATEGORY_OBJECT_RESOURCES' else if IsEqualGUID( WPD_CATEGORY_SERVICE_CAPABILITIES, g ) then Result := 'WPD_CATEGORY_SERVICE_CAPABILITIES' else if IsEqualGUID( WPD_CATEGORY_SERVICE_COMMON, g ) then Result := 'WPD_CATEGORY_SERVICE_COMMON' else if IsEqualGUID( WPD_CATEGORY_SERVICE_METHODS, g ) then Result := 'WPD_CATEGORY_SERVICE_METHODS' else if IsEqualGUID( WPD_CATEGORY_SMS, g ) then Result := 'WPD_CATEGORY_SMS' else if IsEqualGUID( WPD_CATEGORY_STILL_IMAGE_CAPTURE, g ) then Result := 'WPD_CATEGORY_STILL_IMAGE_CAPTURE' else if IsEqualGUID( WPD_CATEGORY_STORAGE, g ) then Result := 'WPD_CATEGORY_STORAGE'; except // ERROR end; end; {$ENDIF} {$IFDEF DEBUG} // Converts a GUID to a description function ContentTypeToStr(const sContentID : WideString): WideString; var g: TGuid; begin Result := sContentID; if sContentID = '' then Exit; try g := StringToGUID( sContentID ); if IsEqualGUID( WPD_CONTENT_TYPE_ALL, g ) then Result := 'WPD_CONTENT_TYPE_ALL' else if IsEqualGUID( WPD_CONTENT_TYPE_APPOINTMENT, g ) then Result := 'WPD_CONTENT_TYPE_APPOINTMENT' else if IsEqualGUID( WPD_CONTENT_TYPE_AUDIO, g ) then Result := 'WPD_CONTENT_TYPE_AUDIO' else if IsEqualGUID( WPD_CONTENT_TYPE_AUDIO_ALBUM, g ) then Result := 'WPD_CONTENT_TYPE_AUDIO_ALBUM' else if IsEqualGUID( WPD_CONTENT_TYPE_CALENDAR, g ) then Result := 'WPD_CONTENT_TYPE_CALENDAR' else if IsEqualGUID( WPD_CONTENT_TYPE_CERTIFICATE, g ) then Result := 'WPD_CONTENT_TYPE_CERTIFICATE' else if IsEqualGUID( WPD_CONTENT_TYPE_CONTACT, g ) then Result := 'WPD_CONTENT_TYPE_CONTACT' else if IsEqualGUID( WPD_CONTENT_TYPE_CONTACT_GROUP, g ) then Result := 'WPD_CONTENT_TYPE_CONTACT_GROUP' else if IsEqualGUID( WPD_CONTENT_TYPE_DOCUMENT, g ) then Result := 'WPD_CONTENT_TYPE_DOCUMENT' else if IsEqualGUID( WPD_CONTENT_TYPE_EMAIL, g ) then Result := 'WPD_CONTENT_TYPE_EMAIL' else if IsEqualGUID( WPD_CONTENT_TYPE_FUNCTIONAL_OBJECT, g ) then Result := 'WPD_CONTENT_TYPE_FUNCTIONAL_OBJECT' else if IsEqualGUID( WPD_CONTENT_TYPE_GENERIC_FILE, g ) then Result := 'WPD_CONTENT_TYPE_GENERIC_FILE' else if IsEqualGUID( WPD_CONTENT_TYPE_GENERIC_MESSAGE, g ) then Result := 'WPD_CONTENT_TYPE_GENERIC_MESSAGE' else if IsEqualGUID( WPD_CONTENT_TYPE_IMAGE, g ) then Result := 'WPD_CONTENT_TYPE_IMAGE' else if IsEqualGUID( WPD_CONTENT_TYPE_IMAGE_ALBUM, g ) then Result := 'WPD_CONTENT_TYPE_IMAGE_ALBUM' else if IsEqualGUID( WPD_CONTENT_TYPE_MEDIA_CAST, g ) then Result := 'WPD_CONTENT_TYPE_MEDIA_CAST' else if IsEqualGUID( WPD_CONTENT_TYPE_MEMO, g ) then Result := 'WPD_CONTENT_TYPE_MEMO' else if IsEqualGUID( WPD_CONTENT_TYPE_MIXED_CONTENT_ALBUM, g ) then Result := 'WPD_CONTENT_TYPE_MIXED_CONTENT_ALBUM' else if IsEqualGUID( WPD_CONTENT_TYPE_NETWORK_ASSOCIATION, g ) then Result := 'WPD_CONTENT_TYPE_NETWORK_ASSOCIATION' else if IsEqualGUID( WPD_CONTENT_TYPE_PLAYLIST, g ) then Result := 'WPD_CONTENT_TYPE_PLAYLIST' else if IsEqualGUID( WPD_CONTENT_TYPE_PROGRAM, g ) then Result := 'WPD_CONTENT_TYPE_PROGRAM' else if IsEqualGUID( WPD_CONTENT_TYPE_SECTION, g ) then Result := 'WPD_CONTENT_TYPE_SECTION' else if IsEqualGUID( WPD_CONTENT_TYPE_TASK, g ) then Result := 'WPD_CONTENT_TYPE_TASK' else if IsEqualGUID( WPD_CONTENT_TYPE_TELEVISION, g ) then Result := 'WPD_CONTENT_TYPE_TELEVISION' else if IsEqualGUID( WPD_CONTENT_TYPE_UNSPECIFIED, g ) then Result := 'WPD_CONTENT_TYPE_UNSPECIFIED' else if IsEqualGUID( WPD_CONTENT_TYPE_VIDEO, g ) then Result := 'WPD_CONTENT_TYPE_VIDEO' else if IsEqualGUID( WPD_CONTENT_TYPE_VIDEO_ALBUM, g ) then Result := 'WPD_CONTENT_TYPE_VIDEO_ALBUM' else if IsEqualGUID( WPD_CONTENT_TYPE_WIRELESS_PROFILE, g ) then Result := 'WPD_CONTENT_TYPE_WIRELESS_PROFILE' else if IsEqualGUID( WPD_CONTENT_TYPE_FOLDER, g ) then Result := 'WPD_CONTENT_TYPE_FOLDER'; except // ERROR end; end; {$ENDIF} {$IFDEF DEBUG} // Return a comma separated list of content types function GetContentTypes(Capabilities: IPortableDeviceCapabilities; sCategory : WideString) : WideString; var sContentID: WideString; ContentTypes: IPortableDevicePropVariantCollection; iCount, i: Cardinal; PropVar: tag_inner_PROPVARIANT; gCat: TGuid; begin Result := ''; if ( sCategory = '' ) or VarIsClear( Capabilities ) then exit; gCat := StringToGUID( sCategory ); try ContentTypes := CreateComObject( CLASS_PortableDevicePropVariantCollection ) as IPortableDevicePropVariantCollection; if VarIsClear( ContentTypes ) then Exit; Capabilities.GetSupportedContentTypes( gCat, ContentTypes ); ContentTypes.GetCount( iCount ); if iCount > 0 then for i := 0 to iCount - 1 do begin InitPropVariant( ActiveX.PROPVARIANT( PropVar )); ContentTypes.GetAt( i, PropVar ); PropVariantToString( PropVar, sContentID ); if i > 0 then Result := Result + ','; Result := Result + ContentTypeToStr( sContentID ); end; except // ERROR end; end; {$ENDIF} {$IFDEF DEBUG} // Return a comma separated list of supported commands function GetSupportedCommands(Capabilities: IPortableDeviceCapabilities) : WideString; var CmdKeys: IPortableDeviceKeyCollection; iCount, i: Cardinal; CmdKey: _WPDtagpropertykey; begin Result := ''; if VarIsClear( Capabilities ) then exit; try CmdKeys := CreateComObject( CLSID_PortableDeviceKeyCollection ) as IPortableDeviceKeyCollection; if VarIsClear( CmdKeys ) then Exit; Capabilities.GetSupportedCommands( CmdKeys ); CmdKeys.GetCount( iCount ); if iCount > 0 then for i := 0 to iCount - 1 do begin CmdKeys.GetAt( i, CmdKey ); if i > 0 then Result := Result + ','; Result := Result + SupportedCommandToStr( CmdKey.fmtid ); end; except // ERROR end; end; {$ENDIF} {$IFDEF DEBUG} // Output Functional Category Objects detail to a TStrings object procedure EnumFunctionalCategoryObjects(Capabilities: IPortableDeviceCapabilities; sCategory: WideString; ssDest : TStrings); var sResultText: WideString; pCategoryObjs: IPortableDevicePropVariantCollection; iCount, i: Cardinal; prop_var: tag_inner_PROPVARIANT; gCat: TGuid; begin if ( sCategory = '' ) or VarIsClear( Capabilities ) then exit; gCat := StringToGUID( sCategory ); try pCategoryObjs := CreateComObject( CLASS_PortableDevicePropVariantCollection ) as IPortableDevicePropVariantCollection; if VarIsClear( pCategoryObjs ) then Exit; Capabilities.GetFunctionalObjects( gCat, pCategoryObjs ); pCategoryObjs.GetCount( iCount ); ssDest.Add( 'Category Objects Count: ' + IntToStr( iCount )); if iCount > 0 then for i := 0 to iCount - 1 do begin InitPropVariant( ActiveX.PROPVARIANT( prop_var )); pCategoryObjs.GetAt( i, prop_var ); PropVariantToString( prop_var, sResultText ); ssDest.Add( format( 'Category Object %d: %s', [ i + 1, sResultText ] )); end; except // ERROR end; end; {$ENDIF} {$IFDEF DEBUG} // NOTE THIS ENTRY IS NOT SURFACED {!! TIEPortableDevices.EnumDeviceProperties Declaration function EnumDeviceProperties(const sDeviceID : WideString; ssDest : TStrings) : Boolean; Description A debugging function that outputs details of the specified devices to a TStrings object Example // Display properties of the current device IEPortableDevices.EnumDeviceProperties( IEPortableDevices.ActiveDeviceID, memDevProps.Lines ); !!} function TIEPortableDevices.EnumDeviceProperties(const sDeviceID : WideString; ssDest : TStrings) : Boolean; var PortableDev: IPortableDevice; Capabilities: IPortableDeviceCapabilities; pCategories: IPortableDevicePropVariantCollection; iCount, i: Cardinal; PropVar: tag_inner_PROPVARIANT; sCategory : WideString; begin Result := False; ssDest.Clear; try if ( ConnectToDevice( sDeviceID, PortableDev, fLastError, AddToLog ) = False ) or VarIsClear( PortableDev ) then exit; try PortableDev.Capabilities( Capabilities ); if not VarIsClear( Capabilities ) then begin pCategories := CreateComObject( CLASS_PortableDevicePropVariantCollection ) as IPortableDevicePropVariantCollection; if VarIsClear( pCategories ) then Exit; Capabilities.GetFunctionalCategories( pCategories ); pCategories.GetCount( iCount ); ssDest.Add( 'Category Count: ' + IntToStr( iCount )); if iCount > 0 then for i := 0 to iCount-1 do begin // List categories InitPropVariant( ActiveX.PROPVARIANT( PropVar )); pCategories.GetAt( i, PropVar ); PropVariantToString( PropVar, sCategory ); ssDest.Add( format( 'Category %d: %s', [ i + 1, FunctionalCategoryToStr( sCategory ) ] )); // Category objects.... EnumFunctionalCategoryObjects( Capabilities, sCategory, ssDest ); // Content Types... ssDest.Add( 'Content types: ' + GetContentTypes( Capabilities, sCategory )); end; // Get commands... ssDest.Add( 'Supported Commands: ' + GetSupportedCommands( Capabilities )); end; finally Capabilities := nil; end; PortableDev.Close; result := True; finally PortableDev := nil; end; end; {$ENDIF} initialization OleInitialize( nil ); finalization OleUninitialize; {$ELSE} // IEINCLUDEWPD interface implementation {$ENDIF} end.