GetVar()

Auto Hotkey

GetVar

Retrieves a pointer to a variable.

OutputVar := GetVar(VarName , ResolveAlias)
Function Example: varptr := GetVar(MyVar)

Parameters

OutputVar

The name of variable in which to store pointer to desired variable.

VarName

The name of the variable.

ResolveAlias

1 / true to receive pointer to primary variable, FALSE / NULL / 0 to receive pointer to desired variable even if it is alias for another variable.

Related

Struct, ahkgetvar, FindFunc, ahkFindFunc, ahkFindLabel

Examples

global _AHKVar := "{Int64 mContentsInt64,Double mContentsDouble,PTR mobject,PTR mVV}
	,{char *mByteContents,LPTSTR mCharContents},{UINT_PTR mLength,_AHKVar *mAliasFor}
	,{UINT_PTR mCapacity,UINT_PTR mBIV},BYTE mHowAllocated,mAttrib,mScope,mType,LPTSTR mName"
	
global _AhkVarType := {0:"VAR_ALIAS",1:"VAR_NORMAL",2:"VAR_VIRTUAL",3:"VAR_CLIPBOARD",4:"VAR_CLIPBOARDALL",5:"VAR_BUILTIN"}

var:="AHK",	v:=Struct(_AhkVar,GetVar(var))
MsgBox % v.mName "`n" _AhkVarType[v.mType] "`n" v.mCharContents

v:=Struct(_AhkVar,GetVar("ClipboardAll"))
MsgBox % v.mName "`n" _AhkVarType[v.mType]