开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜