Jump to content
Sign in to follow this  
Proph

Help With DllCall...

Recommended Posts

Proph

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.

Share this post


Link to post
Share on other sites
PaulIA

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

Share this post


Link to post
Share on other sites
Kogmedia

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

Share this post


Link to post
Share on other sites
Proph

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.

Share this post


Link to post
Share on other sites
PaulIA

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

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  

×