Jump to content

dll calls


Recommended Posts

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

These are the values i found at http://calamity-ls.com/fface/index.php?showtopic=21

FFACE_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 think

public 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 by onestcoder

Need a website: http://www.iconixmarketing.com

Link to comment
Share on other sites

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

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 by onestcoder

Need a website: http://www.iconixmarketing.com

Link to comment
Share on other sites

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

  • Moderators

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

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

  • Moderators

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

  • Moderators

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

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

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