Char frombuf [] = "f: //*.*/0"; // If it is above, it is not possible, why? ? // cstring strfrom = "f: //*.*"; lptstr frombuf = (lptstr) (lpctstr) strFrom; chartobuf [] = "c: //"; shfileopstruct op; op.hwnd = null; op.wfunc = FO_COPY; Op.pFrom = FromBuf; // FromBuf; Op.pTo = ToBuf; Op.fFlags = FOF_NOCONFIRMATION | FOF_RENAMEONCOLLISION; Op.fAnyOperationsAborted = FALSE; Op.hNameMappings = NULL; Op.lpszProgressTitle = NULL; if (SHFileOperation (& Op) == 0) MessageBox ("Copy", "Tips", MB_OK | MB_ICONITION);
The above reasons should be the cause of the string, because the last character of the string is null, then SHFileOperation thinks it is still a file (SHFileOperation divides multiple files in NULL), then find the file later. Workaround: cstring strfrom = "f: //*.*"; int size = sizeof (strfrom); cchar fromBuff [Size 1]; Memcpy (fromBuff, strfrom, size); fromBuff [size] = 0x0; // If the remote length is greater than size, be sure to be such lptstr frombuf = (lpctstr) strFrom;