ctapi

How does a C function callback work?


I'm a bit confused with this definition in an example provided by microsoft using TAPI in Windows Mobile 5.0. What does CALLBACK do in this case? What is the purpose of it?

BOOL CALLBACK DialingProc (HWND, UINT, WPARAM, LPARAM);

The implementation looks the same BOOL and CALLBACK.

BOOL CALLBACK DialingProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
   //Some code here...
}

I've been following http://c.learncodethehardway.org/book/ which is great but haven't really seen anything in regards to this... Also did a couple searches but no luck- maybe i don't know what i'm searching for here?


Solution

  • CALLBACK is #defined as __stdcall stdcall is a calling convention that determines how arguments are passed. WinAPI uses this very often. See What does "CALLBACK" in a Windows API function declaration mean?