The callback function must be defined as a global function or a static class member function.
This parameter is not provided for callback because the member function of a common class calls the implicit passed this pointer.
For example:
Enumerate the APIs of windows in the current system.
Bool enumwindows (wndenumproc lpenumfunc, lparam)
The callback function is:
Bool callback enumwindowsproc (hwnd, lparam );
If you want to set the callback function as a member function of the class, you must declare the following in the class:
Static bool callback myenumwindowsproc (hwnd, lparam );
Implementation:
Bool ceasygamedlg: myenumwindowsproc (hwnd, lparam ){
// Do...
Return true;
}
In this case, the this value cannot be used in the myenumwindowsproc implementation.
========================================================== ============================
It can be noted that in enumwindows, an lparam is provided for us to pass our own
Parameter, so we can pass this pointer in:
Enumwindows (myenumwindowsproc, (lparam) This );
--------------
Bool ceasygamedlg: myenumwindowsproc (hwnd, lparam ){
Ceasygamedlg * _ this = (ceasygamedlg *) lparam;
_ This-> MessageBox (title );
Return true;
}