Sign in to follow this  
Followers 0
onestcoder

DLL Call

19 posts in this topic

How can i do a dll call in autoit like this example from C#

C#

[DllImport("FFACE.dll", EntryPoint = "GetSpellRecast")]
public static extern short SpellRecast(eSpellList index);

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

Share this post


Link to post
Share on other sites



:)

how about DllCall()? :P

Share this post


Link to post
Share on other sites

why did you post THREE!!!!! times???

that is a sure fired way to get a bunch of smart ass answers instead of useful answers.

Share this post


Link to post
Share on other sites

why did you post THREE!!!!! times???

that is a sure fired way to get a bunch of smart ass answers instead of useful answers.

I'm quite sure he didn't intend to post it 3 times, if you look at the times of posts, they were really close together which means he probably had a lag in posting.

@OP, I deleted the other two.


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.

Share this post


Link to post
Share on other sites

:)

how about DllCall()? :P

My dsl was acting up and I didnt know is posted until it was to late


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

Share this post


Link to post
Share on other sites

My dsl was acting up and I didnt know is posted until it was to late

Don't mind me, I'm just an ass...

Every now and then, we get somebody double posting, thinking, somehow this will get them an answer quicker.

Since you were not doing that, I am sorry for jumping to conclusions :)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

*snip* already found it sorry :)

Edited by timgames

Share this post


Link to post
Share on other sites

i get a value of "0" when i should get "782"

$dll = DllOpen("FFACE.dll")
$result = DllCall($dll, "int", "GetPlayerHPMax")
msgbox(0, "", $result[0])  ; number of chars returned
DllClose($dll)

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

Share this post


Link to post
Share on other sites

i get a value of "0"

Try this:

$dll = DllOpen("FFACE.dll")
$result = DllCall($dll, "int", "GetPlayerHPMax", "int", 0, "int", 0)
msgbox(0, "", $result[0])  ; number of chars returned
DllClose($dll)

But i am not sure, i can not test it, also because i don't have FFACE.dll.


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I tried it but the code you provided just stalled and closed. Then i tried it with int:cdecl and it still came back as "0"

I read used PE Explore on the dll and found that it entry point is "10002DF0h" and the index is "105" can i use this information?

Edited by onestcoder

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

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

i get a value of "0" when i should get "782"

I am assuming it has to do with this http://calamity-ls.com/wiki/index.php/Main_Page DLL/project.

As I have no active FFXI subscription at the moment, I cannot fully test it, but try this.

$dll = DllOpen("FFACE.dll")

$running = DllCall($dll, "int", "InitFFACE") ;Initialize the DLL. Will return false if FFXI isnt running.
if @error = 0 Then ; Check for errors
    if $running[0] Then ;Check to see if FFXI is running.
        $result = DllCall($dll, "int", "GetPlayerHPMax") ;If it is, lets call our function.
        if @error= 0 Then 
            MsgBox(0, "", $result[0])  ;Display our Max HP
        EndIf
    Else
        MsgBox(0, "Couldnt Find FFXI", "FFXI Is NOT Running")  ; FFXI wasnt running, lets inform ourselves :)
    EndIf
Else
    MsgBox(0, "Some Error Occured", "@error = " + @error) ; An error occured, lets display the error number.
EndIf

DllClose($dll)
Edited by Insomniac

Share this post


Link to post
Share on other sites

I am assuming it has to do with this http://calamity-ls.com/wiki/index.php/Main_Page DLL/project.

As I have no active FFXI subscription at the moment, I cannot fully test it, but try this.

$dll = DllOpen("FFACE.dll")

$running = DllCall($dll, "int", "InitFFACE") ;Initialize the DLL. Will return false if FFXI isnt running.
if @error = 0 Then ; Check for errors
    if $running[0] Then ;Check to see if FFXI is running.
        $result = DllCall($dll, "int", "GetPlayerHPMax") ;If it is, lets call our function.
        if @error= 0 Then 
            MsgBox(0, "", $result[0])  ;Display our Max HP
        EndIf
    Else
        MsgBox(0, "Couldnt Find FFXI", "FFXI Is NOT Running")  ; FFXI wasnt running, lets inform ourselves :)
    EndIf
Else
    MsgBox(0, "Some Error Occured", "@error = " + @error) ; An error occured, lets display the error number.
EndIf

DllClose($dll)

I gave this a try and I didnt get an error, but it still returns a "0" :)


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

Share this post


Link to post
Share on other sites

I gave this a try and I didnt get an error, but it still returns a "0" :)

:blink:

Damn, now I gotta reactivate my FFXI account, just to try and fix this..... :P

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

:P

Damn, now I gotta reactivate my FFXI account, just to try and fix this..... :)

the VB.net code looks like this: i dont know it this helps.

Public Declare Ansi Function HPMax Lib "FFACE.dll" Alias "GetPlayerHPMax" () As Integer

-

Edited by onestcoder

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

Share this post


Link to post
Share on other sites

after a few hours of patching FFXI I finally got up and running.

Ran my version of the script once, and it output the expected number (108 I think it was, yes my char is a noob^^)

One last thing to check: Did you make sure you got the latest version of the DLL and that you were actually logged in to the game properly?

Share this post


Link to post
Share on other sites

after a few hours of patching FFXI I finally got up and running.

Ran my version of the script once, and it output the expected number (108 I think it was, yes my char is a noob^^)

One last thing to check: Did you make sure you got the latest version of the DLL and that you were actually logged in to the game properly?

I have the right version of the dll, but I use Windower Version 3.3 to log into FFXI. I was fully logged in. How did you log in?


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

Share this post


Link to post
Share on other sites

I have the right version of the dll, but I use Windower Version 3.3 to log into FFXI. I was fully logged in. How did you log in?

the "normal" way, through POL

Share this post


Link to post
Share on other sites

the "normal" way, through POL

I got it working Wooot!! Thank You Insomniac.

HAve you had a chance to look at the GetTarGetName function.

Is there away to get the text back? I don't understand the buffer ref int size...

[DllImport("FFACE.dll", EntryPoint = "GetTargetName")]
public static extern void sName(byte[] buffer, ref int size);
 
public static string Name()
{
    int s = 20;
    byte[] b = new byte[21];
    sName(b, ref s);
    return System.Text.Encoding.ASCII.GetString(b, 0, s - 1);
}

-


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

Share this post


Link to post
Share on other sites

IS this were the DllCallbackRegister is used?


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

Share this post


Link to post
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
Sign in to follow this  
Followers 0