Sokko Posted April 15, 2007 Posted April 15, 2007 I'm not very learned in the ways of DLL calling, so I have a few questions for the experts here. 1) If a DLL function accepts a pointer as a parameter that, after the function returns, will point to some return value, how do you handle that? Structs? 2) What happens if you need a pointer inside a struct? MSDN always says you need a "pointer to a string" or a "pointer to an array" instead of an actual string or array. Does AutoIt handle this automatically? 3) How do you get a string into a struct, anyway? What about Unicode strings? (for example the "PCWSTR" type, which apparently is a pointer to a Unicode string) 4) What should you do if a piece of a struct is a "union{...}" of two different types, and the function expects it to be one type or the other based on some other parameter? Do you just use the single type that matches the way you're using it? 5) If you don't want or know how to use a callback function, what types/values should be used in a struct for a "pointer to a callback function" and a "pointer to application-defined reference data"? Answers and/or explanations for any of these questions are much appreciated. Thanks!
piccaso Posted April 15, 2007 Posted April 15, 2007 look into this library.PaulAI already translated many API'sto 5:The type for a callback would be "ptr" but autoit doesent support callbacks.There is no simple explanation for DllCalling but there are many examples on this forum. CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Richard Robertson Posted April 16, 2007 Posted April 16, 2007 That is a nice library. If only Microsoft could be more efficient too. With Jon on the Microsoft team now though, will AutoIt become a Windows Professional version option?
Sokko Posted April 16, 2007 Author Posted April 16, 2007 Thanks for that library, Piccaso, but unfortunately it doesn't contain any of the functions I'm looking at (most of them are new to Vista, which probably explains a lot).
piccaso Posted April 16, 2007 Posted April 16, 2007 which functions are you after? CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Sokko Posted April 16, 2007 Author Posted April 16, 2007 (edited) The one that initially prompted me to make this post was TaskDialogIndirect. All five things I asked about are somehow involved in this function. (I am also interested in the functions that deal with NTFS transactions, but one thing at a time) Edited April 16, 2007 by Sokko
Richard Robertson Posted April 16, 2007 Posted April 16, 2007 (edited) If you give us the function declarations, we can translate them with maybe a little extra info such as struct declarations. Eck, you posted a minute before me. I'll get to work translating. Edited April 16, 2007 by Mr Icekirby
Richard Robertson Posted April 16, 2007 Posted April 16, 2007 Well, I took a look and I don't know how to translate unions into AutoIt. I also never looked into the callbacks so I can't help you there either. I would probably write a C++ dll with a much simpler function that loads the parameters into the struct.
piccaso Posted April 16, 2007 Posted April 16, 2007 unions are possiblehttp://www.autoitscript.com/forum/index.php?showtopic=22303but that struct looks painfull to translate CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Sokko Posted April 17, 2007 Author Posted April 17, 2007 unions are possiblehttp://www.autoitscript.com/forum/index.php?showtopic=22303Ah, I see. Going on what Valik said there, it looks like if both members of the union are the same size, you can just use whichever one you want. At least, I assume that a pointer and a handle would both be "int" (see hMainIcon and pszMainIcon).
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