Microsoft Foundation Class Library Application

Hi All,

We have an application which was build by Microsoft FoundationClass Library (Afx and GXWND). Can someone please let me know how to fetch data from these grids and how to select an object in the application using color of the object.Please advise on this.

Thanks,

Anilesh

  • Anilesh,

    I have struggled with this too. My problem was trying to determine the colour of a cell when it changed all I could retrieve was the original colour in the cell.

    The code below works for the 4 object types specified in the function. You may be able to tweak it to make it work for a cell in a grid.

    Function Color_BackGround(strFormName As String, strObjectName As String, strObjectType As String) As String

    ' ---------------------------------------------------------------------------------------------------

    ' Purpose: Get the background colour of any OBJECT

    '

    ' Input  : 1. Form name    e.g. "BT BloodTracker 1.0.41""

    '          2. Object name    e.g. "Name=picConnectionStateOne"

    '          3. Object type    e.g. DotNETPictureBox

    '

    ' Output : The background colour as text e.g. "LawnGreen" or "Red" or "ffc0ff"

    '

    ' ----------------------------------------------------------------------------------------------------

       DotNETForm(strFormName).Attach

       Select Case strObjectType

          Case "DotNETLabel"

               Dim myObject1 As TDotNETLabel

               Set myObject1 = DotNETLabel(strObjectName)

               Color_BackGround = myObject1.Object.BackColor.Name

          Case "DotNETPictureBox"

               Dim myObject2 As TDotNETPictureBox

               Set myObject2 = DotNETPictureBox(strObjectName)

               Color_BackGround = myObject2.Object.BackColor.Name

           Case "DotNETPanel"

               Dim myObject3 As TDotNETPanel

               Set myObject3 = DotNETPanel(strObjectName)

               Color_BackGround = myObject3.Object.BackColor.Name

           Case "DotNETEditBox"

               Dim myObject4 As TDotNETEditBox

               Set myObject4 = DotNETEditBox(strObjectName)

               Color_BackGround = myObject4.Object.BackColor.Name

          Case Else

              Err.Raise vbObjectError 999, Color_BackGround, "Invalid TestPartner Object Type " & strObjectType

       End Select

    End Function

  • Thanks Martin. I found it helpful. But we did some other workaround for my issue.

    I would rather suggest Microfocus to bring out some additional features to test partner to its lagging areas.

  • Anilesh,

    I would be interested in finding out how you resolved the issue

  • Anilesh,

    I would be interested in finding out how you resolved the issue

  • Martin,

    It is some craziest thing I have done.

    Our application have a grid like below ,  the scenario was to get the smallest value in col3 and select the corresponding value in col1 accordingly which is nothing but a button . By default the application will show the smallest data in col3 as in green text which means it is the smallest among all the data in col3 and this is dynamic as this value will get change after 15 secs up and down the rows. What I had implemented is Window("GXWND").CaptureText will fetch the grid text and then taking it to an array and  by make use string methods  loop through and look for the smallest value in col3 and Window("GXWND").TextSelect "def" is to select the button in col1  for accepting the value which completes the workflow and this operations has to be quick within the defined timer frame (i.e. 15 secs)

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

    col1               |        col2        |         col3

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

    abc                |      264.12     |       92.10

    def                 |      270.10     |      90.12

    ....................

    ..................

    .............