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. Calling CWnd function between 2 dialogs

Calling CWnd function between 2 dialogs

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

    Dear all, If I have two window dialogs opening, say, A and B. And if A is activating, I want that in A::OnOK(), it can call a function in B, say B::bfunction(). However, there is some CWnd function, e.g UpdateData(), SetForeGroundWindows(), SetWindowText() etc...included in the bfunction(), then it will fail in run time.. A::OnOK() { B dlg; dlg.function(); } Can I know how to solve it? My target is, when A is activating, if the user press OK, then the B dialog will bring to top and A will call the B's function.....and then close A dialog. Please help! Thanks a lot!!! :rose: :-O

    M 1 Reply Last reply
    0
    • V Vickie

      Dear all, If I have two window dialogs opening, say, A and B. And if A is activating, I want that in A::OnOK(), it can call a function in B, say B::bfunction(). However, there is some CWnd function, e.g UpdateData(), SetForeGroundWindows(), SetWindowText() etc...included in the bfunction(), then it will fail in run time.. A::OnOK() { B dlg; dlg.function(); } Can I know how to solve it? My target is, when A is activating, if the user press OK, then the B dialog will bring to top and A will call the B's function.....and then close A dialog. Please help! Thanks a lot!!! :rose: :-O

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      However, there is some CWnd function, e.g UpdateData(), SetForeGroundWindows(), SetWindowText() etc...included in the bfunction(), then it will fail in run time. That's because the dialog isn't created until you call b.DoModal() or b.Create(). Just creating the C++ object doesn't create the dialog, so any functions that operate on the dialog via its HWND will fail. --Mike-- http://home.inreach.com/mdunn/ I'm finger-lickin' good!

      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