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. modal, modeless and variable

modal, modeless and variable

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

    There are two classe of dialog windows: class CMainDlg2 : public Cdialog // modal CString m_sADDRESSHOM; class CAdderDialog2 : public CDialog // MODELESS #include "adderdlg2.h" #include "modeldlg2.h" There are in the code attached to command button OK set: m_pModeless7 = new CAdderDialog2(this); if (m_pModeless7->Create() == TRUE) { m_sADDRESSHOM = "London"; } View the fragment of code modeless window: BOOL CAdderDialog2::OnInitDialog() { CDialog::OnInitDialog(); CMainDlg2 dlg7; MessageBox(L"dlg7.m_sADDRESSHOM=\n" + dlg7.m_sADDRESSHOM); // display empty - the contents from constructor of modal dialog window } How to receive "London" ?

    _ 1 Reply Last reply
    0
    • D durban2

      There are two classe of dialog windows: class CMainDlg2 : public Cdialog // modal CString m_sADDRESSHOM; class CAdderDialog2 : public CDialog // MODELESS #include "adderdlg2.h" #include "modeldlg2.h" There are in the code attached to command button OK set: m_pModeless7 = new CAdderDialog2(this); if (m_pModeless7->Create() == TRUE) { m_sADDRESSHOM = "London"; } View the fragment of code modeless window: BOOL CAdderDialog2::OnInitDialog() { CDialog::OnInitDialog(); CMainDlg2 dlg7; MessageBox(L"dlg7.m_sADDRESSHOM=\n" + dlg7.m_sADDRESSHOM); // display empty - the contents from constructor of modal dialog window } How to receive "London" ?

      _ Offline
      _ Offline
      _AnsHUMAN_
      wrote on last edited by
      #2

      Pass the pointer of the first dialog in the modeless one as you are doing by passing this. Write a get/set function in the modal dialog and declare variable that will be used in get/set functions. Create a pointer variable for the modal dialog in the modeless one and initialize it in the constructor of the modeless dialog since you pass the this pointer. This done, you can invoke the get/set function and set the value in the string to what ever you wish using the modal dialog pointer in the modeless dialog. Alternatively, you can access the values using the dlg7 object as well. Hope it is clear.

      You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_

      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