Loading ...
Sorry, an error occurred while loading the content.

several controls with same class and same ID

Expand Messages
  • Sander Pool
    Hello, I ve been trying to automate a small application called Attrib from Network Appliance. I do not have access to the source code or the developers. The
    Message 1 of 3 , Mar 2, 2007
    • 0 Attachment
      Hello,

      I've been trying to automate a small application called Attrib from
      Network Appliance. I do not have access to the source code or the
      developers. The application performs attribute test and the results are
      shown in two columns of Edit controls, one for successes, the other for
      failures. After running the application for a while I stop it and want
      to retrieve the values from the Failure Edit controls.

      I used WinSpy to obtain the IDs of the Edit controls. All seemed fine
      until I noticed that FindWindowLike sometimes returns 2 windows. Using
      WinSpy I confirmed that the same control ID indeed occurs more than
      once. They are of the same class and have the same properties except
      location.

      Why would these IDs be the same? Sloppy programming? I'm surprised
      Windows allows it. Is the location really the only way to tell these
      controls apart? I'm curious how commercial capture and playback tools
      deal with this situation.

      Thanks,

      Sander
    • Timothy Mitchell
      FindWindowLike puts it s result into an array. You may have to use the second (or third) item in that array if you can be sure that the number of such windows
      Message 2 of 3 , Mar 2, 2007
      • 0 Attachment
        FindWindowLike puts it's result into an array. You may have to use the second (or third) item in that array if you can be sure that the number of such windows is always 2.

        Sander Pool <sander@...> wrote:
        Hello,

        I've been trying to automate a small application called Attrib from
        Network Appliance. I do not have access to the source code or the
        developers. The application performs attribute test and the results are
        shown in two columns of Edit controls, one for successes, the other for
        failures. After running the application for a while I stop it and want
        to retrieve the values from the Failure Edit controls.

        I used WinSpy to obtain the IDs of the Edit controls. All seemed fine
        until I noticed that FindWindowLike sometimes returns 2 windows. Using
        WinSpy I confirmed that the same control ID indeed occurs more than
        once. They are of the same class and have the same properties except
        location.

        Why would these IDs be the same? Sloppy programming? I'm surprised
        Windows allows it. Is the location really the only way to tell these
        controls apart? I'm curious how commercial capture and playback tools
        deal with this situation.

        Thanks,

        Sander






        [Non-text portions of this message have been removed]
      • Sander Pool
        I use the controls locations to keep them apart. I know the one I want is always on the right. I have no idea if the order in which they show up in the array
        Message 3 of 3 , Mar 3, 2007
        • 0 Attachment
          I use the controls' locations to keep them apart. I know the one I want
          is always on the right. I have no idea if the order in which they show
          up in the array is always the same so I'm not counting on that.

          Does anyone know why there would be several controls with the same ID?

          Sander

          Timothy Mitchell wrote:
          >
          > FindWindowLike puts it's result into an array. You may have to use the
          > second (or third) item in that array if you can be sure that the
          > number of such windows is always 2.
          >
          > S
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.