I have been scanning the forum threads with a little success, but haven't found the answer to the issue I have. I'm sure this has been asked & answered before, but here goes.
I am the developer of a DLL and I want to use AutoIT to automate some unit testing.
by directly calling some of the methods I have written. I am new to AutoIT but have been a developer for a long time.
The issue I have is that when I use DllCall() in my script
- It works fine for very basic C++ methods I have written (specifically for use by my AutoIT script)
For example, my DLL will expose a method called 'GetSomeIDThatINeed()'.
Now GetSomeIDThatINeed() is a completely trivial method that returns the value of a #define from the .h file.
The script code looks similar to
$res = DllCall($MyDll, "ULONG:cdecl", '?GetButtonID@CMyClass@@QAEHK@Z')
$buttonID = $res[0]
This works fine - everytime (You can assume $MyDll is valid & I am in the correct directory...etc)
The problem is now I want to call a method where the return value is dynamic.
e.g. it may be true or false at various times while the program is running.
GetTheCurrentState(ULONG id)
The script code looks similar to
$res = DllCall($MyDll, "BOOL:cdecl", '?GetCurrentState@CMyClass@@QAEHK@Z', "ULONG", $buttonID)
$bCurrentStat = $res[0]
The call 'succeeds' in that there are no errors returned, but the returned value is always the same
i.e. the return value is bogus.
GetTheCurrentState(ULONG id) is a more complex C++ method that that returns true or false based on a set of 3 variables. For example, I know the method should be returning false, but it still returns true.
The method runs correctly if I just run the application without AutoIT - the problem only occurs when I run the few lines of simple script.
Obviously, I'm using the undecorated C++ methods exposed by my DLL, which I think is legitimate.
I'll keep searching the forum, but thanks in advance.
Di.
I am the developer of a DLL and I want to use AutoIT to automate some unit testing.
by directly calling some of the methods I have written. I am new to AutoIT but have been a developer for a long time.
The issue I have is that when I use DllCall() in my script
- It works fine for very basic C++ methods I have written (specifically for use by my AutoIT script)
For example, my DLL will expose a method called 'GetSomeIDThatINeed()'.
Now GetSomeIDThatINeed() is a completely trivial method that returns the value of a #define from the .h file.
The script code looks similar to
$res = DllCall($MyDll, "ULONG:cdecl", '?GetButtonID@CMyClass@@QAEHK@Z')
$buttonID = $res[0]
This works fine - everytime (You can assume $MyDll is valid & I am in the correct directory...etc)
The problem is now I want to call a method where the return value is dynamic.
e.g. it may be true or false at various times while the program is running.
GetTheCurrentState(ULONG id)
The script code looks similar to
$res = DllCall($MyDll, "BOOL:cdecl", '?GetCurrentState@CMyClass@@QAEHK@Z', "ULONG", $buttonID)
$bCurrentStat = $res[0]
The call 'succeeds' in that there are no errors returned, but the returned value is always the same
i.e. the return value is bogus.
GetTheCurrentState(ULONG id) is a more complex C++ method that that returns true or false based on a set of 3 variables. For example, I know the method should be returning false, but it still returns true.
The method runs correctly if I just run the application without AutoIT - the problem only occurs when I run the few lines of simple script.
Obviously, I'm using the undecorated C++ methods exposed by my DLL, which I think is legitimate.
I'll keep searching the forum, but thanks in advance.
Di.