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

467OLE controls and child windows with ID = 0

Expand Messages
  • pkaluski
    May 21, 2004
    • 0 Attachment
      I have an interesting problem, which probably some of you have faced

      I am trying to automate testing of GUI application (let's call it
      APP1) using Win32::GUITest.
      APP1 is a standard window application, writen with MFC, with many
      I am trying to avoid reaching the given control by a sequence of tabs.
      Instead I do the following:
      I am running APP1, the I run spy++ and I find the control I want to
      deal with. Using spy++ I can find control's Control ID. Having this I
      can find a control's window handle using FindWindowLike in my perl
      After all, Control ID is constant and does not change between runs,
      whereas window handle is different everytime we run the APP1.
      OK. It worked fine. However one day I found a window, which contained
      control with Control ID = 0. If you run FindWindowLike with Control ID
      = 0, you will get all children. I solved the problem by adding a
      condition on a window class (there was only one control of this
      However, I found next window, which contained several controls of the
      same class, all with Control ID = 0.
      The question is - how can I get window handle of the SPECIFIC control.
      Let me illustrate what I mean:

      If I have window with three controls:

      Name (edit), ControlID= 1
      LastName( edit), ControlID= 2
      Age (edit), ControlID= 3

      Then I can easily get control's handle. I do FindWindowLike with
      Controls ID = 2 and I get a window handle to LastName.

      If I have window with three controls:

      Name (CustomEditControl), ControlID= 0
      LastName (CustomEditControl), ControlID= 0
      Age (CustomEditControl), ControlID= 0

      Now, when I call FindWindowLike with ControlID = 0, I will get a list
      of 3 window handles. How would I programatically figure out, which
      handle is for Age, which is for name and so on?

      There is also one more factor, which may actually help. It seams that
      those "ID 0" controls are OLE controls. If so, how can I deal with
      them? Are there any tools and libraries, which would allow me to write
      a script, which will always figure out correctly which control is
      Name, which is LastName and so on?

      Any help would be greatly appreciated
    • Show all 3 messages in this topic