08-18-2023, 10:36 PM
In a lot of cases, like in the wiki example you reference, the return type really isn't that important. Think of making a function like so:
FUNCTION Foo&&
'Stuff
END FUNCTION
Now that function returns a value which is an Integer64... Yet, you'll see folks write code like:
DIM whatever AS INTEGER
whatever = Foo
And, it works! Well, it works as long as the return value is less than 32536, otherwise you get overflow results as you can't put values larger than that in an INTEGER.
Since a lot of windows API calls just return simple error/success codes, it often doesn't matter what the return type is. Nearly any variable type can successfully receive a value of 1 for success, 0 for failure.
FUNCTION Foo&&
'Stuff
END FUNCTION
Now that function returns a value which is an Integer64... Yet, you'll see folks write code like:
DIM whatever AS INTEGER
whatever = Foo
And, it works! Well, it works as long as the return value is less than 32536, otherwise you get overflow results as you can't put values larger than that in an INTEGER.
Since a lot of windows API calls just return simple error/success codes, it often doesn't matter what the return type is. Nearly any variable type can successfully receive a value of 1 for success, 0 for failure.