PDA

Click to See Complete Forum and Search --> : How do one call a function by address?


Thomas Halsvik
Jun 13th, 2000, 08:10 PM
How do one call a function by address?

parksie
Jun 17th, 2000, 07:22 PM
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.

Thomas Halsvik
Jun 18th, 2000, 01:23 PM
I want to be able to call a function by its address.
Something like this:
Call AdressOf(MyFunction), Parameters.

kb244
Jun 18th, 2000, 08:37 PM
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.

parksie
Jun 19th, 2000, 04:23 AM
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).

kb244
Jun 19th, 2000, 04:40 AM
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.

parksie
Jun 19th, 2000, 04:47 AM
use it for subclassing. (ooh look - within 10 mins!)