Can I use member function as first argument to EnumWindows? I don't see any workaround in this case even with boost::bind.
Given this normal callback function:
BOOL CALLBACK EnumWindowsProc(HWND wnd, LPARAM lParam);
You can invoke EnumWindows using lParam to pass it a pointer to your class:
EnumWindows(EnumWindowsProc, reinterpret_cast<LPARAM>(this));
In EnumWindowsProc you can simply call member function (casting lParam to your class type). Like this:
BOOL CALLBACK EnumWindowsProc(HWND wnd, LPARAM lParam)
{
return reinterpret_cast<MyClass*>(lParam)->EnumWindows(wnd);
}
If you don't want to make your class method public you can:
std:bind (in this case it'll work well because you do it on your own class member, it has not to be __stdcall).Whatever you will use you can find more details in this post here on SO.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With