It's official - Denis, you are my new hero!!
There's one problem though - I put your code in, it compiles fine, but alas, I get a Debug Assertion Failure, file winocc.cpp, line 301! Maybe I did it wrong? I rewrote the header file to accomodate for the functions in your code. Anyhow, the error doesn't seem to be caused by the MRectList code. Here's how I wrote the header:
Thanks for your comments on the other stuff, they were really helpful! They will be filed away and applied in my next MFC programCode:#pragma once #include <afxwin.h> class CMainFrame: public CFrameWnd { private: CObList mRectList; public: CMainFrame(); ~CMainFrame(); BOOL PreCreateWindow(CREATESTRUCT& cs); // int OnCreate( LPCREATESTRUCT lpCreateStruct ); // afx_msg void OnPaint(); // afx_msg void OnLButtonDown(UINT nFlags, CPoint pt); // afx_msg void OnChar(UINT nChar, UINT nRep, UINT nFlags); afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct); DECLARE_MESSAGE_MAP(); };
Well, you see, the book I'm using does the Creates in the constructor - Introduction to MFC Programming with Visual C++, by Richard M. Jones. As far as I can tell he's trying to write very simple code in the beginning stages so people won't get lost.My advice for you is to buy a good book on MFC if you're going to use it.
BTW, would you know why the original code worked when I made a copy of the project but wouldn't work in the original?![]()



LinkBack URL
About LinkBacks








