Hi all. I managed to sort the problem by using an array of Thandle. But this has introduced a new problem for me as I am not too clued up with handles. I understand that a handle filename is the lpFilename part, but once the handle is allocated to a Directory as below (*************) how do I retrieve the Directory from the handle eg mydirectory:= lpFilename.FDirectoryHandle[i];
var FDirectoryHandle: array of THandle; numHandles:dword; //numHandles set to count of directories earlier. SetLength(FDirectoryHandle, numHandles); for i := 0 to numHandles - 1 do begin //*****************************************below allocates Directory to Handle FDirectoryHandle[i] := CreateFile(PChar( mainform.VET.Storage.CheckedFileNames.Strings[i]), FILE_LIST_DIRECTORY, FILE_SHARE_READ or FILE_SHARE_WRITE or FILE_SHARE_DELETE, nil, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS or FILE_FLAG_OVERLAPPED, 0); //***************************************** if FDirectoryHandle[i] = INVALID_HANDLE_VALUE then begin beep; ShowMessage(SysErrorMessage(GetLastError)); for x := 0 to high(FDirectoryHandle) do CloseHandle(FDirectoryHandle[x]); FDirectoryHandle := 0; CloseHandle(FCompletionPort); FCompletionPort := 0; exit; end; if i = 0 then FCompletionPort := CreateIoCompletionPort(FDirectoryHandle[i], 0, Longint(pointer(self)), 0) else CreateIoCompletionPort(FDirectoryHandle[i], FCompletionPort, Longint(pointer(self)), 0); end; Cheers muchly, Bigal George+ --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/