EnumWindows problem
Jun 13, 2011 at 9:10am Jun 13, 2011 at 9:10am UTC
Hi,
I'm trying to call EnumWindows inside a class with a static member function as the first parameter as seen below:
1 2 3 4 5 6 7 8 9 10
class foo
{
public :
static BOOL CALLBACK enumerate_windows_proc(HWND hwnd, LPARAM l_param);
foo()
{
EnumWindows(&foo::enumerate_windows_proc, NULL);
};
};
However the compiler gives me unresolved external symbol error for the first argument. How can I pass the function so that it is still in the class and the compiler accepts it?
Best regards,
Yours3!f
Jun 13, 2011 at 9:49am Jun 13, 2011 at 9:49am UTC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#include <windows.h>
class C
{
public :
void Method()
{
EnumWindows(HandleWindow, (LPARAM)this );
}
private :
static BOOL CALLBACK HandleWindow(HWND hWnd, LPARAM lParam)
{
return FALSE;
}
};
int main()
{
C c;
c.Method();
return 0;
}
Jun 13, 2011 at 10:42am Jun 13, 2011 at 10:42am UTC
thanks :)
Topic archived. No new replies allowed.