Administrators Jon Posted November 29, 2004 Administrators Posted November 29, 2004 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?
Henrik Posted November 29, 2004 Posted November 29, 2004 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.
SumTingWong Posted November 29, 2004 Posted November 29, 2004 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()orDLLLoad()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.
this-is-me Posted November 29, 2004 Posted November 29, 2004 (edited) Why not go with Valik's suggestion as well:http://www.autoitscript.com/forum/index.ph...indpost&p=33838Therefore 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 November 29, 2004 by this-is-me Who else would I be?
Administrators Jon Posted November 29, 2004 Author Administrators Posted November 29, 2004 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.
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