Results 1 to 6 of 6

Thread: What about this?

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    Allen Park, MI, Wayne
    Posts
    39

    What about this?

    class Class1{ //dialog class
    int m_1;

    void setm1(int m);
    }

    class Class2{
    HWND tbd;

    }


    Class1::Class1(){
    Class2 c2;
    c2.tbd = m_hWnd;
    }

    Class2::Class2(){
    tbd->setm1 - //why wont this work???
    }

    All I want to do is add to a listbox on a dialog from a child class of the dialog...

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    not certain what you're trying to do, but the HWND handle is just for passing to api functions, declare tbd as Class1* maybe?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    Allen Park, MI, Wayne
    Posts
    39
    I tried that... All I want to do is call a dialog function that will add a string to the list box.

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    you'd need to pass an argument as well, that function name wont do anything
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    Allen Park, MI, Wayne
    Posts
    39
    I did pass an argument. The compiler doesn't understand the relationship between the pointer and the function..

    tbd->setm1(2)

    gives a compiler error of:

    C2227 left of -> must point to class/struct/union.

    I did include the header file in the code, too.

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    The compiler error says it all: HWND is not a struct/union/class pointer
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

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