Wondering how can we know the content of a dialogbox
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Wondering how can we know the content of a dialogbox

  1. #1
    Join Date
    Dec 2004
    Posts
    61

    Unhappy Wondering how can we know the content of a dialogbox

    Dear Gurus,

    I was wondering how can we know how many items exist in a dialogbox?
    If there any way that i can get the items ID in a dialogbox by having just the dialogbox's object or handler?

    Or any way that we can get a dialogbox content by coding.
    Thanks.

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,024

    Re: Wondering how can we know the content of a dialogbox

    EnumChildWindows might help you in case the dialog box is a true dialog box, i.e. a window of class "#32770". Otherwise there's no any guarantee you even be provided with a way for enumerating items.
    Best regards,
    Igor

  3. #3
    Join Date
    Dec 2004
    Posts
    61

    Re: Wondering how can we know the content of a dialogbox

    Dear Igor Vartanov,

    I think the EnumChildWindows is not suit for this case.

    What i try to do is to get the content of a dialogbox.
    For example:
    i have a dialogbox which have 3 button and 1 edit box.

    If i have the window handle. Is there a way i can know the dialogbox have 3 button and 1 edit box?
    Just like resource editor have all the information about a dialogbox.
    Thanks.

  4. #4
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,558

    Re: Wondering how can we know the content of a dialogbox

    If you have the window handle for the dialog box, EnumChildWindows() will give you the window handle for each of the controls (windows) contained within the dialog. Using the control window handle, GetClassName() will give you the class name from which you can determine the type of the control (eg button, edit box etc). GetWindowInfo() can also be used to obtain other info about a control knowing its handle.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  5. #5
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,024

    Re: Wondering how can we know the content of a dialogbox

    Quote Originally Posted by VbEndUser View Post
    I think the EnumChildWindows is not suit for this case.
    And I think it does. Otherwise I would not recommend it.

    What i try to do is to get the content of a dialogbox.
    For example:
    i have a dialogbox which have 3 button and 1 edit box.

    If i have the window handle. Is there a way i can know the dialogbox have 3 button and 1 edit box?
    The way is to enumerate children controls and find out their window class names. You seem need to learn the subject more detailed.

    Just like resource editor have all the information about a dialogbox.
    Beware of ungrounded conclusions based just on seeming similarities. Resource editor knows nothing about runtime windows. Instead it works with resource script where each and every dialog template and control is described in unambiguous statements. Besides, dialog template may be used for initial dialog creation having a few controls created later on the fly from scratch, and some ones destroyed and some hidden.

    And my favorite case is when dialog emulates standard controls on its own by rendering control frames and visual traits while there's no control window exists at all. You may be absolutely sure you are working with buttons and editboxes while you are not.
    Last edited by Igor Vartanov; September 17th, 2013 at 01:19 PM.
    Best regards,
    Igor

  6. #6
    Join Date
    Dec 2004
    Posts
    61

    Re: Wondering how can we know the content of a dialogbox

    Dear Igor Vartanov and 2Kaud,

    Thanks for correcting my mistake.
    I didnot used the EnumChildWindows before and didnot go through in details about it.
    I will learn the subject in more details.

    Thanks for the advice for my problem.
    Thank you very much.
    Appreciate both your help.
    Thanks.

  7. #7
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,024

    Re: Wondering how can we know the content of a dialogbox

    Please don't miss the link I provided in my previous message.
    Best regards,
    Igor

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center