CodingNovice
Programmer
Hi. I have been programming for windows in C for a few years now but would like in future to use C++. I originally learnt API programming with Petzold's excellent 4th edition of programming windows. Now when I program in C++ at the moment im really only using it as a better C and not fully OOP. I have played with MFC a little ( i have Prosise) but find it not much easier to work in than pure API except you have to write less code. I haven't got into ATL or WTL yet so dont suggest those. What im looking for is the best way to avoid the C style wndproc. I know that a wndproc has to be a static member or a non-member function but a virtual wndproc would make more sense so its just a case of forwarding to a virtual from a static wndproc. Now how on earth do you pass the needed this pointer. I have one way of doing this but like MFC it relies on a global app object. There must be a better way. I have tried searching the web but come up with very little real information on this. There is and their model-view-controller approach and an article on that uses a std::map to map windows messages to member functions but that im sure will be a bottleneck due to std::maps logarithmic lookup speed. Any ideas. Im just looking for a sensible and extendable way to write the common code thats common to most all window progs.... winmain,wndproc,message loop etc.
Any decent ideas gratefully recieved.
Thanks.
Any decent ideas gratefully recieved.
Thanks.