Jump to content

How to read dll function return value?


Recommended Posts

  • Developers

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.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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