Sign in to follow this  
Followers 0
DYONISII

[Solved] Question Re: _WinAPI_CreateFile()

5 posts in this topic

#1 ·  Posted (edited)

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/

Share this post


Link to post
Share on other sites



Well, you can try fileclose. Also take a look at fileopen. It can be used easier than _WinAPI_CreateFile(). Just a suggestion.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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/

Share this post


Link to post
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...

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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/

Share this post


Link to post
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
Sign in to follow this  
Followers 0