How can I get a pointer to my CPropertySheet without being a child (page) on that sheet? - Programmer

This is a discussion on How can I get a pointer to my CPropertySheet without being a child (page) on that sheet? - Programmer ; How can I get a pointer to my CPropertySheet without being a child (page) on that sheet? I have a class/object called CMySheet. I have tried to get a pointer to it as I do on the pages (CPropertyPage) but ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: How can I get a pointer to my CPropertySheet without being a child (page) on that sheet?

  1. How can I get a pointer to my CPropertySheet without being a child (page) on that sheet?

    How can I get a pointer to my CPropertySheet without being a child (page) on
    that sheet?

    I have a class/object called CMySheet. I have tried to get a pointer to it
    as I do on the pages (CPropertyPage) but using this statement below does not
    work.
    CMySheet* pSheet = (CMySheet*) GetParent();

    I know that the sheet CMySheet is not the parent of my class so how can I
    get a pointer to the created instance of CMySheet from just a normal class?

    PT



  2. Re: How can I get a pointer to my CPropertySheet without being achild (page) on that sheet?

    Paul Tomlinson wrote:

    > How can I get a pointer to my CPropertySheet without being a child (page) on
    > that sheet?
    >
    > I have a class/object called CMySheet. I have tried to get a pointer to it
    > as I do on the pages (CPropertyPage) but using this statement below does not
    > work.
    > CMySheet* pSheet = (CMySheet*) GetParent();
    >
    > I know that the sheet CMySheet is not the parent of my class so how can I
    > get a pointer to the created instance of CMySheet from just a normal class?
    >
    > PT
    >
    >


    Pass it to the class when you create the class object. It's best to
    pass it as a constructor parameter, then the constructor saves it in a
    member variable.

    --
    Scott McPhillips [VC++ MVP]


+ Reply to Thread