Hello,
is it possible to define GLOBAL variables?
Example:
---
#DefineFunction TestFunction()
Message( "Global", GlobalVariable )
#EndFunction
GlobalVariable = "Hello"
TestFunction( )
---
Please see the PtrGLobalDefine function in the Consolidated WIL Help file or online here:
https://docs.winbatch.com/mergedProjects/WindowsInterfaceLanguage/html/WILLZ_P__015.htm
Many Thanks
Here's another example fred = 6
ptrglobaldefine(fred) ; make that variable "global"
#definefunction abc(x)
fred = ptrglobal(fred) ; grab the pointer
*fred += 1 ; add one to the value
return x + *fred ; use the value to compute something
#endfunction
message('', abc(100) ) ; shows 107
message('', abc(100) ) ; shows 108
exit
How about declaring today obfuscation Tuesday?
x = 42
PtrGlobalDefine(x)
PtrGlobalDefine(pX)
ppX = PtrGlobal(px)
*ppX = PtrGlobal(x)
#DefineFunction Useless()
g_ppX = PtrGlobal(pX)
g_px = *g_ppX
return *g_px
#EndFunction
z = Useless()
Message('True?', z:' == ':x)
exit
whoa, that's good! I'm going to have to stare at that a bit...