Hello,
I have a thread inside a DLL that performs on demand the task of running a .BAT file which in turn generates a .ZIP file. This .ZIP file has a standard name of "result.zip". After the batch file has run I copy the result.zip file to a specified location (usually a network location like \ipaddress\sharedfolder\renamed_result.zip).
This code works perfectly on my machine (Win XP single core) but doesn't work at all on another machine (Win 2003 dual core). The error message I get on the other machine is "Error code 1223: Operation cancelled by the user" or something like that, but the actual error is "Access Denied or Disk Full" - this is what appears on the message when I turn off the FOF_SILENT flag.
Intrigued by this weird behaviour I made an application JUST with the SHFILEOPERATION code in which I decide (via TEdits) the files to copy from and to. Well, this application WORKS in both machines. I have made 100% sure that the files are exactly the same as on my standalone app and the DLL (the first works, the latter doesn't).
Does anyone has any other suggestion on this matter? Here is the code:
var
F : TShFileOpStruct;
R : Integer;
begin
F.Wnd := GetActiveWindow;
F.wFunc := FO_COPY;
F.pFrom := PAnsiChar(MYFROM + #0#0); // Double Null-Terminate
F.pTo := PAnsiChar(MYTO + #0#0); // Double Null-Terminate
F.fFlags := FOF_RENAMEONCOLLISION or FOF_NOCONFIRMATION or FOF_NOCONFIRMMKDIR or FOF_SILENT;
R := ShFileOperation(F);
if R = 0 then
SUCCESS
else
ERROR(R);
end;