Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Procedure to protect - unprotect database
Message
From
09/02/2007 09:50:22
 
 
To
09/02/2007 01:43:24
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01193965
Message ID:
01194054
Views:
20
No, it won't work and here's why. User 1 launches your application and changes the file so it can be USEd. Then User 2 double clicks on it in Windows Explorer and opens the file.

>Dear Experts.
>
>I copy following two procedures from a Foxbase prg. All of the DBF files work fine within Exe. But when someone try to open them by double clicking or even in Foxpro then a message appears "Not a dbf file".
>
>May be this is a good trick to avoid databaes files to open without exe.
>Is it possible to use this or such other procedure within Visual Foxpro.
>
>&& FUNCTION PROTECT
>
>PARAMETERS FN
>BUFFER=" "
>HANDLE=FOPEN(FN,2)
>IF HANDLE>-1
>   FREAD(HANDLE,@BUFFER,1)
>   FBYTE=ASC(BUFFER)
>   FSEEK(HANDLE,0,0)
>   IF FBYTE=3
>      FWRITE(HANDLE,CHR(26),1)
>   ENDIF
>   FCLOSE(HANDLE)
>ENDIF
>RETURN .T.
>
>
>* Function Unprotect
>
>PARAMETERS FN
>BUFFER=" "
>HANDLE=FOPEN(FN,2)
>IF HANDLE>-1
>   FREAD(HANDLE,@BUFFER,1)
>   FBYTE=ASC(BUFFER)
>   FSEEK(HANDLE,0,0)
>   IF FBYTE=26
>      FWRITE(HANDLE,CHR(03),1)
>   ENDIF
>   FCLOSE(HANDLE)
>ENDIF
>RETURN .T.
>
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Reply
Map
View

Click here to load this message in the networking platform