Problems using CFormView
-
AOA! last night as i was trying to do one of my Assignments i tried to open a form using my Class inherted from CFormView! the problem is that i was able to show the form as i want but as i close this window using the CWnd::DestroyWindow() i get an Assert Failure! the Code i am using to initialize the window is as follows: //defined in MyClass.h; CMyClass Form; CMyMainView::OnInitialUpdate() { CView::OnInitialUpdate(); CRect Rect; GetClientRect(Rect); Form.Create(NULL,"NewForm",WS_VISIBLE|WS_BORDER|WS_CHILD,Rect,this,1234,NULL); } And to Destroy the Window CMyMainView::OnFileNew() { Form.DestroyWindow(); } i cant understand y i get the assert failure when i click the new button on the toolbar!:confused: the Assert Failure Message i get is as follows: Debug Assertion Failed! Program:E:\Chummi.exe File:dbgheap.c Line:1101 Expression:_CrtIsValideHeapPointer(pUserData) //bla bla bla plz help! shoaib!
-
AOA! last night as i was trying to do one of my Assignments i tried to open a form using my Class inherted from CFormView! the problem is that i was able to show the form as i want but as i close this window using the CWnd::DestroyWindow() i get an Assert Failure! the Code i am using to initialize the window is as follows: //defined in MyClass.h; CMyClass Form; CMyMainView::OnInitialUpdate() { CView::OnInitialUpdate(); CRect Rect; GetClientRect(Rect); Form.Create(NULL,"NewForm",WS_VISIBLE|WS_BORDER|WS_CHILD,Rect,this,1234,NULL); } And to Destroy the Window CMyMainView::OnFileNew() { Form.DestroyWindow(); } i cant understand y i get the assert failure when i click the new button on the toolbar!:confused: the Assert Failure Message i get is as follows: Debug Assertion Failed! Program:E:\Chummi.exe File:dbgheap.c Line:1101 Expression:_CrtIsValideHeapPointer(pUserData) //bla bla bla plz help! shoaib!
-
You must allocate Form dinamically because CView::PostNcDestroy contains
delete this
X| . Make it CMyClass*pForm
. rechi