Hi Guys,
so hopefully this question is going to cause less controversy around the forum than yesterday's (those of you who were there know what Im talking about)
I have been reading about callback functions - something I came across a long time ago when I copy pasted some code that used for, thoguht it was pretty magic, but didnt try and understand it. Now I am...
So here's a small program:
What Im struggling with is how to put this in a class - I mean the call back function.Code:#include <iostream> #include <windows.h> using namespace std; BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pCmdLine, int iCmdShow) { EnumWindows(EnumWindowsProc, NULL); return 0; } BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) { cout << "In callback method" << endl ; return TRUE; }
If I create a class and I want to use call EnumWindows, this passes itself EnumWindowsProc. But I cant work out how to declare it within a class, so it is part of an object.
Thanks



LinkBack URL
About LinkBacks
)


