Copying files, changing attributes (CW20) 
Author Message
 Copying files, changing attributes (CW20)

I would like to know how to copy files and change file attributes without using
the RUN command. I recently got a reply telling me that there was an API that I
could use but I have not been able to get more information on it. Do I need to
buy additional software to be able to use APIs? Is there information that lists
the functions available on APIs or how to use them?
Any help is appreciated.


Tue, 28 May 2002 03:00:00 GMT  
 Copying files, changing attributes (CW20)
Quote:

> I would like to know how to copy files and change file attributes without using
> the RUN command. I recently got a reply telling me that there was an API that I
> could use but I have not been able to get more information on it. Do I need to
> buy additional software to be able to use APIs? Is there information that lists
> the functions available on APIs or how to use them?
> Any help is appreciated.

The two apis you need are copyfile() and setfileattribute()
You dont need to buy anything.
Open the programmers manual to the API/C chapter and read.
You can get information for free about the api functions themself from
msdn.microsoft.com
I havent looked at the sample apps recently but there use to be a CD player one
that had a few api calls in it to serve as an example.

Jim Kane  - TeamTopSpeed
Productive Software Solutions
Can't Find that Message?
Get Organized, Get ForKeeps!
www.fkeeps.com



Tue, 28 May 2002 03:00:00 GMT  
 Copying files, changing attributes (CW20)
Hi Jvarela,
This clw file will show the functions in 32 bit only
If you want to use it in 16 bit, remove the A from
CopyFileA &? SetFileAttributesA
Hope this helps
John
?
?

PROGRAM

?? INCLUDE('Equates.CLW')
?? INCLUDE('TplEqu.CLW')
?? INCLUDE('Keycodes.CLW')
?? INCLUDE('Errors.CLW')
FILE_ATTRIBUTE_READONLY?? EQUATE(1)
?? MAP
???? MODULE('')
???????? CopyFileA(*CSTRING,*CSTRING,BOOL),BOOL,Pascal,RAW
???????? SetFileAttributesA(*CSTRING,ULONG),BOOL,PASCAL,RAW
???? END
?? END
FROMFILE?? CSTRING(128)
TOFILE???? CSTRING(128)
Window WINDOW('Testfiles'),AT(,,185,92),FONT('MS Sans Serif',8,,FONT:regular),CENTER,GRAY
?????? BUTTON('Close'),AT(132,68,44,14),USE(?close),FONT('Arial',12,,FONT:bold,CHARSET:ANSI),STD(STD:Close)
???? END
?? CODE
?? FROMFILE ='C:\AUTOEXEC.BAT'
?? TOFILE ='F:\AUTOEXEC.BAK'
?? OPEN(WINDOW)
?? ACCEPT
?? END
?? IF NOT COPYFILEA(FROMFILE,TOFILE,0) ;END
?? IF NOT SetFileAttributesA(TOFILE,FILE_ATTRIBUTE_READONLY) ;END
?
?

John
?
?
?

Quote:

> I would like to know how to copy files and change file attributes without using
> the RUN command. I recently got a reply telling me that there was an API that I
> could use but I have not been able to get more information on it. Do I need to
> buy additional software to be able to use APIs? Is there information that lists
> the functions available on APIs or how to use them?
> Any help is appreciated.



Thu, 30 May 2002 03:00:00 GMT  
 Copying files, changing attributes (CW20)
Thanks for your help.


Fri, 31 May 2002 03:00:00 GMT  
 Copying files, changing attributes (CW20)
Thanks John.
The sample program works great in 32-bit. I tried changing the program to
16-bit but I get this message:

SETFILEATTRIBUTES is unresolved in file copyfile.obj
COPYFILE is unresolved in file copyfile.obj

where copyfile.obj is the name of the executable.

I tried reading the Programer's Guide API and  inserted the lines:
INCLUDE('WINAPI.CLW','EQUATES')
INCLUDE('WINAPI.CLW','PROTOTYPES')
INCLUDE('CLIB.CLW')

I also tried getting information from msdn.microsoft.com on copyfile 16-bit but
did not find any.

As you can tell I don't know much about calling APIs but it seems that I need
the name of the DLL or OBJ file that contains the CopyFile function and link
it. I would like to use these functions in 16-bit and learn more about other
available API functions and how to use them.

Any additional help/pointers is greatly appreciated.

Quote:
>Hi Jvarela,
>This clw file will show the functions in 32 bit only
>If you want to use it in 16 bit, remove the A from
>CopyFileA &? SetFileAttributesA
>Hope this helps
>John
>?
>?

>PROGRAM

>?? INCLUDE('Equates.CLW')
>?? INCLUDE('TplEqu.CLW')
>?? INCLUDE('Keycodes.CLW')
>?? INCLUDE('Errors.CLW')
>FILE_ATTRIBUTE_READONLY?? EQUATE(1)
>?? MAP
>???? MODULE('')
>???????? CopyFileA(*CSTRING,*CSTRING,BOOL),BOOL,PASCAL,RAW
>???????? SetFileAttributesA(*CSTRING,ULONG),BOOL,PASCAL,RAW
>???? END
>?? END
>FROMFILE?? CSTRING(128)
>TOFILE???? CSTRING(128)
>Window WINDOW('Testfiles'),AT(,,185,92),FONT('MS Sans
>Serif',8,,FONT:regular),CENTER,GRAY
>??????
>BUTTON('Close'),AT(132,68,44,14),USE(?close),FONT('Arial',12,,FONT:bold,C

HARSET:ANSI),STD(STD:Close)

- Show quoted text -

Quote:
>???? END
>?? CODE
>?? FROMFILE ='C:\AUTOEXEC.BAT'
>?? TOFILE ='F:\AUTOEXEC.BAK'
>?? OPEN(WINDOW)
>?? ACCEPT
>?? END
>?? IF NOT COPYFILEA(FROMFILE,TOFILE,0) ;END
>?? IF NOT SetFileAttributesA(TOFILE,FILE_ATTRIBUTE_READONLY) ;END
>?
>?

>John
>?
>?
>?


>> I would like to know how to copy files and change file attributes without
>using
>> the RUN command. I recently got a reply telling me that there was an API
>that I
>> could use but I have not been able to get more information on it. Do I need
>to
>> buy additional software to be able to use APIs? Is there information that
>lists
>> the functions available on APIs or how to use them?
>> Any help is appreciated.



Sun, 02 Jun 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Copying files, changing attributes (CW20)

2. Copying files / changing attributes (CW20)

3. Copying files and changing attributes (cw20)

4. CW2.003 File copy changes the date.....need a way to copy w/o date change

5. Setting file attributes and Copying files

6. CW2.003 Copy file changes file date

7. Changing file attributes at runtime

8. C4 ABC - Change of file attribute

9. CW20 List Boxes w/ Mark Attribute

10. Change File Attributes

11. CW20: Printing Mutiple Copies of a Report

12. Copy file without date change.

 

 
Powered by phpBB® Forum Software