callback question
-
Can somebody explain to me what a callback function is ? is it just a recursive function or have I missed the point? Andy
A callback function is one whose pointer you give to an object or function, and it gets called by the other object or function when a certain condition arises. For example, the
SetTimer()
Win32 API function can take a pointer to a function that gets called when the timer period elapses. The function that you pass to SetTimer and gets called is the callback function. A slightly different example is used with theEnumFontFamilies()
function. You pass a pointer to a callback function, and the callback function gets called once for every font that matches the criteria specified in the call toEnumFontFamiles()
. In this case, the callback function is called as many times as needed before theEnumFontFamilies()
function returns, as opposed toSetTimer()
above, where the callback function is called sometime in the future. Hope this explains it more :)Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
A callback function is one whose pointer you give to an object or function, and it gets called by the other object or function when a certain condition arises. For example, the
SetTimer()
Win32 API function can take a pointer to a function that gets called when the timer period elapses. The function that you pass to SetTimer and gets called is the callback function. A slightly different example is used with theEnumFontFamilies()
function. You pass a pointer to a callback function, and the callback function gets called once for every font that matches the criteria specified in the call toEnumFontFamiles()
. In this case, the callback function is called as many times as needed before theEnumFontFamilies()
function returns, as opposed toSetTimer()
above, where the callback function is called sometime in the future. Hope this explains it more :)Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
You're welcome :)
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"