Jump to content

DllCall


Jon
 Share

Recommended Posts

  • Administrators

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?

Link to comment
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.
Link to comment
Share on other sites

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?
Link to comment
Share on other sites

  • Administrators

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.

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...