Hi Tariq,
What return GetLastError()?
DECLARE INTEGER GetLastError IN kernel32
IF SetFileAttributes (LCFILE, BITOR(lnFileAttributes, FILE_ATTRIBUTE_READONLY)) = 0
?GetLastError()
RETURN .F.
ENDIF
IF lnFileAttributes = -1
?GetLastError()
RETURN .F.
ENDIF
MartinJ
>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
>
>
>
>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
>lnFileAttributes = GetFileAttributes (LCFILE)
>IF SetFileAttributes (LCFILE, BITOR(lnFileAttributes, FILE_ATTRIBUTE_READONLY)) = 0
>* Error setting attributes
> RETURN .F.
>ENDIF
>IF lnFileAttributes = -1
> RETURN .F.
>ENDIF
>