In vb "DIM Ret&" is the same as "DIM Ret as long"

It is recommended to use the second form in vb

ret would in this case be a variable used to hold a "long" return value from the function you are calling. If you declared it as an integer it could overflow cause the function to hang or it may not even compile.

ret (or any other name) could aslo be defined as boolean, a string, an integer etc... It all depends on what the function return value is expected to be. Each function can return something different. Some api functions return a filename so obviously the return value variable would have to be dim as a string while others might return a true or false boolean condition indicating success or failure of the call.

Not into Delphi so can't comment on the port.