Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Callback Function

Status
Not open for further replies.

moonoo

Programmer
May 17, 2000
62
US
What is a CALLBACK function ? Why it is used ?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thanks<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Moonoo
 
A callback function is a function that you write that could be called by outside code (i.e. by windows functions).&nbsp;&nbsp;You set up a callback function by passing the address of your function to the API from which your callback is referenced.<br><br>For example, I want my application to handle runtime exceptions rather than letting C++ runtime take care of things for me.&nbsp;&nbsp;So I wrote a function called my_exception_handler(int, EXCEPTION_POINTERS*) and I call a Microsoft function called _set_se_translator and pass it the address of my_exception_handler.&nbsp;&nbsp;<br><br>In the example above, my_exception_handler is a callback function -- I will never call it myself, but I pass the address of it to an API that will cause it to possibly be called.<br><br>Hope that helps!<br><br> <p>Pat Gleason<br><a href=mailto:gleason@megsinet.net>gleason@megsinet.net</a><br><a href= > </a><br>
 
its basically a Function pointer, it points to a function in memory, can be used inside and outside of a programming language some languagues cannot use callback functions from say VC++, like visual basic cant(unless you use an API by another dll and such) <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top