Jump to content

Help With DllCall...


Recommended Posts

I am having a hard time understanding how to use dllcalls. I found what looks to be a simple function that would be handy to use... which let's you unlock files if they are in use. The dll's original function is this:

kernel32.dll

BOOL UnlockFile(
  HANDLE hFile,
  DWORD dwFileOffsetLow,
  DWORD dwFileOffsetHigh,
  DWORD nNumberOfBytesToUnlockLow,
  DWORD nNumberOfBytesToUnlockHigh
);

Can someone show me what this would look like in autoit as a function?

Thanks.

Link to comment
Share on other sites

I am having a hard time understanding how to use dllcalls. I found what looks to be a simple function that would be handy to use... which let's you unlock files if they are in use. The dll's original function is this:

kernel32.dll

BOOL UnlockFile(
  HANDLE hFile,
  DWORD dwFileOffsetLow,
  DWORD dwFileOffsetHigh,
  DWORD nNumberOfBytesToUnlockLow,
  DWORD nNumberOfBytesToUnlockHigh
);

Can someone show me what this would look like in autoit as a function?

Thanks.

UnlockFile does not allow you to unlock files that are in use. It is used in conjunction with LockFile to lock/unlock regions of a file so that you have exclusive access to that region. See here for more information on this API function.
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

UnlockFile does not allow you to unlock files that are in use. It is used in conjunction with LockFile to lock/unlock regions of a file so that you have exclusive access to that region. See here for more information on this API function.

http://ccollomb.free.fr/unlocker
[font="Verdana"]Keith (Kogmedia)[/font]My ScriptQuick Search - Internet / Hard Drive Search
Link to comment
Share on other sites

UnlockFile does not allow you to unlock files that are in use. It is used in conjunction with LockFile to lock/unlock regions of a file so that you have exclusive access to that region. See here for more information on this API function.

Woops... you are right.

@Kogmedia Yes I know about unlocker. :) But if I used a third party tool like that in my script it wouldn't be very pretty. I was hoping to find a way in autoit to do it. so that when I delete a directory I can make sure it is 100% deleted by unlocking it.

Link to comment
Share on other sites

Woops... you are right.

@Kogmedia Yes I know about unlocker. :) But if I used a third party tool like that in my script it wouldn't be very pretty. I was hoping to find a way in autoit to do it. so that when I delete a directory I can make sure it is 100% deleted by unlocking it.

You can do this in AutoIt. You need to find the process that has the file open and then kill the process to free the file.
Auto3Lib: A library of over 1200 functions for AutoIt
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...