Jump to content

[Solved] Question Re: _WinAPI_CreateFile()


Recommended Posts

i am currently using:

$handle = _WinAPI_CreateFile($filename, 2, 2)
if $handle then
  ;do process here
else
  msgbox(0,"warning","file can not be opened.")
endif

however i want to know how i can open $filename even if it has been opened by another application.

the fourth argument is $iAttributes with possible values: 1=file should be archived; 2=file is hidden; 4=file is read only; 8=file is part of or used exclusively by an operating system.

using 4 for $iAttributes won't allow me to open $filename if it is already open.

any help would be appreciated.

thanks!

Edited by DYONISII

http://dev.dyonisii.com/

Link to comment
Share on other sites

dantay9,

thanks for your quick reply. i can't use fileopen() because the files that i need to open may be as big as 4Gb or even larger. i am also using _WinAPI_CreateFile() in conjunction with _WinAPI_ReadFile().

further, if the file has been opened by another application, i am not allowed to close it. i just need to read from it, if it has been opened already.

Edited by DYONISII

http://dev.dyonisii.com/

Link to comment
Share on other sites

i am currently using:

$handle = _WinAPI_CreateFile($filename, 2, 2)
 if $handle then
   ;do process here
 else
   msgbox(0,"warning","file can not be opened.")
 endif

however i want to know how i can open $filename even if it has been opened by another application.

the fourth argument is $iAttributes with possible values: 1=file should be archived; 2=file is hidden; 4=file is read only; 8=file is part of or used exclusively by an operating system.

using 4 for $iAttributes won't allow me to open $filename if it is already open.

any help would be appreciated.

thanks!

$handle = _WinAPI_CreateFile($filename, 2, 2, 7)

cheers

I see fascists...

Link to comment
Share on other sites

rover,

thanks so much. i don't know why i totally forgot that the arguments can be added together LOL!

i tried 2, and it worked but wondered why 4 won't work. turns out 7 is the correct argument.

thanks so much.

now, my torrent maker is finally done!

Edited by DYONISII

http://dev.dyonisii.com/

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...