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. Referring CChildFrame variable

Referring CChildFrame variable

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
1 Posts 1 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.
  • A Offline
    A Offline
    Anu_Bala
    wrote on last edited by
    #1

    Hi, In my application im loading DialogBar in mainfrmae,the dialogbar contains buttons and one ComboBox, i using that ComboBox in another class.Below is the code: In MainFrm.h:

    CSysWindow m_SysWnd; //CSysWindow is DialogBar class.

    For that combobox i added one class as CAlarmGlobal In SysWindow.h:

    CAlarmCombo oAlrmCombo; //CAlarmCombo derived from CComboBox

    In MainFrm.cpp,in OnCreate() i add that dialogbar to mainframe

    if (!m_SysWnd.Create(this, IDD_SYS,
    CBRS_TOP|CBRS_FLYBY|CBRS_TOOLTIPS, IDD_SYS))
    {
    return -1;
    }

    In another class im reffering this ComboBox by using this code

    CAlarmCombo *pSysBox = (CAlarmCombo *)((CMainFrame *)AfxGetMainWnd())->m_SysWnd.GetDlgItem(IDC_SYSALARM); //Combobox ID
    if(pSysBox){}

    Like the sameway i want to give the dialogbar in childframe and i want to use tht in differnt class. So i want to know how can i get the DialogBar class(CSyswindow) object in someother class. Now im doing the same for ChildFrame In ChildFrm.h:

    CSysWindow m_Recent; //CSysWindow is DialogBar class

    In ChildFrame.cpp,OnCreate()

    if( !m_Recent.Create(this, IDD_RECENTALARMS, CBRS_BOTTOM |CBRS_FLYBY|CBRS_SIZE_DYNAMIC, IDD_RECENTALARMS ))
    {
    return -1; // fail to create
    }

    I want tot know,Is there anyway to refer the childframe like this

    ((CMainFrame *)AfxGetMainWnd())->m_SysWnd.GetDlgItem(IDC_SYSALARM);

    Pls help me.

    Anu

    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