CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 1999
    Posts
    2

    Controls Text Strings

    How can I retrieve at runtime the complete list of the text strings for a dialog's controls , INCLUDING the static text controls? I don't wish to be troubled with which of several foreign languages is in force.
    The only way I seem to be able to do it is by making the static text controls tabbable and using the GetNextTabItem (or something). But this means that User has to tab through the text!


  2. #2
    Join Date
    Apr 1999
    Posts
    383

    Re: Controls Text Strings

    What about cycling through the child windows using GetWindow, and doing GetWindowText on them?

    Dave


  3. #3
    Join Date
    Apr 1999
    Posts
    2

    Re: Controls Text Strings

    My problem is that I want this to be a generic procedure to work with ANY dialog, so I dont have a way of getting a list of the child windows - ie I don't know their resource symbols!!!


  4. #4
    Join Date
    May 1999
    Location
    Atlanta, GA, USA
    Posts
    443

    Re: Controls Text Strings

    Hi.

    Fisrt, try to check the control situation on Dialog by SPY++.
    So, you notice something like this.
    Only static text control and button have Window caption. The
    other control window caption is always "".

    So, after you get CWnd of any dialog by FindWidnow, you can get
    all CWnd of child control by GetTopWindow and GetWindow inside
    loop. You need CWnd array.
    And you get Window caption by GetWidnowText. Only static and button control have Window caption.After this, you can get string length
    by some CString function.(I forget)

    Hope for help.
    -Masaaki Onishi-


  5. #5
    Join Date
    Apr 1999
    Posts
    383

    Re: Controls Text Strings

    You don't need their resource symbols if you use CWnd::GetWindow. GW_CHILD gives you the first child, GW_HWNDFIRST gives you the first sibling, GW_HWNDNEXT gives you the next.

    Dave


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