bittware Posted July 13, 2010 Share Posted July 13, 2010 (edited) Hello experts, I want to know how to define pointer variable in AutoIt. Or How to get a variable's memory address? C directive could be int* mode; function(mode); or int mode; function(&mode); What's the counterpart in AutoIt? Thanks in advance! BRs, bittware Edited July 13, 2010 by bittware Link to comment Share on other sites More sharing options...
BugFix Posted July 13, 2010 Share Posted July 13, 2010 (edited) Use an Dll-structure: Local $tMode = DllStructCreate('int') Local $pMode = DllStructGetPtr($tMode) ; set value with DllStructSetData($tMode, 1, 'value') ; get value with Local $getValue = DllStructGetData($tMode, 1) Func _function($pMode) ; ... EndFunc Edited July 13, 2010 by BugFix Best Regards BugFix Link to comment Share on other sites More sharing options...
bittware Posted July 13, 2010 Author Share Posted July 13, 2010 (edited) Use an Dll-structure: Local $tMode = DllStructCreate('int') Local $pMode = DllStructGetPtr($tMode) ; set value with DllStructSetData($tMode, 1, 'value') ; get value with Local $getValue = DllStructGetData($tMode, 1) Func _function($pMode) ; ... EndFunc Do I have to use DllStruct? It seems overkill for such simple task. Any native directive that can get variable's pointer(address) directly? Edited July 13, 2010 by bittware Link to comment Share on other sites More sharing options...
BugFix Posted July 13, 2010 Share Posted July 13, 2010 (edited) I don't know another way. AutoIt is an easy to use scripting language and so it's required sometimes to make a compromise. Edit: But if you only want to have acces to your source-variable with possibility to change it, than use it ByRef. It give access with an Pointer to your variable. Local $var _MyFunc($var) Func _MyFunc(ByRef $myVar) ; ... changes on $myVar inside Func has effect on $var EndFunc Edited July 14, 2010 by BugFix Best Regards BugFix Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now