Sign in to follow this  
Followers 0
Art

error in return value when calling dll function

3 posts in this topic

I have a dll function in C:

extern "C" __declspec(dllexport) int SI_AddExtDisplayToDesktop(int width, int height)

This function works correctly when called from a C program.

When I call this dll function in AutoIt v3 with:

$result = DllCall ( "siextdispctrl.dll", "int", "SI_AddExtDisplayToDesktop" , "int", 800 , "int", 600 )

the function SI_AddExtDisplayToDesktop function works correctly but I also get the system error message about the app generating an error and needing to close.

When I call this function with:

$result = DllCall ( "siextdispctrl.dll", "int:cdecl", "SI_AddExtDisplayToDesktop" , "int", 800 , "int", 600 )

there is no system error and the function operates correctly but the return code is illogical.

Any ideas on what the problem is? What is the correct way to call this dll function.

Thanks,

Art

Share this post


Link to post
Share on other sites



... but the return code is illogical.

What are you expecting as return code.

And what is the actual returned data. (probably a array.)


"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

Problem solved. The return from the dll call is actually an array with the first element as the actual return from the function. I just needed to read the docs.

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