I am using SHFileOperation and the source can be a pwidechar with filenames separated by a null and the whole thing terminated with a double null.
I can create an array of widechar and it holds the information I need but when I try to convert to pwidechar for the function, it only copies to the first null.
What am I doing wrong?
Like this:
Then pass
PWideChar(FileNames)
toSHFileOperation
.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 declareFileNames
to beWideString
.More likely you have a list of files in, say, a string list. Treat them like this: