ByRef parameters makes VB pass the address of the variable to the target
routine, so the routine can change the value. If you use an expression(Like
"2 * x", or "5") , rather than the variable itself, VB6 would evaluate the
expression, and stores the result into a temporary variable, then pass the
address of this temporary variable to the target routine. When the target
routine changes the value, it's not used. To avoid this, only use the
variable as is. Here is the correct syntax:
lRes = GetLong(b)
The following would cause VB6 to use a temporary variable:
lRes = GetLong(CLng(b))
lRes = GetLong(5)
lRes = GetLong(2 * b)
lRes = GetLong((b))
The last one is treated by VB as an expression to be evaluated, so a
temporary variable is used even though it seemed silly. Some use this trick
to pass the variable "by value".