Jump to content

Recommended Posts

Posted

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.

Posted

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
Posted

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.

Posted

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

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
×
×
  • Create New...