Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How To Use API "CopyFile" in Foxpro 2.6 ?

Status
Not open for further replies.

pepmarti

Programmer
Apr 2, 2001
31
ES
I need to know how to use the API "CopyFile"
in foxpro 2.6.
pepmarti@teleline.es
Thanks

 
DECLARE LONG CopyFile IN WIN32API STRING lpExistingFileName, STRING lpNewFileName, LONG bFailIfExists

lnRetval = CopyFile("c:\autoexec.bat", "d:\autoexec.bat", 1)
IF lnRetval = 1
MESSAGEBOX("File Copied")
ELSE
MESSAGEBOX("Error")
ENDIF
-----------------------------------------------------
Note that the native COPY FILE takes less programming.

COPY FILE fromFile toFile

REMEMBER TO ADD FILE EXTENSION AND AS TEXTS (EXAMPLE fromFile = "MyDBF.DBF" etc.) WildCard characters will not function ... Caution !
-----------------------------------------------------
You can also use the run command and do the native OS command
Example: RUN XCOPY fromDir toDir /s
-----------------------------------------------------

ramani


ramani :)
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
IF you are speaking of FPD (FoxPro DOS), I know of no way to do this. If you are using FPW (FoxPro for Windows), then there may be an answer.

Unfortunately it's not a &quot;simple&quot; Foxtools call. Because &quot;CopyFile&quot; is in Kernel32.dll which is a 32-bit .DLL, you can't directly call it from FPW - a 16-bit environment. If you want to try, first go to Rick Strahl's site and get Call32 - it allows you to call Win32 functions from FPW 2.x. I've had some luck with this routine for some API calls, but others &quot;hung&quot; the system <s>.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top