开发者

How do i access objects created in .cpp from the dialog.cpp and vice verse in mfc?

开发者 https://www.devze.com 2023-03-21 11:35 出处:网络
when i create a mfc app, the following 2 files are created there a calDlg.cpp (all the clickOK 开发者_运维百科etc functions)

when i create a mfc app, the following 2 files are created there a calDlg.cpp (all the clickOK 开发者_运维百科etc functions) and a cal.cpp (with its .h)(which i intend to create objects like timer and other stuff there)

just wondering how can i access the objects created in the cal.h/.cpp from the caldlg clickOk function and vice verse? thanks1


In Cal.CPP

Cal::DisplayDialog()
{

    calDlg objDlg(this);
    objDlg.SetName("Craft"); 
    objDlg.SetAge("12");
    if(objDlg.DoModal() == ID_OK)
    {
      m_strName = onjDlg.GetName();
    }

}


Don't forget to include your header file cal.h in case they are already not included. That would sometimes avoid you a lot of errors that you think are not actually errors as such.

0

精彩评论

暂无评论...
验证码 换一张
取 消