Jump to content

Using DLL functions, objects


vgt1
 Share

Recommended Posts

I'm trying to get AutoIt to use functions contained in a DLL file. The author of the DLL file gives examples on how to use it, but only in Python or Labview. I know basically nothing about object-oriented programming, so I don't know if AutoIt can even do this.

 

The instructions say that a "XXS" object must be created, an "XXFct" object created, and the "XXS" object connected to the FCT api. Here's the Python example provided:

 

from xxSerial import XXS
from xxSerial import XXFct

myXXS = XXS("COM9")
fct = XXFct()

fct.connect(myXXS)

 

I tried acting like an AutoIt variable could be an object as in the Python example. There's a function called XXFct.getVersion() that is supposed to return something. I didn't get any errors, but I just get a 0 in my message box where there should be a number or string (I don't actually know what the returned version is supposed to look like, but I'm sure it's something other than 0). Here's what I wrote:

 

Local $hDLL = DllOpen("xxFct.dll")

local $myXXS = DllCall($hDLL,"STR","XXS","STR","COM9")
local $fct = DllCall($hDLL,"STR","XXFct")
DllCall($fct,"none","connect","HANDLE","myXXS")

local $vers = DllCall($hDLL,"STR","getVersion")

MsgBox(0,"",$vers)

DllClose($hDLL)

 

Any ideas if I can use AutoIt this way?

Link to comment
Share on other sites

Hello. could you provide the dll doc?

Check how dll call works. It return an Array.

 

Saludos

Link to comment
Share on other sites

Oh, I didn't notice that, thanks. Also, I suppose I should have checked the error flag before making this post, because now that I've done so, I see that it'S returning "function not found" errors.

 

So my next question is: do I have to do something special to access a function that seems to be contained in a 'folder'? That's how I'm thinking of it at least, like a file tree. Peeking in the DLL file (fct.dll) with a decompiler, it's kind of like this: fct/xxSerial/XXFct/getVersion(). So in the Python example, I guess it's saying "import XXFct which is inside of xxSerial".

 

I don't think I can provide the DLL file. It's a part of a proprietary test for our customer's product, and I don't know what might be gleaned from it that I shouldn't make public.

Link to comment
Share on other sites

You need to learn more about Python import system.

I'm not asking for the DLL file. I'm asking for the DLL documentation C/C++ header declaration or so.

I can't stay helping you too much without that information.

Saludos

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