我想使用这个函数“EnumWindows(EnumWindowsProc, NULL);”。EnumWindowsProc 是一个回调函数:
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam);
对于这个回调,我想使用一个类的成员函数。
例如:
Class MyClass
{
BOOL CALLBACK My_EnumWindowsProc(HWND hwnd, LPARAM lParam);
void test();
};
所以我想将调用的回调与我的函数绑定!!!
我试试这个:
void MyClass::test()
{
EnumWindowsProc ptrFunc = mem_fun(&MyClass::My_EnumWindowsProc);
EnumWindows(ptrFunc, NULL);
}
这是行不通的,“mem_fun”只能接受一个参数!有可能这样做吗?否则你知道另一种解决方案吗?(也许使用 Boost::bind 可以解决)