Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Code Comparison in VFP6 & VFP9
Message
 
To
04/09/2006 07:01:47
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:
01150673
Views:
23
>Dear Experts
>
>Flolloiwng codes are a part of my startup (main) prg.
>
>1-When I run bulid exe in VFP6, it work fine
>2-When I build exe in VFP9, it flushes and nothing happend.
>3-While removing these codes when I build exe in VFP9 then it work fine.
>
>What is wrong? If these codes do not work in VFP9, Please edit.
>
>Thanks in advance
>
>
>&& To make exe readonly attribute
>LCFILE=curdir()+"ACCOUNTS.EXE"
>#DEFINE FILE_ATTRIBUTE_READONLY 	0x01
>#DEFINE FILE_ATTRIBUTE_HIDDEN	0x02
>#DEFINE FILE_ATTRIBUTE_SYSTEM	0x04
>#DEFINE FILE_ATTRIBUTE_DIRECTORY	0x10
>#DEFINE FILE_ATTRIBUTE_ARCHIVE	0x20
>#DEFINE FILE_ATTRIBUTE_NORMAL	0x80
>#DEFINE FILE_ATTRIBUTE_TEMPORARY	0x0100
>DECLARE LONG SetFileAttributes IN WIN32API STRING FileName, LONG FileAttributes
>DECLARE LONG GetFileAttributes IN WIN32API STRING FileName

>IF SetFileAttributes (LCFILE, BITOR(lnFileAttributes, FILE_ATTRIBUTE_READONLY)) = 0
>* Error setting attributes
>	RETURN .F.
>ENDIF
>IF lnFileAttributes = -1
>	RETURN .F.
>ENDIF
>
The same as Martin suggest, but with little change of places:
DECLARE INTEGER FormatMessage IN "kernel32.dll" 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
* Error setting attributes
   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
Next
Reply
Map
View

Click here to load this message in the networking platform