Sign in to follow this  
Followers 0
m0nk3yI3unz

DLLs

20 posts in this topic

#1 ·  Posted (edited)

I know its a common question, but its one Im having a really hard time answering.

Could somebody please direct me to a guide on DLLs and how to integrate them with AutoIt?

I know they contain functions, but like, what are structs, what is the whole Hlong, hwnd, etc all about? How in the heck do I even get a list of the functions inside of a DLL?

Thanks!!!

-I3unz

Edited by m0nk3yI3unz

Monkeh.

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

I thought I did... Hmm... lemme check...

EDIT: Ack. Its all gibberish to me.

Can I get the ordinal value of a function thru ResHacker, or is there like an easier way?

Does the return array from a DLL Call contain all the info i need?

How do I know which return value I want?

How do I know which type I want?

How do I know which Param I want?

Are the types also usable with param? What about the raturn value?

Edited by m0nk3yI3unz

Monkeh.

Share this post


Link to post
Share on other sites

I thought I did... Hmm... lemme check...

EDIT: Ack. Its all gibberish to me.

Can I get the ordinal value of a function thru ResHacker, or is there like an easier way?

Does the return array from a DLL Call contain all the info i need?

How do I know which return value I want?

How do I know which type I want?

How do I know which Param I want?

Are the types also usable with param? What about the raturn value?

Have a look at this link for some more to look at.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Well okay, I sorta get it. But I think my main question is this:

I have a dll I wanna tryout (EX. the visualization DLL from WMP.) and use in a program of mine (theoretically.) Is there any way to get its functions? I understand that DllCall() will get me the params and such, but im still iffy on it.


Monkeh.

Share this post


Link to post
Share on other sites

Well okay, I sorta get it. But I think my main question is this:

I have a dll I wanna tryout (EX. the visualization DLL from WMP.) and use in a program of mine (theoretically.) Is there any way to get its functions? I understand that DllCall() will get me the params and such, but im still iffy on it.

You can get the function names, but not the parameters, if the dll doesn't have information on how to pass and retrieve what you want, you're better off either contacting the manufacturer of the DLL and getting the correct calls, re-constructing the DLL (making one yourself to do what it does), or completely forgetting about it.

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

#7 ·  Posted (edited)

Well doesn't DLLCall return the Params?

EDIT: never. Just found its pointless unless you have the manufacturer, as Smoke_n stated.

Thanks for all of the help!

Edited by m0nk3yI3unz

Monkeh.

Share this post


Link to post
Share on other sites

Well okay, I sorta get it. But I think my main question is this:

I have a dll I wanna tryout (EX. the visualization DLL from WMP.) and use in a program of mine (theoretically.) Is there any way to get its functions? I understand that DllCall() will get me the params and such, but im still iffy on it.

You can use some utilities for example DLL Export Viewer v1.11

But as SmOke_N said parametres and their types can't be retrieved from DLL only function names.

Share this post


Link to post
Share on other sites

So the Export Viewer (which I was actually looking at atm...) is completely useless?


Monkeh.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Is there like a place where you can get DLLs along with the functions and syntaxes?

Edited by m0nk3yI3unz

Monkeh.

Share this post


Link to post
Share on other sites

Okay, sry for D-Post - heres what Im looking at:

Public Declare Function API_mysql_connect Lib "libmysql.dll" Alias "mysql_connect" (ByRef TMYSQL As API_MYSQL, ByVal host As Long, ByVal user As Long, ByVal Passwd As Long) As Long

I know what ByVal and ByRef are. And I undertsand what Longs are and such. but my code to call that functions doesn't seem to work. Any help?

func _MySQL_Connect($sHost, $sUser, $sPass)
    $dReturn = DllCall("libmySQL.dll","long","API_mysql_connect","long",$sHost,"long",$sUser,"long",$sPass)
    return $dReturn
EndFunc

Monkeh.

Share this post


Link to post
Share on other sites

Yeah, you are missing the API_MYSQL datatype. This is a special custom datatype that has a serious of combined values that are passed as a structure.

From: http://files.codes-sources.com/fichier.asp...l%5Cm_MySQL.bas

# Public Type API_MYSQL
# net_a As API_NET
# connector_fd As Long
# host As Long
# user As Long
# Passwd As Long
# Unix_Socket As Long
# server_version As Long
# host_info As Long
# info As Long
# DB As Long
# Port As Long
# client_flag As Long
# server_capabilities As Long
# protocol_ver As Long
# field_count As Long
# server_status As Long
# thread_id As Long
# affected_rows As API_myulonglong
# Insert_ID As API_myulonglong
# extra_info As API_myulonglong
# packet_length As Long
# Status As API_mysql_status
# Fields As Long
# field_alloc As API_MEM_ROOT
# FIX_MISALIGNMENT As Long
# free_me As Byte
# reconnect As Byte
# options As API_st_mysql_options
# scramble_buff(1 To 9) As Byte
# charset As Long
# server_language As Long
# End Type

I am pretty sure that is what they want. Once you create a DllStruct with that data, pass the pointer to it into the first parameter of the dll call.

Another thing that bothers me is why the other datatypes are long. I guess people are using all long integer host names, usernames, and passwords? That is odd. IMO the parameters should be strings for that, but whatever, I didn't write the dll.

Hope that helps.

- The Kandie Man ;-)


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Im so confuzzled.

Okay, I have a DLL I made that finds the square. Heres the source:

Public Function Test_Func(Value As Integer)
Test_Func = Value ^ 2
End Function

So obviously, I would put

$return = DllCall("C:\Documents and Settings\m0nk3y_I3unz\Desktop\Current Project\DLLs\Test.dll","int","Test_Func","int","2")
msgbox(0,"",$return)

Still get 0 though.

DLL is attached.

EDIT:

Another thing that bothers me is why the other datatypes are long. I guess people are using all long integer host names, usernames, and passwords? That is odd. IMO the parameters should be strings for that, but whatever, I didn't write the dll.

I thought that exact same thing. Edited by m0nk3yI3unz

Monkeh.

Share this post


Link to post
Share on other sites

KandieMan - How would I point to that?


Monkeh.

Share this post


Link to post
Share on other sites

Not that I've tested or even looked at your code... but seeing that DLL's return arrays... I don't see how MsgBox(0,0, $return) is ever going to be anything other than 0 :)

$return[0]?


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

Yea, i tried using array format - gives error (the one meaning its not an array :))


Monkeh.

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