Thread: Advanced Problem(Classes)

  1. #1
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Advanced Problem(Classes)

    What if I were to have a class for controls. Say I have this in my class, to get and EDIT's text:

    int GetEditText(HWND hEdit, char szBuffer[100000], int maxlen) { GetWindowText(hEdit, szBuffer, maxlen); }


    and in my program, use it like this:

    CWin *edit1 = new CEdit;

    edit1->GetEditText(...);


    How would I, in teh class, use GetWindowText(...) with the pointer that calls it, so I can "edit1's" text?
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: [email protected]

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  2. #2
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    Hmmm, first if you have a class to wrap up controls wouldnt it be a good idea for each object of that class to keep track of its hwnd? So why would you need to pass the HWND to GetEditText? Next if you derive a class Edit or whatever from the Control class then id assume you would have that class have a buffer in it, which would then get rid of the need for passing anything to the function call. Also you have me a little confused, are you using this to get the text on the control? or set it? If its to set it then you need to pass in the char*.
    Last edited by xds4lx; 03-25-2002 at 02:31 AM.
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What's advanced c++ contents ?
    By toysoldier in forum C++ Programming
    Replies: 8
    Last Post: 09-27-2004, 08:12 PM
  2. Advanced? Not Advanced? Anyone?
    By Jotun in forum C++ Programming
    Replies: 3
    Last Post: 04-28-2004, 08:02 PM
  3. Advanced but yet general
    By Rhodium in forum C Programming
    Replies: 6
    Last Post: 08-09-2003, 12:46 PM
  4. Advanced Linux Programming
    By drdroid in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 07-24-2003, 02:01 PM
  5. you advanced people, read this
    By Leeman_s in forum C++ Programming
    Replies: 2
    Last Post: 10-04-2001, 08:26 PM