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. the MainFram & FormView in MDI

the MainFram & FormView in MDI

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestion
2 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.
  • Z Offline
    Z Offline
    zeus_master
    wrote on last edited by
    #1

    Dear VC-master, Thank you for your attention, In my MDI project, the based view is CFormView. named CMyView. the problem is, in CMainFrame class, SetValue()was defined. in CMyView class, public function SetEdit(true)was defined. in myview.cpp, if I use below, it is ok. void CMyView::OnSendValue() { CMainFrame *pMainfram = (CMainFrame *)AfxGetMainWnd(); pMainfram->SetValue(0x55); } but if In MainFrm.cpp void CMainFrame ::OnSendValue() { CMyView *pMyView= (CMyView *)GetActiveView(); pMyView->SetEdit(true); } it can build successfully, but failed execute. how to call the function/variable in active view?

    B 1 Reply Last reply
    0
    • Z zeus_master

      Dear VC-master, Thank you for your attention, In my MDI project, the based view is CFormView. named CMyView. the problem is, in CMainFrame class, SetValue()was defined. in CMyView class, public function SetEdit(true)was defined. in myview.cpp, if I use below, it is ok. void CMyView::OnSendValue() { CMainFrame *pMainfram = (CMainFrame *)AfxGetMainWnd(); pMainfram->SetValue(0x55); } but if In MainFrm.cpp void CMainFrame ::OnSendValue() { CMyView *pMyView= (CMyView *)GetActiveView(); pMyView->SetEdit(true); } it can build successfully, but failed execute. how to call the function/variable in active view?

      B Offline
      B Offline
      bob16972
      wrote on last edited by
      #2

      My first question is have you verified that the CMainFrame::OnSendValue() function is even getting called? Run this in Debug mode... void CMainFrame::OnSendValue() { TRACE("CMainFrame::OnSendValue() called\n"); CMyView* pMyView=(CMyView*)GetActiveView(); pMyView->SetEdit(true); } Do you see the output from the TRACE in the output window? -- modified at 2:38 Wednesday 28th June, 2006

      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