HotKeyIt , https://www.autohotkey.com/boards/viewtopic.php?f=65&t=28803 wrote: The difference to main AutoHotkey is that #NoEnv is set by default and VarSetCapacity keeps memory in variable when capacity is changed.
I'm porting my script from _L to _H and going through all my VarSetCapacitys to ensure they are compatible with the above rule.
Which way is better:
Code: Select all
VarSetCapacity(var, %RuntimeBoundNumber% , 0) ;0 = the var's binary bits are all set to 0 - how is this different to "blank"?
Code: Select all
var := "" ;is blank better than setting all its bits to 0?
VarSetCapacity(var, %RuntimeBoundNumber%)
I'm unable to test it, as changing the capacity always results in a buffer size of 1 and junk contents:
Code: Select all
s := "TheQuickBrownFoxJumpedOverTheLazyDog"
VarSetCapacity(s, 1000000)
debug .= "s:`t" . s . "`n"
debug .= "size:`t" . StrPut(s , "UTF-16") ; returns number of chars written - the required buffer size
msgbox % debug
exitapp