forked from Ixiko/AHK-libs-and-classes-collection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWPD.ahk
1674 lines (1490 loc) · 74.6 KB
/
WPD.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
class IPortableDeviceManager extends IUnknown
{
static iid := "{a1567595-4c2f-4574-a6fa-ecef917b9a40}"
,clsid := "{0af10cec-2ecd-4b92-9581-34f6ae0637f3}"
; Retrieves a list of portable devices connected to the computer.
; The list of devices is generated when the device manager is instantiated; it does not refresh as devices connect and disconnect. To refresh the list of connected devices, call RefreshDeviceList.
; The API allocates the memory for each string pointed to by the pPnPDeviceIDs array. Once your application no longer needs these strings, it must iterate through this array and free the associated memory by calling the CoTaskMemFree function.
GetDevices(){
_Error(DllCall(this.vt(3),"ptr",this.__
,"ptr",0
,"uint*",pcPnPDeviceIDs
,"uint"),"GetDevices")
if pcPnPDeviceIDs{
;pPnPDeviceIDs:=struct("ptr[" pcPnPDeviceIDs "]")
VarSetCapacity(pPnPDeviceIDs,A_PtrSize*pcPnPDeviceIDs)
_Error(DllCall(this.vt(3),"ptr",this.__
,"ptr",&pPnPDeviceIDs
,"uint*",pcPnPDeviceIDs
,"uint"),"GetDevices")
PnPDeviceID:=[]
loop % pcPnPDeviceIDs
PnPDeviceID[A_Index]:=StrGet(NumGet(pPnPDeviceIDs,(A_Index-1)*A_PtrSize),"utf-16")
,DllCall("Ole32\CoTaskMemFree","ptr",NumGet(pPnPDeviceIDs,(A_Index-1)*A_PtrSize))
return PnPDeviceID
}
}
; The RefreshDeviceList method refreshes the list of devices that are connected to the computer.
; When the IPortableDeviceManager interface is instantiated the first time, it generates a list of the devices that are connected. However, devices can connect and disconnect from the computer, making the original list obsolete. This method enables an application to refresh the list of connected devices.
; This method is less resource-intensive than instantiating a new device manager to generate a new device list. However, it does require some resources; therefore, we recommend that you do not call this method arbitrarily. The best solution is to have the application register to get device arrival and removal notifications, and when a notification is received, have the application call this function.
RefreshDeviceList(){
return _Error(DllCall(this.vt(4),"ptr",this.__,"uint"),"RefreshDeviceList")
}
; Retrieves the user-friendly name for the device.
; A device is not required to support this method. If this method fails to retrieve a name, try requesting the WPD_OBJECT_NAME property of the device object (the object with the ID WPD_DEVICE_OBJECT_ID).
GetDeviceFriendlyName(pszPnPDeviceID){
_Error(DllCall(this.vt(5),"ptr",this.__
,"wstr",pszPnPDeviceID
,"ptr",0
,"uint*",pcchDeviceFriendlyName
,"uint"),"GetDeviceFriendlyName")
VarSetCapacity(pDeviceFriendlyName,pcchDeviceFriendlyName)
_Error(DllCall(this.vt(5),"ptr",this.__
,"wstr",pszPnPDeviceID
,"ptr",&pDeviceFriendlyName
,"uint*",pcchDeviceFriendlyName
,"uint"),"GetDeviceFriendlyName")
return StrGet(&pDeviceFriendlyName,"utf-16")
}
; Retrieves the description of a device.
GetDeviceDescription(pszPnPDeviceID){
_Error(DllCall(this.vt(6),"ptr",this.__
,"ptr",pszPnPDeviceID
,"ptr",0
,"ptr",pcchDeviceDescription
,"uint"),"GetDeviceDescription")
VarSetCapacity(pDeviceDescription,pcchDeviceDescription)
_Error(DllCall(this.vt(6),"ptr",this.__
,"ptr",pszPnPDeviceID
,"ptr",&pDeviceDescription
,"ptr",pcchDeviceDescription
,"uint"),"GetDeviceDescription")
return StrGet(&pDeviceDescription,"utf-16")
}
; Retrieves the name of the device manufacturer.
GetDeviceManufacturer(pszPnPDeviceID){
_Error(DllCall(this.vt(7),"ptr",this.__
,"wstr",pszPnPDeviceID
,"ptr",pDeviceManufacturer
,"uint*",pcchDeviceManufacturer
,"uint"),"GetDeviceManufacturer")
VarSetCapacity(pDeviceManufacturer,pcchDeviceManufacturer)
_Error(DllCall(this.vt(7),"ptr",this.__
,"wstr",pszPnPDeviceID
,"ptr",&pDeviceManufacturer
,"uint*",pcchDeviceManufacturer
,"uint"),"GetDeviceManufacturer")
return StrGet(&pcchDeviceManufacturer,"utf-16")
}
; Retrieves a property value stored by the device on the computer. (These are not standard properties that are defined by Windows Portable Devices.)
; These property values are stored on device installation, or stored by a device during operation so that they can be persisted across connection sessions. An application must know the exact name of the property, which is specified by the device itself; therefore, this method is intended to be used by device developers who are creating their own applications.
; To get Windows Portable Devices properties from the device object, call IPortableDeviceProperties::GetValues, and specify the device object with WPD_DEVICE_OBJECT_ID.
GetDeviceProperty(pszPnPDeviceID,pszDevicePropertyName){
_Error(DllCall(this.vt(8),"ptr",this.__
,"wstr",pszPnPDeviceID
,"wstr",pszDevicePropertyName
,"ptr",0
,"uint*",pcbData
,"uint*",pdwType
,"uint"),"GetDeviceProperty")
VarSetCapacity(pData,pcbData)
_Error(DllCall(this.vt(8),"ptr",this.__
,"wstr",pszPnPDeviceID
,"wstr",pszDevicePropertyName
,"ptr",&pData
,"uint*",pcbData
,"uint*",pdwType
,"uint"),"GetDeviceProperty")
return ; not completed
}
; The GetPrivateDevices method retrieves a list of private portable devices connected to the computer. These private devices are only accessible through an application that is designed for these particular devices.
; In order to write an application that communicates with a private device, you must have knowledge of the custom functionality exposed by a particular device driver. The description of this functionality must be obtained from the device manufacturer.
; The list of devices is generated when the device manager is instantiated; it does not refresh as devices connect and disconnect. To refresh the list of connected devices, call RefreshDeviceList.
; The API allocates the memory for each string pointed to by the pPnPDeviceIDs array. Once your application no longer needs these strings, it must iterate through this array and free the associated memory by calling the CoTaskMemFree function.
; A private device may not respond correctly to the standard Windows Portable Devices function calls that perform object enumeration, resource transfer, retrieval of device capabilities, and so on.
GetPrivateDevices(){
_Error(DllCall(this.vt(9),"ptr",this.__
,"ptr",0
,"uint*",pcPnPDeviceIDs
,"uint"),"GetPrivateDevices")
if pcPnPDeviceIDs{
pPnPDeviceIDs:=struct("ptr[" pcPnPDeviceIDs "]")
_Error(DllCall(this.vt(9),"ptr",this.__
,"ptr",pPnPDeviceIDs[]
,"uint*",pcPnPDeviceIDs
,"uint"),"GetPrivateDevices")
PnPDeviceID:=[]
loop % pcPnPDeviceIDs
PnPDeviceID[A_Index]:=StrGet(pPnPDeviceIDs[A_Index])
,DllCall("Ole32\CoTaskMemFree","ptr",pPnPDeviceIDs[A_Index])
return PnPDeviceID
}
}
}
class IPortableDevice extends IUnknown
{
static iid := "{625e2df8-6392-4cf0-9ad1-3cfa5f17775c}"
,clsid := "{728a21c5-3d9e-48d7-9810-864848f0f404}"
; The Open method opens a connection between the application and the device.
; A device must be opened before you can call any methods on it. (Note that the IPortableDeviceManager methods do not require you to open a device before calling any methods.) However, usually you do not need to call Close.
; Administrators can restrict the access of portable devices to computers running on a network. For example, an administrator may restrict all Guest users to read-only access, while Authenticated users are given read/write access.
; Due to these security issues, if your application will not perform write operations, it should call the Open method and request read-only access by specifying GENERIC_READ for the WPD_CLIENT_DESIRED_ACCESS property that it supplies in the pClientInfo parameter.
; If your application requires write operations, it should call the Open method as shown in the following example code. The first time, it should request read/write access by passing the default WPD_CLIENT_DESIRED_ACCESS property in the pClientInfo parameter. If this first call fails and returns E_ACCESSDENIED, your application should call the Open method a second time and request read-only access by specifying GENERIC_READ for the WPD_CLIENT_DESIRED_ACCESS property that it supplies in the pClientInfo parameter.
; Applications that live in Single Threaded Apartments should use CLSID_PortableDeviceFTM, as this eliminates the overhead of interface pointer marshaling. CLSID_PortableDevice is still supported for legacy applications.
Open(pszPnPDeviceID,pClientInfo){
return _Error(DllCall(this.vt(3),"ptr",this.__
,"wstr",pszPnPDeviceID
,"ptr",IsObject(pClientInfo)?pClientInfo.__:pClientInfo ; IPortableDeviceValues
,"uint"),"Open")
}
; The SendCommand method sends a command to the device and retrieves the results synchronously.
; More Remarks and Examples, http://msdn.microsoft.com/en-us/library/dd375691(v=vs.85).aspx
SendCommand(pParameters){
_Error(DllCall(this.vt(4),"ptr",this.__
,"uint",0
,"ptr",IsObject(pParameters)?pParameters.__:pParameters
,"ptr",ppResults
,"uint"),"SendCommand")
return new IPortableDeviceValues(ppResults)
}
; The Content method retrieves an interface that you can use to access objects on a device.
Content(){
_Error(DllCall(this.vt(5),"ptr",this.__
,"ptr*",ppContent
,"uint"),"Content")
return new IPortableDeviceContent(ppContent)
}
; The Capabilities method retrieves an interface used to query the capabilities of a portable device.
Capabilities(){
_Error(DllCall(this.vt(6),"ptr",this.__
,"ptr*",ppCapabilities
,"uint"),"Capabilities")
return new IPortableDeviceCapabilities(ppCapabilities)
}
; The Cancel method cancels a pending operation on this interface.
; If your application invokes the WPD API from multiple threads, each thread should create a new instance of the IPortableDevice interface. Doing this ensures that any cancel operation affects only the I/O for the affected thread.
; If an IStream write operation is underway when the Cancel method is invoked, your application should discard all changes by invoking the IStream::Revert method. Once the changes are discarded, the application should also close the stream by invoking the IUnknown::Release method.
; Also, note that if the Cancel method is invoked before an IStream::Write method has completed, the data being written may be corrupted.
Cancel(){
return _Error(DllCall(this.vt(7),"ptr",this.__,"uint"),"Cancel")
}
; The Close method closes the connection with the device.
; You should not usually need to call this method yourself. When the last reference to the IPortableDevice interface is released, Windows Portable Devices calls Close for you. Calling this method manually forces the connection to the device to close, and any Windows Portable Devices objects hosted on this device will cease to function. You can call Open to reopen the connection.
Close(){
return _Error(DllCall(this.vt(8),"ptr",this.__,"uint"),"Close")
}
; The Advise method registers an application-defined callback that receives device events.
Advise(dwFlags,pCallback){
_Error(DllCall(this.vt(9),"ptr",this.__
,"uint",dwFlags
,"ptr",pCallback
,"ptr",0
,"ptr*",ppszCookie
,"uint"),"Advise")
return StrGet(ppszCookie,"utf-16"),DllCall("Ole32\CoTaskMemFree","ptr",ppszCookie)
}
; The Unadvise method unregisters a client from receiving callback notifications. You must call this method if you called Advise previously.
Unadvise(pszCookie){
return _Error(DllCall(this.vt(10),"ptr",this.__
,"wstr",pszCookie
,"uint"),"Unadvise")
}
; The GetPnPDeviceID method retrieves the Plug and Play (PnP) device identifier that the application used to open the device.
; After the application is through using the string returned by this method, it must call the CoTaskMemFree function to free the string.
; The ppszPnPDeviceID argument must not be set to NULL.
GetPnPDeviceID(ppszPnPDeviceID){
_Error(DllCall(this.vt(11),"ptr",this.__
,"ptr*",ppszPnPDeviceID
,"uint"),"GetPnPDeviceID")
return StrGet(ppszPnPDeviceID,"utf-16"),DllCall("Ole32\CoTaskMemFree","ptr",ppszPnPDeviceID)
}
}
class IPortableDeviceValues extends IUnknown
{
static iid := "{6848f6f2-3155-4f86-b6f5-263eeeab3143}"
,clsid := "{0c15d503-d017-47ce-9016-7b3f978721cc}"
; The GetCount method retrieves the number of items in the collection.
GetCount(){
_Error(DllCall(this.vt(3),"ptr",this.__
,"uint*",pcelt
,"uint"),"GetCount")
return pcelt
}
; The GetAt method retrieves a value from the collection using the supplied zero-based index.
GetAt(index,pKey,pValue){
_Error(DllCall(this.vt(4),"ptr",this.__
,"ptr",index
,"ptr",pKey ; PROPERTYKEY
,"ptr",pValue ; PROPVARIANT
,"uint"),"GetAt")
return ; not completed
}
; The SetValue method adds a new PROPVARIANT value or overwrites an existing one.
; When the VARTYPE for pValue is VT_VECTOR or VT_UI1, setting a NULL or zero-sized buffer is not supported. For example, neither pValue.caub.pElems = NULL nor pValue.caub.cElems = 0 are allowed.
; This method can be used to retrieve a value of any type from the collection. However, if you know the value type in advance, use one of the specialized Set... methods of this interface to avoid the overhead of working with PROPVARIANT values directly.
; If an existing value has the same key that is specified by the key parameter, it overwrites the existing value without any warning. The existing key memory is released appropriately.
SetValue(key,pValue){
return _Error(DllCall(this.vt(5),"ptr",this.__
,"ptr",key ; REFPROPERTYKEY
,"ptr",pValue ; PROPVARIANT
,"uint"),"SetValue")
; not completed
}
; The GetValue method retrieves a PROPVARIANT value specified by a key.
; When the VARTYPE for pValue is VT_VECTOR or VT_UI1, retrieving a NULL or zero-sized buffer is not supported. For example, neither pValue.caub.pElems = NULL nor pValue.caub.cElems = 0 are allowed.
; This method can be used to retrieve a value of any type from the collection. However, if you know the value type in advance, use one of the specialized retrieval methods of this interface to avoid the overhead of working with PROPVARIANT values directly.
GetValue(key){
_Error(DllCall(this.vt(6),"ptr",this.__
,"ptr",key
,"ptr",pValue
,"uint"),"GetValue")
return pValue ; not completed
}
; The SetStringValue method adds a new string value (type VT_LPWSTR) or overwrites an existing one.
; Any existing key memory will be released appropriately.
SetStringValue(key,Value){
return _Error(DllCall(this.vt(7),"ptr",this.__
,"ptr",key
,"wstr",Value
,"uint"),"SetStringValue")
}
; The GetStringValue method retrieves a string value (type VT_LPWSTR) specified by a key.
GetStringValue(key){
_Error(DllCall(this.vt(8),"ptr",this.__
,"ptr",key
,"ptr*",pValue
,"uint"),"GetStringValue")
return StrGet(pValue,"utf-16"),DllCall("Ole32\CoTaskMemFree","ptr",pValue)
}
; The SetUnsignedIntegerValue method adds a new ULONG value (type VT_UI4) or overwrites an existing one.
; If an existing value has the same key that is specified by the key parameter, it overwrites the existing value without any warning.
SetUnsignedIntegerValue(key,Value){
return _Error(DllCall(this.vt(9),"ptr",this.__
,"ptr",key
,"uint",Value
,"uint"),"SetUnsignedIntegerValue")
}
; The GetUnsignedIntegerValue method retrieves a ULONG value (type VT_UI4) specified by a key.
GetUnsignedIntegerValue(key){
_Error(DllCall(this.vt(10),"ptr",this.__
,"ptr",key
,"uint*",pValue
,"uint"),"GetUnsignedIntegerValue")
return pValue
}
; The SetSignedIntegerValue method adds a new LONG value (type VT_I4) or overwrites an existing one.
SetSignedIntegerValue(key,Value){
return _Error(DllCall(this.vt(11),"ptr",this.__
,"ptr",key
,"uint",Value
,"uint"),"SetSignedIntegerValue")
}
; The GetSignedIntegerValue method retrieves a LONG value (type VT_I4) specified by a key.
GetSignedIntegerValue(key){
_Error(DllCall(this.vt(12),"ptr",this.__
,"ptr",key
,"int*",pValue
,"uint"),"GetSignedIntegerValue")
return pValue
}
; The SetUnsignedLargeIntegerValue method adds a new ULONGLONG value (type VT_UI8) or overwrites an existing one.
SetUnsignedLargeIntegerValue(key,Value){
return _Error(DllCall(this.vt(13),"ptr",this.__
,"ptr",key
,"uint64",Value
,"uint"),"SetUnsignedLargeIntegerValue")
}
; The GetUnsignedLargeIntegerValue method retrieves a ULONGLONG value (type VT_UI8) specified by a key.
GetUnsignedLargeIntegerValue(key){
_Error(DllCall(this.vt(14),"ptr",this.__
,"ptr",key
,"uint64*",pValue
,"uint"),"GetUnsignedLargeIntegerValue")
return pValue
}
; The SetSignedLargeIntegerValue method adds a new LONGLONG value (type VT_I8) or overwrites an existing one.
SetSignedLargeIntegerValue(key,Value){
return _Error(DllCall(this.vt(15),"ptr",this.__
,"ptr",key
,"int64",Value
,"uint"),"SetSignedLargeIntegerValue")
}
; The GetSignedLargeIntegerValue method retrieves a LONGLONG value (type VT_I8) specified by a key.
GetSignedLargeIntegerValue(key){
_Error(DllCall(this.vt(16),"ptr",this.__
,"ptr",key
,"int64*",pValue
,"uint"),"GetSignedLargeIntegerValue")
return pValue
}
; The SetFloatValue method adds a new FLOAT value (type VT_R4) or overwrites an existing one.
SetFloatValue(key,Value){
return _Error(DllCall(this.vt(17),"ptr",this.__
,"ptr",key
,"float",Value
,"uint"),"SetFloatValue")
}
; The GetFloatValue method retrieves a FLOAT value (type VT_R4) specified by a key.
GetFloatValue(key){
_Error(DllCall(this.vt(18),"ptr",this.__
,"ptr",key
,"float*",pValue
,"uint"),"GetFloatValue")
return pValue
}
; The SetErrorValue method adds a new HRESULT value (type VT_ERROR) or overwrites an existing one.
SetErrorValue(key,Value){
return _Error(DllCall(this.vt(19),"ptr",this.__
,"ptr",key
,"int",Value
,"uint"),"SetErrorValue")
}
; The GetErrorValue method retrieves an HRESULT value (type VT_ERROR) specified by a key.
GetErrorValue(key){
_Error(DllCall(this.vt(20),"ptr",this.__
,"ptr",key
,"int*",pValue
,"uint"),"GetErrorValue")
return pValue
}
; The SetKeyValue method adds a new REFPROPERTYKEY value (type VT_UNKNOWN) or overwrites an existing one.
SetKeyValue(key,Value){
return _Error(DllCall(this.vt(21),"ptr",this.__
,"ptr",key
,"ptr",Value
,"uint"),"SetKeyValue")
}
; The GetKeyValue method retrieves a PROPERTYKEY value specified by a key.
GetKeyValue(key){
_Error(DllCall(this.vt(22),"ptr",this.__
,"ptr",key
,"ptr",pValue
,"uint"),"GetKeyValue")
return pValue ; not completed
}
; The SetBoolValue method adds a new Boolean value (type VT_BOOL) or overwrites an existing one.
SetBoolValue(key,Value){
return _Error(DllCall(this.vt(23),"ptr",this.__
,"ptr",key
,"int",Value
,"uint"),"SetBoolValue")
}
; The GetBoolValue method retrieves a Boolean value (type VT_BOOL) specified by a key.
GetBoolValue(key){
_Error(DllCall(this.vt(24),"ptr",this.__
,"ptr",key
,"int*",pValue
,"uint"),"GetBoolValue")
return pValue
}
; The SetIUnknownValue method adds a new IUnknown value (type VT_UNKNOWN) or overwrites an existing one.
SetIUnknownValue(key,pValue){
return _Error(DllCall(this.vt(25),"ptr",this.__
,"ptr",key
,"ptr",IsObject(pValue)?pValue.__:pValue
,"uint"),"SetIUnknownValue")
}
; The GetIUnknownValue method retrieves an IUnknown interface value (type VT_UNKNOWN) specified by a key.
GetIUnknownValue(key){
_Error(DllCall(this.vt(26),"ptr",this.__
,"ptr",key
,"ptr*",ppValue
,"uint"),"GetIUnknownValue")
return ppValue
}
; The SetGuidValue method adds a new GUID value (type VT_CLSID) or overwrites an existing one.
SetGuidValue(key,Value){
return _Error(DllCall(this.vt(27),"ptr",this.__
,"ptr",key
,"ptr",Value
,"uint"),"SetGuidValue")
}
; The GetGuidValue method retrieves a GUID value (type VT_CLSID) specified by a key.
GetGuidValue(key,ByRef pValue){
VarSetCapacity(pValue,16)
_Error(DllCall(this.vt(28),"ptr",this.__
,"ptr",key
,"ptr",&pValue
,"uint"),"GetGuidValue")
return &pValue
}
; The SetBufferValue method adds a new BYTE* value (type VT_VECTOR | VT_UI1) or overwrites an existing one.
SetBufferValue(key,pValue,cbValue){
return _Error(DllCall(this.vt(29),"ptr",this.__
,"ptr",key
,"ptr",IsObject(pValue)?pValue[]:pValue
,"uint",cbValue
,"uint"),"SetBufferValue")
}
; The GetBufferValue method retrieves a byte array value (type VT_VECTOR | VT_UI1) specified by a key.
GetBufferValue(key,ByRef value){
_Error(DllCall(this.vt(30),"ptr",this.__
,"ptr",key
,"ptr*",ppValue
,"uint*",pcbValue
,"uint"),"GetBufferValue")
VarSetCapacity(value,pcbValue)
DllCall("RtlMoveMemory","ptr",&value,"ptr",ppValue,"uint",pcbValue)
DllCall("Ole32\CoTaskMemFree","ptr",ppValue)
return pcbValue ; not completed
}
; The SetIPortableDeviceValuesValue method adds a new IPortableDeviceValues value (type VT_UNKNOWN) or overwrites an existing one.
SetIPortableDeviceValuesValue(key,pValue){
return _Error(DllCall(this.vt(31),"ptr",this.__
,"ptr",key
,"ptr",IsObject(pValue)?pValue.__:pValue
,"uint"),"SetIPortableDeviceValuesValue")
}
; The GetIPortableDeviceValuesValue method retrieves an IPortableDeviceValues value (type VT_UNKNOWN) specified by a key.
GetIPortableDeviceValuesValue(key){
_Error(DllCall(this.vt(32),"ptr",this.__
,"ptr",key
,"ptr*",ppValue
,"uint"),"GetIPortableDeviceValuesValue")
return new IPortableDeviceValues(ppValue)
}
; The SetIPortableDevicePropVariantCollectionValue method adds a new IPortableDevicePropVariantCollection value (type VT_UNKNOWN) or overwrites an existing one.
SetIPortableDevicePropVariantCollectionValue(key,pValue){
return _Error(DllCall(this.vt(33),"ptr",this.__
,"ptr",key
,"ptr",IsObject(pValue)?pValue.__:pValue
,"uint"),"SetIPortableDevicePropVariantCollectionValue")
}
; The GetIPortableDevicePropVariantCollectionValue method retrieves an IPortableDevicePropVariantCollection value (type VT_UNKNOWN) specified by a key.
GetIPortableDevicePropVariantCollectionValue(key){
_Error(DllCall(this.vt(34),"ptr",this.__
,"ptr",key
,"ptr*",ppValue
,"uint"),"GetIPortableDevicePropVariantCollectionValue")
return new IPortableDevicePropVariantCollection(ppValue)
}
; The SetIPortableDeviceKeyCollectionValue method adds a new SetIPortableDeviceKeyCollectionValue value (type VT_UNKNOWN) or overwrites an existing one.
SetIPortableDeviceKeyCollectionValue(key,pValue){
return _Error(DllCall(this.vt(35),"ptr",this.__
,"ptr",key
,"ptr",IsObject(pValue)?pValue.__:pValue
,"uint"),"SetIPortableDeviceKeyCollectionValue")
}
; The GetIPortableDeviceKeyCollectionValue method retrieves an IPortableDeviceKeyCollection value (type VT_UNKNOWN) specified by a key.
GetIPortableDeviceKeyCollectionValue(key){
_Error(DllCall(this.vt(36),"ptr",this.__
,"ptr",key
,"ptr*",ppValue
,"uint"),"GetIPortableDeviceKeyCollectionValue")
return new IPortableDeviceKeyCollection(ppValue)
}
; The SetIPortableDeviceValuesCollectionValue method adds a new IPortableDeviceValuesCollection value (type VT_UNKNOWN) or overwrites an existing one
SetIPortableDeviceValuesCollectionValue(key,pValue){
return _Error(DllCall(this.vt(37),"ptr",this.__
,"ptr",key
,"ptr",IsObject(pValue)?pValue.__:pValue
,"uint"),"SetIPortableDeviceValuesCollectionValue")
}
; The GetIPortableDeviceValuesCollectionValue method retrieves an IPortableDeviceValuesCollection value (type VT_UNKNOWN) specified by a key.
GetIPortableDeviceValuesCollectionValue(key){
_Error(DllCall(this.vt(38),"ptr",this.__
,"ptr",key
,"ptr*",ppValue
,"uint"),"GetIPortableDeviceValuesCollectionValue")
return new IPortableDeviceValuesCollection(ppValue)
}
; The RemoveValue method removes an item from the collection.
RemoveValue(key){
return _Error(DllCall(this.vt(39),"ptr",this.__
,"ptr",key
,"uint"),"RemoveValue")
}
; The CopyValuesFromPropertyStore method copies the contents of an IPropertyStore into the collection.
CopyValuesFromPropertyStore(pStore){
return _Error(DllCall(this.vt(40),"ptr",this.__
,"ptr",IsObject(pStore)?pStore.__:pStore
,"uint"),"CopyValuesFromPropertyStore")
}
; The CopyValuesToPropertyStore method copies all the values from a collection into an IPropertyStore interface.
CopyValuesToPropertyStore(pStore){
return _Error(DllCall(this.vt(41),"ptr",this.__
,"ptr",IsObject(pStore)?pStore.__:pStore
,"uint"),"CopyValuesToPropertyStore")
}
; The Clear method deletes all items from the collection.
Clear(){
return _Error(DllCall(this.vt(42),"ptr",this.__,"uint"),"Clear")
}
}
class IPortableDeviceContent extends IUnknown
{
static iid := "{6a96ed84-7c73-4480-9938-bf5af477d426}"
; The EnumObjects method retrieves an interface that is used to enumerate the immediate child objects of an object. It has an optional filter that can enumerate objects with specific properties.
EnumObjects(dwFlags,pszParentObjectID,pFilter){
_Error(DllCall(this.vt(3),"ptr",this.__
,"uint",dwFlags
,"wstr",pszParentObjectID
,"ptr",IsObject(pFilter)?pFilter.__:pFilter
,"ptr*",ppEnum
,"uint"),"EnumObjects")
return new IEnumPortableDeviceObjectIDs(ppEnum)
}
; The Properties method retrieves the interface that is required to get or set properties on an object on the device.
Properties(){
_Error(DllCall(this.vt(4),"ptr",this.__
,"ptr*",ppProperties
,"uint"),"Properties")
return new IPortableDeviceProperties(ppProperties)
}
; The Transfer method retrieves an interface that is used to read from or write to the content data of an existing object resource.
Transfer(){
_Error(DllCall(this.vt(5),"ptr",this.__
,"ptr*",ppResources
,"uint"),"Transfer")
return new IPortableDeviceResources(ppResources)
}
; The CreateObjectWithPropertiesOnly method creates an object with only properties on the device.
CreateObjectWithPropertiesOnly(pValues){
_Error(DllCall(this.vt(6),"ptr",this.__
,"ptr",IsObject(pValues)?pValues.__:pValues
,"ptr*",ppszObjectID
,"uint"),"CreateObjectWithPropertiesOnly")
return StrGet(ppszObjectID,"utf-16"),,DllCall("Ole32\CoTaskMemFree","ptr",ppszObjectID)
}
; The CreateObjectWithPropertiesAndData method creates an object with both properties and data on the device.
CreateObjectWithPropertiesAndData(pValues,ppData,pdwOptimalWriteBufferSize,ppszCookie){
_Error(DllCall(this.vt(7),"ptr",this.__
,"ptr",IsObject(pValues)?pValues.__:pValues
,"ptr*",ppData
,"uint*",pdwOptimalWriteBufferSize
,"ptr*",ppszCookie
,"uint"),"CreateObjectWithPropertiesAndData")
return [new IStream(ppData),pdwOptimalWriteBufferSize,StrGet(ppszCookie,"utf-16")],DllCall("Ole32\CoTaskMemFree","ptr",ppszCookie) ; not completed
}
; The Delete method deletes one or more objects from the device.
Delete(dwOptions,pObjectIDs){
_Error(DllCall(this.vt(8),"ptr",this.__
,"uint",dwOptions
,"ptr",IsObject(pObjectIDs)?pObjectIDs.__:pObjectIDs
,"ptr*",ppResults
,"uint"),"Delete")
return new IPortableDevicePropVariantCollection(ppResults)
}
; The GetObjectIDsFromPersistentUniqueIDs method retrieves the current object ID of one or more objects, given their persistent unique IDs (PUIDs).
GetObjectIDsFromPersistentUniqueIDs(pPersistentUniqueIDs){
_Error(DllCall(this.vt(9),"ptr",this.__
,"ptr",IsObject(pPersistentUniqueIDs)?pPersistentUniqueIDs.__:pPersistentUniqueIDs
,"ptr*",ppObjectIDs
,"uint"),"GetObjectIDsFromPersistentUniqueIDs")
return new IPortableDevicePropVariantCollection(ppObjectIDs)
}
; The Cancel method cancels a pending operation called on this interface
Cancel(){
return _Error(DllCall(this.vt(10),"ptr",this.__,"uint"),"Cancel")
}
; The Move method moves one or more objects from one location on the device to another.
Move(pObjectIDs,pszDestinationFolderObjectID){
_Error(DllCall(this.vt(11),"ptr",this.__
,"ptr",IsObject(pObjectIDs)?pObjectIDs.__:pObjectIDs
,"wstr",pszDestinationFolderObjectID
,"ptr*",ppResults
,"uint"),"Move")
return new IPortableDevicePropVariantCollection(ppResults)
}
; The Copy method copies objects from one location on a device to another.
Copy(pObjectIDs,pszDestinationFolderObjectID){
_Error(DllCall(this.vt(12),"ptr",this.__
,"ptr",IsObject(pObjectIDs)?pObjectIDs.__:pObjectIDs
,"wstr",pszDestinationFolderObjectID
,"ptr*",ppResults
,"uint"),"Copy")
return new IPortableDevicePropVariantCollection(ppResults)
}
}
class IPortableDeviceContent2 extends IPortableDeviceContent
{
static iid := "{9b4add96-f6bf-4034-8708-eca72bf10554}"
; The UpdateObjectWithPropertiesAndData method updates an object by using properties and data found on the device.
UpdateObjectWithPropertiesAndData(pszObjectID,pProperties){
_Error(DllCall(this.vt(13),"ptr",this.__
,"wstr",pszObjectID
,"ptr",IsObject(pProperties)?pProperties.__:pProperties
,"ptr*",ppData
,"uint*",pdwOptimalWriteBufferSize
,"uint"),"UpdateObjectWithPropertiesAndData")
return [new IStream(ppData),pdwOptimalWriteBufferSize]
}
}
class IPortableDeviceProperties extends IUnknown
{
static iid := "{7f6d695c-03df-4439-a809-59266beee3a6}"
; The GetSupportedProperties method retrieves a list of properties that a specified object supports. Note that not all of these properties may actually have values.
; To get the values of supported properties, call GetPropertyAttributes.
GetSupportedProperties(pszObjectID){
_Error(DllCall(this.vt(3),"ptr",this.__
,"wstr",pszObjectID
,"ptr*",ppKeys
,"uint"),"GetSupportedProperties")
return new IPortableDeviceKeyCollection(ppKeys)
}
; The GetPropertyAttributes method retrieves attributes of a specified object property on a device.
; Property attributes describe a property's access rights, valid values, and other information. For example, a property can have a WPD_PROPERTY_ATTRIBUTE_CAN_DELETE value set to False to prevent deletion, and have a range of valid values stored as individual entries.
GetPropertyAttributes(pszObjectID,Key){
_Error(DllCall(this.vt(4),"ptr",this.__
,"wstr",pszObjectID
,"ptr",Key
,"ptr*",ppAttributes
,"uint"),"GetPropertyAttributes")
return new IPortableDeviceValues(ppAttributes)
}
; The GetValues method retrieves a list of specified properties from a specified object on a device.
GetValues(pszObjectID,pKeys){
_Error(DllCall(this.vt(5),"ptr",this.__
,"wstr",pszObjectID
,"ptr",IsObject(pKeys)?pKeys.__:pKeys
,"ptr*",ppValues
,"uint"),"GetValues")
return new IPortableDeviceValues(ppValues)
}
; The SetValues method adds or modifies one or more properties on a specified object on a device.
; To delete a property, call IPortableDeviceProperties::Delete. A property can be deleted only if its WPD_PROPERTY_ATTRIBUTE_CAN_WRITE attribute is True. This attribute can be retrieved by calling GetPropertyAttributes.
SetValues(pszObjectID,pValues){
_Error(DllCall(this.vt(6),"ptr",this.__
,"wstr",pszObjectID
,"ptr",IsObject(pValues)?pValues.__:pValues
,"ptr*",ppResults
,"uint"),"SetValues")
return new IPortableDeviceValues(ppResults)
}
; The Delete method deletes specified properties from a specified object on a device.
; Properties can be deleted only if their WPD_PROPERTY_ATTRIBUTE_CAN_DELETE attribute is True. This attribute can be retrieved by calling GetPropertyAttributes.
; The driver has no way to indicate partial success; that is, if only some properties could be deleted, the driver will return S_FALSE, but this method does not indicate which properties were successfully deleted. The only way to learn which properties were deleted is to request all properties by calling IPortableDeviceProperties::GetValues.
Delete(pszObjectID,pKeys){
return _Error(DllCall(this.vt(7),"ptr",this.__
,"wstr",pszObjectID
,"ptr",IsObject(pKeys)?pKeys.__:pKeys
,"uint"),"Delete")
}
; The Cancel method cancels a pending call.
; This method cancels all pending operations on the current device handle, which corresponds to a session associated with an IPortableDevice interface. The Windows Portable Devices (WPD) API does not support targeted cancellation of specific operations.
Cancel(){
return _Error(DllCall(this.vt(8),"ptr",this.__,"uint"),"Cancel")
}
}
class IEnumPortableDeviceObjectIDs extends IUnknown
{
static iid := "{10ece955-cf41-4728-bfa0-41eedf1bbf19}"
; The Next method retrieves the next one or more object IDs in the enumeration sequence.
; If fewer than the requested number of elements remain in the sequence, this method retrieves the remaining elements. The number of elements that are actually retrieved is returned through pcFetched (unless the caller passed in NULL for that parameter). Enumerated objects are all peers—that is, enumerating children of an object will enumerate only direct children, not grandchild or deeper objects.
Next(cObjects){
_Error(DllCall(this.vt(3),"ptr",this.__
,"uint",cObjects
,"ptr*",pObjIDs
,"uint*",pcFetched
,"uint"),"Next")
return [StrGet(pObjIDs,"utf-16"),pcFetched],DllCall("Ole32\CoTaskMemFree","ptr",pObjIDs)
}
; The Skip method skips a specified number of objects in the enumeration sequence.
Skip(cObjects){
return _Error(DllCall(this.vt(4),"ptr",this.__
,"uint",cObjects
,"uint"),"Skip")
}
; The Reset method resets the enumeration sequence to the beginning.
; There is no guarantee that the same objects will be enumerated after this method is called. This is because objects that were enumerated previously might have been deleted or new objects might have been added.
Reset(){
return _Error(DllCall(this.vt(5),"ptr",this.__,"uint"),"Reset")
}
; The Clone method duplicates the current I EnumPortableDeviceObjectIDs interface.
Clone(){
_Error(DllCall(this.vt(6),"ptr",this.__
,"ptr*",ppEnum
,"uint"),"Clone")
return new IEnumPortableDeviceObjectIDs(ppEnum)
}
; The Cancel method cancels a pending operation.
; This method cancels all pending operations on the current device handle, which corresponds to a session associated with an IPortableDevice interface. The Windows Portable Devices (WPD) API does not support targeted cancellation of specific operations.
Cancel(){
return _Error(DllCall(this.vt(7),"ptr",this.__,"uint"),"Cancel")
}
}
class IPortableDeviceKeyCollection extends IUnknown
{
static iid := "{dada2357-e0ad-492e-98db-dd61c53ba353}"
,clsid := "{de2d022d-2480-43be-97f0-d1fa2cf98f4f}"
; The GetCount method retrieves the number of keys in this collection.
GetCount(){
_Error(DllCall(this.vt(3),"ptr",this.__
,"uint*",pcElems
,"uint"),"GetCount")
return pcElems
}
; The GetAt method retrieves a PROPERTYKEY from the collection by index.
GetAt(dwIndex,ByRef pKey){
return _Error(DllCall(this.vt(4),"ptr",this.__
,"uint",dwIndex
,"ptr",pKey
,"uint"),"GetAt")
}
; The Add method adds a property key to the collection.
Add(Key){
return _Error(DllCall(this.vt(5),"ptr",this.__
,"ptr",Key
,"uint"),"Add")
}
; The Clear method deletes all items from the collection.
Clear(){
return _Error(DllCall(this.vt(6),"ptr",this.__,"uint"),"Clear")
}
; The RemoveAt method removes the element stored at the location specified by the given index.
RemoveAt(dwIndex){
return _Error(DllCall(this.vt(7),"ptr",this.__
,"uint",dwIndex
,"uint"),"RemoveAt")
}
}
class IPortableDeviceResources extends IUnknown
{
static iid := "{fd8878ac-d841-4d17-891c-e6829cdb6934}"
; The GetSupportedResources method retrieves a list of resources that are supported by a specific object.
; The list of resources returned by this method includes all resources that the object can support. This does not mean that all the listed resources actually have data, but that the object is capable of supporting each listed resource.
GetSupportedResources(pszObjectID){
_Error(DllCall(this.vt(3),"ptr",this.__
,"wstr",pszObjectID
,"ptr*",ppKeys
,"uint"),"GetSupportedResources")
return new IPortableDeviceKeyCollection(ppKeys)
}
; The GetResourceAttributes method retrieves all attributes from a specified resource in an object.
GetResourceAttributes(pszObjectID,Key){
_Error(DllCall(this.vt(4),"ptr",this.__
,"wstr",pszObjectID
,"ptr",Key
,"ptr*",ppResourceAttributes
,"uint"),"GetResourceAttributes")
return new IPortableDeviceValues(ppResourceAttributes)
}
; The GetStream method gets an IStream interface with which to read or write the content data in an object on a device. The retrieved interface enables you to read from or write to the object data.
; The retrieved stream cannot read the contents of a folder recursively. To copy all the resources in an object, specify WPD_RESOURCE_DEFAULT for Key.
; If the object does not support resources, this method will return an error, and ppStream will be NULL.
; Applications should use the buffer size returned by pdwOptimalBufferSize when allocating the buffer for read or write operations.
GetStream(pszObjectID,Key,dwMode){
_Error(DllCall(this.vt(5),"ptr",this.__
,"wstr",pszObjectID
,"ptr",Key
,"uint",dwMode
,"uint*",pdwOptimalBufferSize
,"ptr*",ppStream
,"uint"),"GetStream")
return [pdwOptimalBufferSize,new IStream(ppStream)]
}
; The Delete method deletes one or more resources from the object identified by the pszObjectID parameter.
; An object can have several resources. For instance, an object may contain image data, thumbnail image data, and audio data.
; An application can retrieve a list of supported resources by calling the GetSupportedResources method.
Delete(pszObjectID,pKeys){
return _Error(DllCall(this.vt(6),"ptr",this.__
,"wstr",pszObjectID
,"ptr",IsObject(pKeys)?pKeys.__:pKeys
,"uint"),"Delete")
}
; The Cancel method cancels a pending operation.
; This method cancels all pending operations on the current device handle, which corresponds to a session associated with an IPortableDevice interface. The Windows Portable Devices (WPD) API does not support targeted cancellation of specific operations.
Cancel(){
return _Error(DllCall(this.vt(7),"ptr",this.__,"uint"),"Cancel")
}
; The CreateResource method creates a resource.
; When an application calls this method, it must specify the resource attributes and it must write the required data to the stream that this method returns.
; A resource is not created when the method returns; it is created when the application commits the data by calling the Commit method on the stream at which ppData points.
; To cancel the data transfer to a resource, the application must call the Revert method on the stream at which ppData points. Once the transfer is canceled, the application must invoke IUnknown::Release to close the stream.
CreateResource(pResourceAttributes){
_Error(DllCall(this.vt(8),"ptr",this.__
,"ptr",IsObject(pResourceAttributes)?pResourceAttributes.__:pResourceAttributes
,"ptr*",ppData
,"uint*",pdwOptimalWriteBufferSize
,"ptr*",ppszCookie
,"uint"),"CreateResource")
return [new IStream(ppData),pdwOptimalWriteBufferSize,StrGet(ppszCookie,"utf-16")]
}
}
class IPortableDeviceCapabilities extends IUnknown
{
static iid := "{2c8c6dbf-e3dc-4061-becc-8542e810d126}"
; The GetSupportedCommands method retrieves a list of all the supported commands for this device.
GetSupportedCommands(ppCommands){
_Error(DllCall(this.vt(3),"ptr",this.__
,"ptr*",ppCommands
,"uint"),"GetSupportedCommands")
return new IPortableDeviceKeyCollection(ppCommands)
}
; The GetCommandOptions method retrieves all the supported options for the specified command on the device.
; This method is called by applications that want to call a command directly on the driver by calling IPortableDevice::SendCommand. Some commands allow the caller to specify additional options. For example, some drivers support recursive child deletion when deleting an object using the WPD_COMMAND_OBJECT_MANAGEMENT_DELETE_OBJECTS command.
; If an option is a simple Boolean value, the key of the retrieved IPortableDeviceValues interface will be the name of the option, and the PROPVARIANT value will be a VT_BOOL value of True or False. If an option has several values, the retrieved PROPVARIANT value will be a collection type that holds the supported values.
; If this method is called for the WPD_COMMAND_STORAGE_FORMAT command and the ppOptions parameter is set to WPD_OPTION_VALID_OBJECT_IDS, the driver will return an IPortableDevicePropVariant collection of type VT_LPWSTR that specifies the identifiers for each object on the device that can be formatted. (If this option does not exist, the format command is available for all objects.)
GetCommandOptions(Command){
_Error(DllCall(this.vt(4),"ptr",this.__
,"ptr",Command
,"ptr*",ppOptions
,"uint"),"GetCommandOptions")
return new IPortableDeviceValues(ppOptions)
}
; The GetFunctionalCategories method retrieves all functional categories supported by the device.
; Functional categories describe the types of functions that a device can perform, such as image capture, audio capture, and storage. This method is typically very fast, because the driver usually queries the device only on startup and caches the results.
GetFunctionalCategories(){
_Error(DllCall(this.vt(5),"ptr",this.__
,"ptr*",ppCategories
,"uint"),"GetFunctionalCategories")
return new IPortableDevicePropVariantCollection(ppCategories)
}
; The GetFunctionalObjects method retrieves all functional objects that match a specified category on the device.
; This operation is usually fast, because the driver does not need to perform a full content enumeration, and the number of retrieved functional objects is typically less than 10. If no objects of the requested type are found, this method will not return an error, but returns an empty collection for ppObjectIDs.
GetFunctionalObjects(Category){
_Error(DllCall(this.vt(6),"ptr",this.__
,"ptr",Category
,"ptr*",ppObjectIDs
,"uint"),"GetFunctionalObjects")
return new IPortableDevicePropVariantCollection(ppObjectIDs)
}
; The GetSupportedContentTypes method retrieves all supported content types for a specified functional object type on a device.
GetSupportedContentTypes(Category){
_Error(DllCall(this.vt(7),"ptr",this.__
,"ptr",Category
,"ptr*",ppContentTypes
,"uint"),"GetSupportedContentTypes")
return new IPortableDevicePropVariantCollection(ppContentTypes)
}
; The GetSupportedFormats method retrieves the supported formats for a specified object type on the device. For example, specifying audio objects might return WPD_OBJECT_FORMAT_WMA, WPD_OBJECT_FORMAT_WAV, and WPD_OBJECT_FORMAT_MP3.
GetSupportedFormats(ContentType){
_Error(DllCall(this.vt(8),"ptr",this.__
,"ptr",ContentType
,"ptr*",ppFormats
,"uint"),"GetSupportedFormats")
return new IPortableDevicePropVariantCollection(ppFormats)
}
; The GetSupportedFormatProperties method retrieves the properties supported by objects of a specified format on the device.
; You can specify WPD_OBJECT_FORMAT_ALL for the Format parameter to retrieve the complete set of property attributes.
; If an object does not have a value assigned to a specific property, or if the property was deleted, a device might not report the property at all when enumerating its properties. Another device might report the property, but with an empty string or a value of zero. In order to avoid this inconsistency, you can call this method to learn all the properties you can set on a specific object.
GetSupportedFormatProperties(Format){
_Error(DllCall(this.vt(9),"ptr",this.__
,"ptr",Format
,"ptr*",ppKeys
,"uint"),"GetSupportedFormatProperties")
return new IPortableDeviceKeyCollection(ppKeys)
}
; The GetFixedPropertyAttributes method retrieves the standard property attributes for a specified property and format. Standard attributes are those that have the same value for all objects of the same format. For example, one device might not allow users to modify video file names; this device would return WPD_PROPERTY_ATTRIBUTE_CAN_WRITE with a value of False for WMV formatted objects. Attributes that can have different values for a format, or optional attributes, are not returned.
; You can specify WPD_OBJECT_FORMAT_ALL for the Format parameter to retrieve the complete set of property attributes.
; Attributes describe properties. Example attributes are WPD_PROPERTY_ATTRIBUTE_CAN_READ and WPD_PROPERTY_ATTRIBUTE_CAN_WRITE. This method does not retrieve resource attributes.
GetFixedPropertyAttributes(Format,Key){
_Error(DllCall(this.vt(10),"ptr",this.__
,"ptr",Format
,"ptr",Key
,"ptr*",ppAttributes
,"uint"),"GetFixedPropertyAttributes")
return new IPortableDeviceValues(ppAttributes)
}
; The Cancel method cancels a pending request on this interface.
; This method cancels all pending operations on the current device handle, which corresponds to a session associated with an IPortableDevice interface. The Windows Portable Devices (WPD) API does not support targeted cancellation of specific operations.
Cancel(){
return _Error(DllCall(this.vt(11),"ptr",this.__,"uint"),"Cancel")
}
; The GetSupportedEvents method retrieves the supported events for this device.
GetSupportedEvents(){
_Error(DllCall(this.vt(12),"ptr",this.__
,"ptr*",ppEvents
,"uint"),"GetSupportedEvents")
return new IPortableDevicePropVariantCollection(ppEvents)
}
; The GetEventOptions method retrieves all the supported options for the specified event on the device.