CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2009
    Posts
    40

    Question the address class pointer

    Hi,

    It may be easy but I need to find out the address class in order to access some information from the class.
    I have created a dialog class using the dialog from another class. This dialog is used to print a report on the screen or using a button in CrystalReport and then on the printer.
    In the constructor of the child I'm using this line <p_parent=(CTUIAmendSCdlg*) pParent;> in order to get the class address.
    The problem with the new class is that I'm calling the dialog from a menu. So, evan I have declared the pointer for the class, like < CTUIAmendSCdlg* p_parent; - this is the first parent
    CTuiArhivaDlg* pp_parent;> - this I want to use
    the value is for the menu called. So, when I tried to called for the information I need, I've got an error.
    My question is: How can I find out the address of my class? Or, can I find it out?

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: the address class pointer

    That is one really confusing post. Firstly, classes don't have addresses, objects do.

    When you're talking about parent here, do you mean Windows parent, or base class?

    When you say "using the dialog from another class", do you mean inheriting from it, or sharing the resource?

    If you're asking how to get the pointer of the object from inside the object, that's the this pointer.

    If that's not what you're asking, can you rephrase your question using correct, unambiguous terminology and only relevant information.

  3. #3
    Join Date
    Nov 2009
    Posts
    40

    Re: the address class pointer

    ok. my mistake. It's like that: I have a dialog class which is only to display a control list, called in another dialog class. like below:
    CTrenuriStatisticDlg Listedlg(this, cuTUI, k03_msg,...);
    Modal modal;
    I want this display class to be used by another one, I managed to do that but with problems.
    In one of the CTrenuriStatisticDlg's functions I'm accessesing a information from the "parent" class:
    int a = atoi(p_parent->data_first.Left(4));
    int b = atoi(p_parent->data_first.Mid(4,2));
    int c = atoi(p_parent->data_first.Mid(6,2));
    int d = atoi(p_parent->data_first.Mid(8,2));
    int e = atoi(p_parent->data_first.Right(2));
    where p_parent=(CTUIAmendSCdlg*) pParent;
    and CTUIAmendSCdlg is the parent class.
    This is working ok. The first dialog class is opend in a line menu. The second dialog class has 3 submenus, and the display dlg class it's called from one of the submenu function,and I've got error.
    The data_first is empty in the "child" class.
    So, it's about sharing the resource. Can anybody understand what I said?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured