Sign in to follow this  
Followers 0
E1M1

How to read dll function return value?

4 posts in this topic

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



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                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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

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                                                          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  
Followers 0