Sign in to follow this  
Followers 0
Jon

DllCall

6 posts in this topic

Some DLLs (like AutoItX) perform specific functions when loading/unloading (AutoitX resets to defaults for example). At the moment DLL loads the dll at the start of the call and unloads at the end. So we need a way to indicate that we don't want to unload a dll (and I'll have to write a routine to keep track of what is loaded, and how many times etc).

I could add another parameter at the start, but it's kinda parameter heavy as it is. Maybe a symbol in the name of the dll to indicate not to unload it?

DllCall("mydll.dll|nounload"...)

or something?

Share this post


Link to post
Share on other sites



IIRC, Larry's approach is equal to provide AutoIt wrapping for the Win32 API way of getting and releasing DLLs. I'm in favour of that, no reason to re-invent the wheel.


Ignorance is strength.

Share this post


Link to post
Share on other sites

I like Larry's idea as well.

Share this post


Link to post
Share on other sites

I am tempted to do dll like files. keep track of the handles and release them at script exit... Give the user the option of loading and unloading...

$hDLL = DllLoad("mydll.dll")

DLLCall($hDLL,"int","MyFunc")

DllClose($hDLL)

where, if you supply a dll name instead of a handle it opens and closes... like the file functions...

thoughts?

Lar.

edit: perhaps...

DLLOpen()

DLLClose()

or

DLLLoad()

DLLUnload()

Lar.

<{POST_SNAPBACK}>

For compatibility and lazy people like me, can I suggest that DllCall takes both a handle and a filename. If a handle then leave opened until the handle is closed by DllUnload and if filename then unload at the end of DllCall. This is consistent with other AutoIT functions such as FileWriteLine.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Why not go with Valik's suggestion as well:

http://www.autoitscript.com/forum/index.ph...indpost&p=33838

Therefore the completed code would look like this:

$import = DllLoad("_ImpMsgBox", "user32.dll", "int", "MessageBox", "int", "str", "str", "int")
; The types may be wrong, just an example, after all
_ImpMsgBox(0, "MsgBox Text", "MsgBox Title", 4096)
DllUnload($import)
Edited by this-is-me

Who else would I be?

Share this post


Link to post
Share on other sites

For compatibility and lazy people like me, can I suggest that DllCall takes both a handle and a filename. If a handle then leave opened until the handle is closed by DllUnload and if filename then unload at the end of DllCall. This is consistent with other AutoIT functions such as FileWriteLine.

I like it.

DllOpen + Close, and DllCall to take handle or filename.

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