Like this:
const
null = #0;
var
FileNames: string;
...
FileNames := FileName1 + null + FileName2 + null;
Then pass PWideChar(FileNames)
to SHFileOperation
.
Because Delphi strings are automatically null-terminated, PWideChar(FileNames)
is double null-terminated. One null-terminator that we put on the end, and the automatically added one.
Note that I am assuming that you are using a Unicode Delphi since you talk about wide characters. If you are on an older Delphi, and are calling SHFileOperationW
, then declare FileNames
to be WideString
.
More likely you have a list of files in, say, a string list. Treat them like this:
var
FileNames: string;
...
if FileList.Count=0 then
FileNames := null
else
begin
FileNames := '';
for i := 0 to FileList.Count-1 do
FileNames := FileNames + FileList[i] + null;
end;