passing an object to OnInitDialog function

Discussion in 'MFC' started by Vinod P V, Feb 26, 2008.

  1. Vinod P V

    Vinod P V New Member

    Joined:
    Feb 26, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hello
    I have a problem.If anybody knows the answer pls help me.

    I am having an SDI VC++ appication in which i have created 3 dialog classes viz CHDFreadDlg,CLoadDlg and CDispalyDlg.I aso have an independant class namely CHDFImage.I have created an object of this class in CHDFreadDlg dialog class namely pHDF.Now i have to pass this object to the OnInitDialog function of CLoadDlg class.How it is possible as the OnInitDialog function does not take any arguements.pls see the code below.

    Code:
    class CHDFImage
    {
    function A()
    {
    }
    }
    
    class CHDFreadDlg:class CDialog
    {
    CHDFImage* pHDF;  
    CLoadDlg myDlg;
    myDlg.create(ID,NULL);
    
    }
    
    class CLoadDlg:class CDialog
    {
    void OnInitDialog()
    {
    CDialog::OnInitDialog()
    //here i need the object pHDF
    pHDF->function A();
    }
    
    
    }
     
    Last edited by a moderator: Mar 16, 2008
  2. rinuvc

    rinuvc New Member

    Joined:
    Mar 12, 2008
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    i didnt get ur question
    but try including the header file of CHDFImage in the cpp file and the header file of the
    dialog class.
    i hope this might be help full


    Regards

    rinu
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice