Announcement

Collapse
No announcement yet.

Retrieving info from an Edit Control

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Retrieving info from an Edit Control

    Hi Brain Trust:

    This info is from WinBatch Analysis Program. (Truncated)

    It displays Top and Child windows and all controls.

    I need to get the info from the Edit Box #27.

    Can someone please post PB/DLL 6.0 code to retrieve the infomation.

    Can it be retrieved by name and/or class as well as IDENT?

    Does the same code work with ComboBox/ListBox also?

    Thanks


    P C C C C
    A H H H H
    R I I I I
    E L L L L
    N D D D D
    T 2 3 4 5 CLASS IDENT TITLE
    --------------------------------------------------------------------------------
    TOP #32770 0 Format Symbol: FTO

    1 #32770 0
    1 Static 65535 &Symbol:
    X NONE
    2 ComboBox 6629
    1 Edit 1001
    X NONE
    3 Button 6627 &Lookup...
    X NONE
    4 Static 65535 Sub&graph:
    X NONE
    5 ComboBox 6680
    X NONE
    6 Static 65535
    X NONE
    7 Button 65535 Compression:
    X NONE
    8 Button 6534 &Tick Bar
    X NONE
    9 Button 6536 &Intra-day
    X NONE
    10 Button 6537 &Daily
    X NONE
    11 Button 6538 &Weekly
    X NONE
    12 Button 6539 &Monthly
    X NONE
    13 Button 6540 &Point && Figure
    X NONE
    14 Edit 6544
    X NONE
    15 Static 6572 Ticks
    X NONE
    16 Edit 6543
    X NONE
    17 Static 6574 Min
    X NONE
    18 Static 6691 Bo&x Size:
    X NONE
    19 Edit 6687
    X NONE
    20 Static 6689 x
    X NONE
    21 Static 6692 &Reversal:
    X NONE
    22 Edit 6688
    X NONE
    23 Static 6561 &Using:
    X NONE
    24 ComboBox 6541
    X NONE
    25 Button 65535 Date range:
    X NONE
    26 Static 6676 Days &back
    X NONE
    27 Edit 6530
    X NONE
    28 SysDateTimePick32 6675
    X NONE
    29 Static 65535 L&ast Date:
    X NONE
    30 SysDateTimePick32 6531
    X NONE


    ------------------

  • #2
    Assuming the edit control responds like a normal edit controls (ie, it is not a proprietary custom control), then check out GetWindowText()... you'll need the handle to the edit control. If it is a dialog, then you can get the handle with GetDlgItem(). To get the handle of the parent window, check out FindWindow() or EnumWindows().

    Disclaimer, I cannot remember if GetWindowText() works across process boundaries. (I'm away from any manuals and notes right now).


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Lance:

      WinBatch can retrieve the Info, but I need to do the operation from a DLL.

      The process is no under my control and I also read somewhere that
      GetWindowText does not work across processes..(Come on)

      GetDlgItem does not seems to work, but I am a beginner in this so
      I may not be calling the API correctly.

      What are the correct values:

      Declare Function GetDlgItemText LIB "USER32.DLL" ALIAS "GetDlgItemTextA" (BYVAL hDlg AS LONG, BYVAL nIDDlgItem AS LONG, lpString AS ASCIIZ, BYVAL nMaxCount AS LONG) AS LONG

      I am assuming that Ident - 6530 is the nIDDlgItem AS LONG "Parm"

      How do I get the drilled down handle for the BYVAL hDlg AS LONG "Parm" ?

      Thanks

      "Assuming the edit control responds like a normal edit controls (ie, it is not a proprietary custom control), then check out GetWindowText()... you'll need the handle to the edit control. If it is a dialog, then you can get the handle with GetDlgItem().
      To get the handle of the parent window, check out FindWindow() or EnumWindows().

      Disclaimer, I cannot remember if GetWindowText() works across process boundaries."

      I am posting the display again because it seems to have lost its formatting.

      Control Manager version 20025

      P C C C C
      A H H H H
      R I I I I
      E L L L L
      N D D D D
      T 2 3 4 5 CLASS IDENT TITLE
      --------------------------------------------------------------------------------
      TOP #32770 0 Format Symbol: FTO

      1 #32770 0
      1 Static 65535 &Symbol:
      X NONE
      2 ComboBox 6629
      1 Edit 1001
      X NONE
      3 Button 6627 &Lookup...
      X NONE
      4 Static 65535 Sub&graph:
      X NONE
      5 ComboBox 6680
      X NONE
      6 Static 65535
      X NONE
      7 Button 65535 Compression:
      X NONE
      8 Button 6534 &Tick Bar
      X NONE
      9 Button 6536 &Intra-day
      X NONE
      10 Button 6537 &Daily
      X NONE
      11 Button 6538 &Weekly
      X NONE
      12 Button 6539 &Monthly
      X NONE
      13 Button 6540 &Point && Figure
      X NONE
      14 Edit 6544
      X NONE
      15 Static 6572 Ticks
      X NONE
      16 Edit 6543
      X NONE
      17 Static 6574 Min
      X NONE
      18 Static 6691 Bo&x Size:
      X NONE
      19 Edit 6687
      X NONE
      20 Static 6689 x
      X NONE
      21 Static 6692 &Reversal:
      X NONE
      22 Edit 6688
      X NONE
      23 Static 6561 &Using:
      X NONE
      24 ComboBox 6541
      X NONE
      25 Button 65535 Date range:
      X NONE
      26 Static 6676 Days &back
      X NONE
      27 Edit 6530
      X NONE
      28 SysDateTimePick32 6675
      X NONE
      29 Static 65535 L&ast Date:
      X NONE
      30 SysDateTimePick32 6531
      X NONE

      Bruce


      ------------------

      Comment


      • #4
        Guys:

        The display is not formating properly.

        I can't seem to get the display to post formatted correctly.

        The First 1 is the Top
        The second 1 is CHILD 1
        The Third 1 and on down are under Child3

        The format sure good correct as I'm posting.

        Sorry I am a Novice poster.
        Code:
        Control Manager version 20025
        
        
        P   C   C   C   C
        A   H   H   H   H
        R   I   I   I   I
        E   L   L   L   L
        N   D   D   D   D
        T   2   3   4   5    CLASS                     IDENT  TITLE
        --------------------------------------------------------------------------------
        TOP                  #32770                    0      Format Symbol: FTO
         
            1                #32770                    0      
                1            Static                    65535  &Symbol:
                    X        NONE
                2            ComboBox                  6629   
                    1        Edit                      1001   
                        X    NONE
                3            Button                    6627   &Lookup...
                    X        NONE
                4            Static                    65535  Sub&graph:
                    X        NONE
                5            ComboBox                  6680   
                    X        NONE
                6            Static                    65535  
                    X        NONE
                7            Button                    65535  Compression:
                    X        NONE
                8            Button                    6534   &Tick Bar
                    X        NONE
                9            Button                    6536   &Intra-day
                    X        NONE
                10           Button                    6537   &Daily
                    X        NONE
                11           Button                    6538   &Weekly
                    X        NONE
                12           Button                    6539   &Monthly
                    X        NONE
                13           Button                    6540   &Point && Figure
                    X        NONE
                14           Edit                      6544   
                    X        NONE
                15           Static                    6572   Ticks
                    X        NONE
                16           Edit                      6543   
                    X        NONE
                17           Static                    6574   Min
                    X        NONE
                18           Static                    6691   Bo&x Size:
                    X        NONE
                19           Edit                      6687   
                    X        NONE
                20           Static                    6689   x
                    X        NONE
                21           Static                    6692   &Reversal:
                    X        NONE
                22           Edit                      6688   
                    X        NONE
                23           Static                    6561   &Using:
                    X        NONE
                24           ComboBox                  6541   
                    X        NONE
                25           Button                    65535  Date range:
                    X        NONE
                26           Static                    6676   Days &back
                    X        NONE
                27           Edit                      6530   
                    X        NONE
                28           SysDateTimePick32         6675   
                    X        NONE
                29           Static                    65535  L&ast Date:
                    X        NONE
                30           SysDateTimePick32         6531   
                    X        NONE
        ------------------
        * UUB [ CODE ] and [ /CODE ] tags added by Forum Administrator

        Comment


        • #5
          It does appear that the Edit control ID is the "ident" value.

          Since you are writing a DLL, is it being loaded into the Process that owns the windows/dialogs?

          PS: The "#32770" window class and the reformatted table indicates there is a parent dialog, with a child dialog containing controls.

          You'll need to get the window handle of the control with the ID 6530. This control's parent window is "Child2".

          So, in pseudocode, this would be something like this:

          hWndEdit = GetDlgItem(hChild2, 6530)

          Does "Child2" have a unique title/caption (as a child control, the text is probably not displayed, but a SPY utility may help you here.

          Otherwise, use EnumWindows() to get the handle to "Parent", then use EnumChildWindows() to dig down until you identify the edit control with the ID 6530.

          For example code for EnumWindows and EnumChildWindows, search the BBS for those keywords - you should find some code here somewhere.



          ------------------
          Lance
          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          Lance
          mailto:[email protected]

          Comment


          • #6
            Lance:

            Not luck. I really need a small example program on

            getting parent handle,drilling down to child(s) and getting

            controlID handle.

            Can anyone else help?

            Thanks

            Bruce



            ------------------

            Comment


            • #7
              unfortunately, i (personally) do not often have the time availlable to write example code on demand, but the information you need can be found on this bbs, in the win32.hlp file, and in http://msdn.microsoft.com

              a quick search for "enumchildwindows" gives a good example of using enumwindows() at http://www.powerbasic.com/support/pb...ad.php?t=17377 - this should help you find the parent window handle.

              using enumchildwindows() is basically the same... you just need to use getdlgctrlid() on each child window handle in the enumproc to test it's id number matches the one you want.

              http://msdn.microsoft.com/library/de...ndows_7wvn.asp

              http://msdn.microsoft.com/library/de...ndows_46cz.asp

              http://msdn.microsoft.com/library/en...asp?frame=true




              ------------------
              lance
              powerbasic support
              mailto:[email protected][email protected]</a>
              Lance
              mailto:[email protected]

              Comment


              • #8
                another sample i posted a while ago may be of help. it looks for
                running pbedit and its combobox, after which it widens the dropdown.
                just change looking for pbedit to whatever and same with the combo.
                look for textbox class instead (if dialog has only one textbox).
                see: http://www.powerbasic.com/support/pb...ad.php?t=22983

                btw, i have lifted text out from other app's using this method, so
                seems like getwindowtext can work across "boundaries"..


                ------------------

                Comment

                Working...
                X