Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Code Comparison in VFP6 & VFP9
Message
 
To
05/09/2006 03:08:25
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01150666
Message ID:
01150830
Views:
21
I mean to combine both examples mine and Martin's, but try this:
&& To make exe readonly attribute
LCFILE=curdir()+"ACCOUNTS.EXE"
#DEFINE FILE_ATTRIBUTE_READONLY 0x01
#DEFINE FILE_ATTRIBUTE_HIDDEN0x02
#DEFINE FILE_ATTRIBUTE_SYSTEM0x04
#DEFINE FILE_ATTRIBUTE_DIRECTORY0x10
#DEFINE FILE_ATTRIBUTE_ARCHIVE0x20
#DEFINE FILE_ATTRIBUTE_NORMAL0x80
#DEFINE FILE_ATTRIBUTE_TEMPORARY0x0100
DECLARE INTEGER GetLastError   IN WIN32API 
DECLARE LONG SetFileAttributes IN WIN32API STRING FileName, LONG FileAttributes
DECLARE LONG GetFileAttributes IN WIN32API STRING FileName
DECLARE INTEGER FormatMessage  IN WIN32API INTEGER flags,;
                                           INTEGER notused,;
                                           INTEGER error,;
                                           INTEGER locale,;
                                           STRING @buffer,;
                                           INTEGER bufsize,;
                                           INTEGER notused

lnFileAttributes = GetFileAttributes (LCFILE)
IF lnFileAttributes = -1
   nLastError=GetLastError()
   cError=SPACE(255)
   =FormatMessage(4096,0,nLastError,0,@cError,255,0)
   cError = ALLTRIM(STRTRAN(cError,CHR(0)))
   WAIT WINDOW 'Error #: '+ALLTRIM(STR(nLastError))+CHR(13)+'Error Msg: '+cError
   RETURN .F.
ENDIF

IF SetFileAttributes (LCFILE, BITOR(lnFileAttributes,FILE_ATTRIBUTE_READONLY)) = 0
   nLastError=GetLastError()
   cError=SPACE(255)
   =FormatMessage(4096,0,nLastError,0,@cError,255,0)
   cError = ALLTRIM(STRTRAN(cError,CHR(0)))
   WAIT WINDOW 'Error #: '+ALLTRIM(STR(nLastError))+CHR(13)+'Error Msg: '+cError
   RETURN .F.
ENDIF
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform