How do one call a function by address?
Printable View
How do one call a function by address?
in what way? if you have vb5 or higher, then you can use the AddressOf operator, which gets the address of a function, in case you need to supply a function pointer to an API function...but I don't know what you need.
I want to be able to call a function by its address.
Something like this:
Call AdressOf(MyFunction), Parameters.
Visual basic can pass any of its objects by reference, but visual basic still cannot use callback functions, it is not capable of using function pointers.
you can't do it as Call AddressOf(func), params
why not func(params)?
AddressOf is for passing to API functions such as CreateDialogBox(...), which requires a pointer to a function which handles the messages for the window. if you have no idea what i'm going on about, have a look at http://msdn.microsoft.com/library , and look at the example programs for windows in C++ - then you'll understand. (in that case you're 1-up on me, 'cuz I don't).
Typically the way a person would be able to use a callback function in visual basic is with the aid of APIs to perform the execution of the location for you, I seen it online somewhere, I'll post it here if i find it, but I know it could have been on the Vb-world.net articles or Tips.
use it for subclassing. (ooh look - within 10 mins!)