* W2KBugTest.PRG #DEFINE hcCurrDir SYS(5) + CURDIR() MD _Test1 MD _Test2 CREATE TABLE _Test1\Test ; (cTest C(20)) INSERT INTO Test ; (cTest) ; VALUES ; ("VFP table lock") USE IN Test CREATE TABLE _Test2\Test ; (cTest C(10)) INSERT INTO Test ; (cTest) ; VALUES ; ("Test 2") CLOSE DATABASES ALL SET EXCLUSIVE OFF USE _Test1\Test SHARED DO WHILE NOT FLOCK() MESSAGEBOX(MESSAGE()) ENDDO MESSAGEBOX("table is locked :"+TRANSFORM(ISFLOCKED())+0hD0A + "replace it with explorer") * Try to copy _Test2\Test.dbf over top of _Test1\Test.dbf while the latter is open: * Following line should fail, because target file is in use: * Following line DOES fail with EXCLUSIVE OFF or ON, so is commented out here: *!* COPY FILE _Test2\Test.DBF TO _Test1\Test.DBF * Try the File System Object (presumably the same as what underlies Windows Explorer): loFSO = CREATEOBJECT("Scripting.FileSystemObject") loFSO.CopyFile(hcCurrDir + "_Test2\Test.dbf",DBF("Test")) RELEASE loFSO * Note that the preceding CopyFile call fails if SET EXCLUSIVE is ON =MESSAGEBOX("Test table "+DBF("Test")+" has been overwritten while open," + CHR(13) + ; "but its cTest value is still: " + Test.cTest, ; 0 + 64 + 0, ; "Step 1") USE IN Test USE _Test1\Test =MESSAGEBOX("Test table "+DBF("Test")+" has been closed, and re-opened." + CHR(13) + ; "Its cTest value is now: " + Test.cTest, ; 0 + 64 + 0, ; "Step 2") CLOSE TABLES ALL ERASE _Test1\Test.DBF ERASE _Test2\Test.DBF RD _Test1 RD _Test2