Code:
// Copy the picture file to the system directory.
ZeroMemory(&fop, sizeof(SHFILEOPSTRUCT)); // this is just for testing.
fop.hwnd = hwnd;
fop.wFunc = FO_COPY;
//test
//strcat(pPath2Pic, "\0");
fop.pFrom = pPath2Pic; //Path2Pic
// Change path to new dir. with picture name and ext.
strcpy(pCopyTo, "\0");
//test
strcat(DF.Path2SystemsDirSystemID, "\0");
strcpy(pCopyTo, DF.Path2SystemsDirSystemID);
strcat(pCopyTo, "\\");
strcat(pCopyTo, pPartNumber);
strcat(pCopyTo, pFileExt);
strcat(pCopyTo, "\0");
fop.pTo = pCopyTo;
fop.fFlags = FOF_NOCONFIRMATION; // Add flag FOF_NOCONFIRMATION for no confirmation
test = SHFileOperation (&fop); // RETURNS 0 for SUCCESS, != 0 failure.
// Do not use GetLastError with the return values of this function.
if((fop.fAnyOperationsAborted) || test)
{
MessageBox(NULL, "Error copying picture file!", "Error:", MB_OK);
}
Here is what the debugger says the values are:
+ pFrom 0x0048b0d8 "D:\__My_Users\_Jon\__My_Documents\Desktop\TF_VG_4 51T_SS_CENTER\450-110-Steel.jpg" const char *
+ pTo 0x0017f1d8 "d:\__Programming\__MSVS_Projects\Storefront Estimation Program_CURRENT\Data\Systems\system1\450-110-Steel.JPG" const char *
The error message says otherwise:
This path is the path to my project not the file. What gives?
/edit
fop.fAnyOperationsAborted = 1
test = 5
This occurs on the 6th iteration of this proceedure!