Changing file attributes at runtime 
Author Message
 Changing file attributes at runtime

Is there a Windows API call that can be used to remove a READONLY file
attribute.  Using the DOS RUN('attrib.exe -r filename',1) command causes dos
windows to pop open and close which does not look good.

If not, how else can it be done.

Thanks,
Lance



Mon, 03 Nov 2003 12:26:26 GMT  
 Changing file attributes at runtime
Hi Lance,

There are a few API calls that you can use.
Look at SetFileAttributes and GetFileAttributes in the MSDN.

John Gorter
Assist BV.



Quote:
> Is there a Windows API call that can be used to remove a READONLY file
> attribute.  Using the DOS RUN('attrib.exe -r filename',1) command causes
dos
> windows to pop open and close which does not look good.

> If not, how else can it be done.

> Thanks,
> Lance



Mon, 03 Nov 2003 18:52:42 GMT  
 Changing file attributes at runtime
Lance,

look at
Programers Guide PDF
   Part II
      Chapter 14 (API Calls...)
         Standard C Functions in Clarion's Runtime Library,
            Low-Level File Manipulation
               chmod.

Goran Lazic


Quote:
> Is there a Windows API call that can be used to remove a READONLY file
> attribute.  Using the DOS RUN('attrib.exe -r filename',1) command causes
dos
> windows to pop open and close which does not look good.

> If not, how else can it be done.

> Thanks,
> Lance



Mon, 03 Nov 2003 23:17:41 GMT  
 Changing file attributes at runtime
Thanks to the help.

Found my answer on the .products.c55ee newsgroup.

Thanks to Maarten.

Lance

++++++++++++++++++++++

-32 bit - !
LPCSTR      EQUATE(CSTRING)
BOOL           EQUATE(SIGNED)
DWORD       EQUATE(ULONG)

  MODULE('Windows.DLL')
    GetFileAttributesA(*LPCSTR),DWORD,Pascal,RAW
    SetFileAttributesA(*LPCSTR,DWORD),BOOL,PASCAL,RAW
  END

Data......................
RetVal    BOOL
ImgFil     LPCSTR
Attrib       DWORD
Code......................
    ImgFil = 'C:\Images\ImageFile.Jpg'
    Attrib   = ff_:READONLY                    !ff_:NORMAL
    RetVal = SetFileAttributesA(ImgFil, Attrib)

--
Best regards,
Maarten
CDD3.1, C5EEb - ABC & C5.5EEgold
Certainly Clarion Developer



Tue, 04 Nov 2003 15:20:14 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Changing Required attribute at runtime

2. Copying files, changing attributes (CW20)

3. Copying files, changing attributes (CW20)

4. Copying files / changing attributes (CW20)

5. Copying files and changing attributes (cw20)

6. C4 ABC - Change of file attribute

7. Change File Attributes

8. changing file directory at runtime without using a variable in prop:name

9. Change File Driver at Runtime

10. removing MDI window attribute at runtime

11. Set Required attribute at runtime

12. Setting file attributes and Copying files

 

 
Powered by phpBB® Forum Software