The user can not be completely ignorant of the implementation details, they will have to make a callback function with the specified parameters before you can appropriately pass a function pointer around as a callback, bowever you can ease the complex syntax using typedef's. For example, take the API function BOOL EnumWindows(WNDENUMPROC lpEnumFunc, LPARAM lParam); The WNDENUMPROC is a user-defined callback, WNDENUMPROC is typedef'd as "typedef BOOL (CALLBACK* WNDENUMPROC)(HWND, LPARAM);" This means a user would define their callback like:
Code:
BOOL MyEnumWindowsCallback(HWND hWnd, LPARAM lParam)
{
return 0;
}
And then call the function with:
Code:
EnumWindows(&MyEnumWindowsProc, someSortOflParamValue);