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. SEND MESSAGE

SEND MESSAGE

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
4 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.
  • R Offline
    R Offline
    RockyJames
    wrote on last edited by
    #1

    Hi, i have two view CMyViewOne,CMyViewTwo both derived from CBaseView and CBaseView is derived from CView.I have a function named "OnComplete" in CMyViewOne,in this function i want to send a Message to CMyViewTwo,by using SendMessage function.How to do it..? Like i want to establish a communication between both the views.. Thanks in before. James

    S 1 Reply Last reply
    0
    • R RockyJames

      Hi, i have two view CMyViewOne,CMyViewTwo both derived from CBaseView and CBaseView is derived from CView.I have a function named "OnComplete" in CMyViewOne,in this function i want to send a Message to CMyViewTwo,by using SendMessage function.How to do it..? Like i want to establish a communication between both the views.. Thanks in before. James

      S Offline
      S Offline
      Stephen Hewitt
      wrote on last edited by
      #2

      In document-view architectures views don't directly communicate; all communication occurs via the document. If view 1 needs to “talk” to view 2 then view 1 should update the document and the document will notify all applicable views, in this case view 2.

      Steve

      R 1 Reply Last reply
      0
      • S Stephen Hewitt

        In document-view architectures views don't directly communicate; all communication occurs via the document. If view 1 needs to “talk” to view 2 then view 1 should update the document and the document will notify all applicable views, in this case view 2.

        Steve

        R Offline
        R Offline
        RockyJames
        wrote on last edited by
        #3

        Thanks for the reply,Can you be more clear ,please. Like how to send the event to document,from there to respective view

        S 1 Reply Last reply
        0
        • R RockyJames

          Thanks for the reply,Can you be more clear ,please. Like how to send the event to document,from there to respective view

          S Offline
          S Offline
          Stephen Hewitt
          wrote on last edited by
          #4

          I assume you're using MFC. From a view can can get access to its document via the GetDocument function the wizard generates for you in the view class. Your document class should provide functions to modify the state of the document. The function CDocument::UpdateAllViews on the document is used by the code in the document (or view) to inform all views (the pSender parameter can be used to exclude the sending view if required) of a change in the state of the document.

          Steve

          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