05-03-2005, 01:14 AM
i was wondering can someone tell me what a function pointer is/ does x.x i never heard of it until fb
n00b question...
|
05-03-2005, 01:14 AM
i was wondering can someone tell me what a function pointer is/ does x.x i never heard of it until fb
05-03-2005, 07:19 AM
You use them like you use a function, the difference is that you can change them in realtime.
So a "function" might do one thing at the beginning of the code, and another thing later. It's nice for optimizing, as you can make, for example a PSET routine that gets assigned based on BPP. You have 3 different PSET routines, each for handling a diff. BPP depth. You assign the correct BPP PSET routine to a function pointer, such as: my_pset And you call it instead of somebpp_pset Saving a few IF calls (IF BPP = X Then xBPP_Pset etc...) Sorry, no example, anyone wanna whip one up?
05-03-2005, 07:25 AM
so, if you have a pointer to a function, you can just do the pointer?? like.... for instance
Code: sub pointy then i could call it by just doing Code: r ? im confused editted a couple things
05-03-2005, 07:27 AM
Yup, thats exactly how it works..
Though, you got the di wrong.. I tink.. But other than that, ya.. Code: dim r as function ptr Bah, wait for someone who has messed with it more than I have...
05-03-2005, 07:29 AM
^^ that was the biggest reason i didnt understand that pdf lib stuff... and win32 stuff... and..
thanks
05-03-2005, 07:46 AM
sorry for double post this is what im trying now...
Code: function yay As Integer and i have no idea... >.< edit: nvm just screwing around i figured it out <.< works if you do function as integer ptr and go = u()... thanks
05-03-2005, 06:18 PM
Function pointer are used mostly in callbacks, expecially when enumerating through the windows structures. Here is an example that enumerates all the windows on the desktop:
Code: 'Shows the use of a function pointer to implement a system callback I have only tried this on Win2K Pro.
05-04-2005, 06:53 AM
thanks antoni the first time it was way over my head but it makes a lot of sense now =) and thanks rel ;p hehe
|
« Next Oldest | Next Newest »
|