Original Post
I would like to use a member function of a class as my WndProc for various reasons (essentially, the WndProc accesses lots of data from the class, so logically it should be a member). The reason I can''t is because I can''t make assignment like:
WNDCLASSEX wc;
wc.lpfnWndProc = (WNDPROC) CGLWindow::WndProc;
The reason this will not work, is that member functions have a hidden this pointer parameter, so the compiler can''t figure out how to match the signatures.
Making the WndProc static is not acceptable.
I found a solution for the borland compiler on the web, but I haven''t been able to find anything for the VC++ compiler. Essentially, the idea is to write a small snippet of ASM to offset the function pointers so they match (if i understand it correctly), and Borland has a premade function exactly for this purpose.
I don''t know ASM very well and I was wondering if anyone else has encountered and solved this problem before or you could point me towards a website that solves this.
Thanks