onestcoder Posted October 15, 2007 Share Posted October 15, 2007 (edited) I am new to the dll calls. I would like to figure out how I can use this dll in my scripts.I'm trying to get this information from the FFACE.dllThese are the values i found at http://calamity-ls.com/fface/index.php?showtopic=21FFACE_API void GetTargetName( void* buffer, int* maxlength ) FFACE_API char GetTargetHPP( void ) FFACE_API float GetTargetPosX( void ) FFACE_API float GetTargetPosY( void ) FFACE_API float GetTargetPosZ( void ) FFACE_API float GetTargetPosH( void ) FFACE_API char GetTargetStatus( void ) FFACE_API short GetTargetId( void ) FFACE_API BOOL GetTargetSub( void )Here is an example in c# i thinkpublic static class TargetTools { [DllImport("FFACE.dll", EntryPoint = "GetTargetName")] private static extern void _TargetName(byte[] buffer, ref int size); public static string TargetName() { byte[] buffer = new byte[20]; int size = 20; _TargetName(buffer, ref size); return Encoding.ASCII.GetString(buffer, 0, size - 1); } [DllImport("FFACE.dll", EntryPoint = "GetTargetHPP")] public static extern byte HPP(); [DllImport("FFACE.dll", EntryPoint = "GetTargetPosX")] public static extern float PosX(); [DllImport("FFACE.dll", EntryPoint = "GetTargetPosY")] public static extern float PosY(); [DllImport("FFACE.dll", EntryPoint = "GetTargetPosZ")] public static extern float PosZ(); [DllImport("FFACE.dll", EntryPoint = "GetTargetPosH")] public static extern float PosH(); [DllImport("FFACE.dll", EntryPoint = "GetTargetStatus")] public static extern byte Status(); }I would like it if someone could point me in the right direction. THANK YOU Edited October 15, 2007 by onestcoder Need a website: http://www.iconixmarketing.com Link to comment Share on other sites More sharing options...
onestcoder Posted October 15, 2007 Author Share Posted October 15, 2007 I have search for examples, and I'm not sure what I'm looking for, I can't find an example. I want to use the dll the access the memory for some reads that the dll was created. I have found C# and VB examples, but I want to use the dll with autoit. Need a website: http://www.iconixmarketing.com Link to comment Share on other sites More sharing options...
onestcoder Posted October 15, 2007 Author Share Posted October 15, 2007 (edited) I can seem to get any values back Can someone point me to a script that, calls a dll function and returns a value from the memory based on that dll function? $dll = "FFACE.dll" $result = DllCall($dll, "uint", "GetTargetHPP") MsgBox(0, "Results", "Target HP:" & " " & $result) Edited October 15, 2007 by onestcoder Need a website: http://www.iconixmarketing.com Link to comment Share on other sites More sharing options...
murdock Posted October 15, 2007 Share Posted October 15, 2007 I'm not sure if this helps you, but you might have overlooked this in the help file: The return on DLLCalls: If the function call fails then @error is set to 1. Otherwise an array is returned that contains the function return value and a copy of all the parameters (including parameters that the function may have modified). $return[0] = function return value $return[1] = param1 $return[2] = param2 ... $return[n] = paramn Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 15, 2007 Moderators Share Posted October 15, 2007 (edited) I can seem to get any values back Can someone point me to a script that, calls a dll function and returns a value from the memory based on that dll function? $dll = "FFACE.dll" $result = DllCall($dll, "uint", "GetTargetHPP") MsgBox(0, "Results", "Target HP:" & " " & $result)If the function call fails then @error is set to 1. Otherwise an array is returned that contains the function return value and a copy of all the parameters (including parameters that the function may have modified). $return[0] = function return value $return[1] = param1 $return[2] = param2 ... $return[n] = paramn Edited October 15, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
onestcoder Posted October 15, 2007 Author Share Posted October 15, 2007 Thank you yes you are helping me learn. This is my first dll script. I all ways review the help files before I post a topic, I'm having trouble understanding. $dll = "FFACE.dll" $result = DllCall($dll, "int", "GetTargetHPP") MsgBox(0, "Results", "Target HP:" & " " & $result[0]) Ok i added the [0] and the the msg box returns a 0 now. It should return a value of 100 to be correct. Need a website: http://www.iconixmarketing.com Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 16, 2007 Moderators Share Posted October 16, 2007 Thank you yes you are helping me learn. This is my first dll script. I all ways review the help files before I post a topic, I'm having trouble understanding. $dll = "FFACE.dll" $result = DllCall($dll, "int", "GetTargetHPP") MsgBox(0, "Results", "Target HP:" & " " & $result[0]) Ok i added the [0] and the the msg box returns a 0 now. It should return a value of 100 to be correct.FFACE_API char GetTargetStatus( void )You are having it return an integer, this says char. You can try two things.... but I'd first try this:$dll = "FFACE.dll" $result = DllCall($dll, "str", "GetTargetHPP") If @error Then MsgBox(16, "Error", "Error = " & @error) Else MsgBox(0, "Results", "Target HP:" & " " & $result[0]) EndIf Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
onestcoder Posted October 17, 2007 Author Share Posted October 17, 2007 >< this crashes autoit What was the other idea, or can you see the problem? Need a website: http://www.iconixmarketing.com Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 17, 2007 Moderators Share Posted October 17, 2007 What version of autoit are you using? Might try str:cdecl Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
onestcoder Posted October 17, 2007 Author Share Posted October 17, 2007 I'm running v3.2.8.1. I tried str:cdecl and autoit is crashing still >< This is the last script I tried $Dll_File = DllOpen("FFACE.dll") $result = DllCall($Dll_File, "str:cdecl", "GetPlayerHP") If @error Then MsgBox(16, "Error", "Error = " & @error) Else MsgBox(0, "Results", "Target HP:" & " " & $result[0]) EndIf DllClose($Dll_File) Need a website: http://www.iconixmarketing.com 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