Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Problems using CFormView

Problems using CFormView

Scheduled Pinned Locked Moved C / C++ / MFC
helpdebugging
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nutkase
    wrote on last edited by
    #1

    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!

    H 1 Reply Last reply
    0
    • N nutkase

      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!

      H Offline
      H Offline
      Hans Ruck
      wrote on last edited by
      #2

      You must allocate Form dinamically because CView::PostNcDestroy contains delete this X| . Make it CMyClass *pForm. rechi

      N 1 Reply Last reply
      0
      • H Hans Ruck

        You must allocate Form dinamically because CView::PostNcDestroy contains delete this X| . Make it CMyClass *pForm. rechi

        N Offline
        N Offline
        nutkase
        wrote on last edited by
        #3

        Thankx Man ! u r the Gr8est!:-O;):-D:)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups