Page 1 of 1

API Copy problem

Posted: Wed Feb 14, 2007 6:53 am
by trather
I don't understand what is happening. Have have this API code that I have used in the past. Now when I use PB 4.02 and try to use it sometimes it works other times it comes back and says that it can't find the file name. I have no idea what is wrong. Can someone take a look at the code and see if they see anything wrong with it. I can get it to work fine when it is all by itself but when I put other procedure with it and then call those procedure before it something happens and then it keeps telling me that it can't read the file on the disk.

[code]
Procedure.l C_To_Dir(FromLoc.s, Toloc.s)

Switches.SHFILEOPSTRUCT ;Windows API Structure
File_From.s = FromLoc
File_Dest.s = Toloc

FromDirectory.s = File_From
ToDirectory.s = File_Dest

Switches\wFunc = #FO_COPY

Switches\pFrom = @FromDirectory
Switches\pTo = @ToDirectory

Switches\fFlags = #FOF_NOCONFIRMATION | #FOF_NOCONFIRMMKDIR

Error.l = SHFileOperation_(Switches)
ProcedureReturn Error
EndProcedure

Error.l = C_To_Dir("C:\test4\test.exe","C:\test\testagain.exe")
[/code]

Posted: Wed Feb 14, 2007 8:34 am
by Bonne_den_kule

Code: Select all

Error.l = SHFileOperation_(@Switches)

code change

Posted: Wed Feb 14, 2007 12:55 pm
by trather
call line should read like this.

Code: Select all

 result.l = C_To_Dir("C:\test4\test.exe","C:\test\testagain.exe")