myspacee Posted October 6, 2008 Share Posted October 6, 2008 hello, made a script that rename a large amount of files, but want undertand if a file is open/in use/handled by a process before interact with him ... is possible ? thank you all, m. Link to comment Share on other sites More sharing options...
Andreik Posted October 6, 2008 Share Posted October 6, 2008 hello, made a script that rename a large amount of files, but want undertand if a file is open/in use/handled by a process before interact with him ... is possible ? thank you all, m.This is an example by Siao. ;~ by Siao Global Const $GENERIC_READ = 0x80000000 Global Const $GENERIC_WRITE = 0x40000000 Global Const $OPEN_EXISTING = 3 Global Const $FILE_ATTRIBUTE_NORMAL = 0x80 $file = "d:\Base\work.dat" If Not FileExists($file) Then Exit $hFile = DllCall("kernel32.dll", "hwnd", "CreateFile", _ "str", $file, _ "int", BitOR($GENERIC_READ, $GENERIC_WRITE), _ "int", 0, _ "ptr", 0, _ "int", $OPEN_EXISTING, _ "int", $FILE_ATTRIBUTE_NORMAL, _ "int", 0) If $hFile[0] = -1 Then MsgBox(48, "Warning", "File is open") Else DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile[0]) EndIf When the words fail... music speaks. Link to comment Share on other sites More sharing options...
littleclown Posted December 23, 2009 Share Posted December 23, 2009 Do somebody know this if this example work on network (administrative shares)? Thanks in advance Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now