CALLBACK function MFC
-
Hi friend, Presently am working in MFC project. I have to use CALLBACK function but i don't know. Kindly help me. below see my questions What is CALLBACK? How it work? what is the advantage of CALLBACK, please explain with an example
-
Hi friend, Presently am working in MFC project. I have to use CALLBACK function but i don't know. Kindly help me. below see my questions What is CALLBACK? How it work? what is the advantage of CALLBACK, please explain with an example
Call back functions are supplied to some function or data structure as a pointer like (Or I can say, pointer to the starting address of U r function) variable. The pointer is actually a function pointer, and this will be called back when something happens. Say for example you develop an API function that takes a folder name. For each file found inside the folder, it will perform some operation based on the file name and extension. But the API you write do not know what action to perform and it is decided by the caller. In that case, caller will supply a function address, and your API will call the user supplied function (CALLBACK) for each file. You see that.
-
Hi friend, Presently am working in MFC project. I have to use CALLBACK function but i don't know. Kindly help me. below see my questions What is CALLBACK? How it work? what is the advantage of CALLBACK, please explain with an example
A callback function is a user defined function that a generic API function can use (call back) to do non generic work. For example, when you have a collection (array, vector, list) of use defined data (struct or class), you want to be able to sort that collection depending on a user defined criteria, you will use the default sorting API, and give that default sorting function a pointer to a callback function that will actually do the comparison between the member of the struct/class. Another example, is when working with threads; there are multiple generic API to create and manage threads, but all of them needs a callback function; that function will be the actual code that will be run (or a starting point to) by the different threads. Good luck. Max.
Nihil obstat
-
Hi friend, Presently am working in MFC project. I have to use CALLBACK function but i don't know. Kindly help me. below see my questions What is CALLBACK? How it work? what is the advantage of CALLBACK, please explain with an example