Jump to content
Sign in to follow this  
E1M1

How to read dll function return value?

Recommended Posts

E1M1

How do I read return value of dll?

MsgBox(1,1,DllCall("dlltutorial1.dll","int","add","int",1,"int",1))

This function should return 2 (1+1), but I see 0 because DllCall() was success, but how can I see return value of dll function?


edited

Share this post


Link to post
Share on other sites
Jos

How do I read return value of dll?

MsgBox(1,1,DllCall("dlltutorial1.dll","int","add","int",1,"int",1))

This function should return 2 (1+1), but I see 0 because DllCall() was success, but how can I see return value of dll function?

DllCall() returns an array.

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
E1M1

Something is wrong here :S

$return = DllCall("dlltutorial1.dll","int","add","int",1,"int",1)
MsgBox(1,1,$return[0])

Z:\My Documents\11-2008\dllfail\tut1test\dlltutoria.au3 (2) : ==> Subscript used with non-Array variable.:
MsgBox(1,1,$return[0])
MsgBox(1,1,$return^ ERROR

Does this mean that there is error in dll or there is error in autoit code?


edited

Share this post


Link to post
Share on other sites
Jos

Something is wrong here :S

$return = DllCall("dlltutorial1.dll","int","add","int",1,"int",1)
MsgBox(1,1,$return[0])

Z:\My Documents\11-2008\dllfail\tut1test\dlltutoria.au3 (2) : ==> Subscript used with non-Array variable.:
MsgBox(1,1,$return[0])
MsgBox(1,1,$return^ ERROR

Does this mean that there is error in dll or there is error in autoit code?

There is only an Array returned when DllCall() was error free. Read the Helpfile for the details.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.