Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Procedure to protect - unprotect database
Message
De
09/02/2007 09:50:22
 
 
À
09/02/2007 01:43:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01193965
Message ID:
01194054
Vues:
19
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform