dougmoran Posted July 4, 2014 Share Posted July 4, 2014 Sorry I'm asking this again. Don't want to bug you good people but I still can't find a way to solve this problem. I am calling a function in a DLL using DllCall in AutoIT. The function's return type is a pointer to an array of bytes. I've tried everything I can think of to try to get the actual array but nothing works. I don't have the source code for the DLL, only the header. I am using OpenDll and getting @error=0 The function has two parameters and they are being set as expected by the function. How can I get to the data that the DLL is returning a pointer to? Link to comment Share on other sites More sharing options...
JohnOne Posted July 5, 2014 Share Posted July 5, 2014 Show code. Please, all of "I've tried everything" it. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Solution funkey Posted July 5, 2014 Solution Share Posted July 5, 2014 Some example code how to do it in general: Global $aRet = DllCall("example.dll", "ptr", ...) Global $tResult = DllStructCreate("byte array[20]", $aRet[0]) For $i = 1 To DllStructGetSize($tResult) ConsoleWrite(DllStructGetData($tResult, 1, $i) & @LF) Next Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
corz Posted July 5, 2014 Share Posted July 5, 2014 It's not possible to be specific without seeing the code, but this reminds me of a similar issue from the past, which was fixed by using the correct calling method, i.e. "cdecl". ;o) Cor nothing is foolproof to the sufficiently talented fool.. Link to comment Share on other sites More sharing options...
dougmoran Posted July 5, 2014 Author Share Posted July 5, 2014 New Dad, Thank you so much for that code snippet. It works perfectly!!! It saved me from having to rewrite my app in C, so I owe you big-time. If you're ever in the San Diego area look me up and I'll buy the beers. And congrats on being a new dad! Doug Link to comment Share on other sites More sharing options...
funkey Posted July 7, 2014 Share Posted July 7, 2014 New Dad, Thank you so much for that code snippet. It works perfectly!!! It saved me from having to rewrite my app in C, so I owe you big-time. If you're ever in the San Diego area look me up and I'll buy the beers. And congrats on being a new dad! Doug You are welcome. I'm glad I could help you. I was in San Diego in 2012, but I don't think I will ever be there again, because world is just to big. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
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