|
@@ -3,7 +3,7 @@ unit OperationWithTimeout;
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
- Winapi.Windows, Winapi.ShlObj, Winapi.ShellAPI, ActiveX;
|
|
|
+ Winapi.Windows, Winapi.ShlObj, Winapi.ShellAPI, ActiveX, Winapi.ObjectArray;
|
|
|
|
|
|
function ShellFolderGetAttributesOfWithTimeout(
|
|
|
ShellFolder: IShellFolder; cidl: UINT; var apidl: PItemIDList; var rgfInOut: UINT; Timeout: Integer): HResult;
|
|
@@ -16,6 +16,9 @@ function ShellFolderParseDisplayNameWithTimeout(
|
|
|
ShellFolder: IShellFolder; hwndOwner: HWND; pbcReserved: Pointer; lpszDisplayName: POLESTR;
|
|
|
out pchEaten: ULONG; out ppidl: PItemIDList; var dwAttributes: ULONG; Timeout: Integer): HResult;
|
|
|
|
|
|
+function DestinationListBeginList(
|
|
|
+ DestinationList: ICustomDestinationList; var pcMaxSlots: UINT; const riid: TIID; out ppv: Pointer; Timeout: Integer): HRESULT;
|
|
|
+
|
|
|
implementation
|
|
|
|
|
|
uses
|
|
@@ -55,6 +58,12 @@ type
|
|
|
ppidl: PItemIDList;
|
|
|
dwAttributes: ULONG;
|
|
|
|
|
|
+ // DestinationListBeginList uses ResultHResult
|
|
|
+ DestinationList: ICustomDestinationList;
|
|
|
+ pcMaxSlots: UINT;
|
|
|
+ riid: TIID;
|
|
|
+ ppv: Pointer;
|
|
|
+
|
|
|
constructor Create(AOperationEvent: TOperationEvent);
|
|
|
end;
|
|
|
|
|
@@ -322,6 +331,38 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
+procedure DestinationListBeginListOperation(Operation: TOperation);
|
|
|
+begin
|
|
|
+ Operation.ResultHResult := Operation.DestinationList.BeginList(Operation.pcMaxSlots, Operation.riid, Operation.ppv);
|
|
|
+end;
|
|
|
+
|
|
|
+function DestinationListBeginList(
|
|
|
+ DestinationList: ICustomDestinationList; var pcMaxSlots: UINT; const riid: TIID; out ppv: Pointer; Timeout: Integer): HRESULT;
|
|
|
+var
|
|
|
+ Operation: TOperation;
|
|
|
+begin
|
|
|
+ NeedThread;
|
|
|
+ Operation := TOperation.Create(DestinationListBeginListOperation);
|
|
|
+ Operation.DestinationList := DestinationList;
|
|
|
+ Operation.pcMaxSlots := pcMaxSlots;
|
|
|
+ Operation.riid := riid;
|
|
|
+ Operation.ppv := ppv;
|
|
|
+ Thread.Queue(Operation);
|
|
|
+ if WaitForOperation(Timeout) then
|
|
|
+ begin
|
|
|
+ pcMaxSlots := Operation.pcMaxSlots;
|
|
|
+ ppv := Operation.ppv;
|
|
|
+ Result := Operation.ResultHResult;
|
|
|
+ Thread.Remove(Operation);
|
|
|
+ end
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ ppv := nil;
|
|
|
+ Result := E_FAIL;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
+
|
|
|
initialization
|
|
|
|
|
|
finalization
|