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

Making an application accept the ComboBox selection

Expand Messages
  • Tim Mitchell
    Hi All, I am trying to write a general function to select an item from a combobox. I ve successfully found the handle of the ComboBox, then using any one of
    Message 1 of 4 , Jun 27, 2006
    • 0 Attachment
      Hi All,

      I am trying to write a general function to select an item from a
      combobox. I've successfully found the handle of the ComboBox, then
      using any one of these three methods...

      Method 1: Using the functions SendMessage with CB_FINDSTRING and
      SelComboItem().
      Method 2: Using the functions SendMessage with CB_FINDSTRING and
      CB_SETCURSEL.
      Method 3: Using the functions SendMessage with CB_FINDSTRING and
      CB_SELECTSTRING.

      ...I was able to apparently change the selected item in the
      ComboBox. That is to say that I could see the selection change in
      the application that I am testing. However when I "click"
      the "Apply" button of the application, the result is that I really
      never did change the selection at all. The application used the
      original default ComboBox selection.

      I managed to write some code that found the coordinates of the
      ComboBox, Clicked on it to expose the drop-down list, and then used
      MouseMoveAbsPix( $x, $y ) and SendMouse("{LEFTCLICK}") on the
      desired item. I had to hard code a new $y value to get to the
      particular item in the list. This produced the desired result. The
      problem here is that this only works for a particular list of items
      in the application's ComboBox. In general, this drop-down list
      varies as the user works. Since ComboBoxes are so common, I really
      need a general function

      How can I get one of the first 3 methods to make the application
      actually accept the ComboBox selection?

      Tim
    • stuart arnold
      Did you try a SendNotify() message? I find that some apps (the way they are written) wait for that to collect the data before the OK is pressed. ... From:
      Message 2 of 4 , Jun 29, 2006
      • 0 Attachment
        Did you try a SendNotify() message?
        I find that some apps (the way they are written) wait for that to
        collect the data before the OK is pressed.


        -----Original Message-----
        From: perlguitest@yahoogroups.com [mailto:perlguitest@yahoogroups.com]
        On Behalf Of Tim Mitchell
        Sent: Tuesday, June 27, 2006 5:44 PM
        To: perlguitest@yahoogroups.com
        Subject: [perlguitest] Making an application accept the ComboBox
        selection



        Hi All,

        I am trying to write a general function to select an item from a
        combobox. I've successfully found the handle of the ComboBox, then
        using any one of these three methods...

        Method 1: Using the functions SendMessage with CB_FINDSTRING and
        SelComboItem().
        Method 2: Using the functions SendMessage with CB_FINDSTRING and
        CB_SETCURSEL.
        Method 3: Using the functions SendMessage with CB_FINDSTRING and
        CB_SELECTSTRING.

        ...I was able to apparently change the selected item in the
        ComboBox. That is to say that I could see the selection change in
        the application that I am testing. However when I "click"
        the "Apply" button of the application, the result is that I really
        never did change the selection at all. The application used the
        original default ComboBox selection.

        I managed to write some code that found the coordinates of the
        ComboBox, Clicked on it to expose the drop-down list, and then used
        MouseMoveAbsPix( $x, $y ) and SendMouse("{LEFTCLICK}") on the
        desired item. I had to hard code a new $y value to get to the
        particular item in the list. This produced the desired result. The
        problem here is that this only works for a particular list of items
        in the application's ComboBox. In general, this drop-down list
        varies as the user works. Since ComboBoxes are so common, I really
        need a general function

        How can I get one of the first 3 methods to make the application
        actually accept the ComboBox selection?

        Tim







        [Non-text portions of this message have been removed]
      • Tim Mitchell
        That sounds like a good idea, but this is the first I ve heard about SendNotify. I Googled MSDN documentation to find out how to use a message called
        Message 3 of 4 , Jun 29, 2006
        • 0 Attachment
          That sounds like a good idea, but this is the first I've heard about
          SendNotify. I Googled MSDN documentation to find out how to use a
          message called SendNotify or **_SENDNOTIFY and found nothing. Is
          this a C++ or Perl command? Where can I find documentation on it?
          Maybe a small example would help.

          --- In perlguitest@yahoogroups.com, "stuart arnold"
          <stuart.arnold@...> wrote:
          >
          > Did you try a SendNotify() message?
          > I find that some apps (the way they are written) wait for that to
          > collect the data before the OK is pressed.
          >
          >
          > -----Original Message-----
          > From: perlguitest@yahoogroups.com
          [mailto:perlguitest@yahoogroups.com]
          > On Behalf Of Tim Mitchell
          > Sent: Tuesday, June 27, 2006 5:44 PM
          > To: perlguitest@yahoogroups.com
          > Subject: [perlguitest] Making an application accept the ComboBox
          > selection
          >
          >
          >
          > Hi All,
          >
          > I am trying to write a general function to select an item from a
          > combobox. I've successfully found the handle of the ComboBox, then
          > using any one of these three methods...
          >
          > Method 1: Using the functions SendMessage with CB_FINDSTRING and
          > SelComboItem().
          > Method 2: Using the functions SendMessage with CB_FINDSTRING and
          > CB_SETCURSEL.
          > Method 3: Using the functions SendMessage with CB_FINDSTRING and
          > CB_SELECTSTRING.
          >
          > ...I was able to apparently change the selected item in the
          > ComboBox. That is to say that I could see the selection change in
          > the application that I am testing. However when I "click"
          > the "Apply" button of the application, the result is that I really
          > never did change the selection at all. The application used the
          > original default ComboBox selection.
          >
          > I managed to write some code that found the coordinates of the
          > ComboBox, Clicked on it to expose the drop-down list, and then
          used
          > MouseMoveAbsPix( $x, $y ) and SendMouse("{LEFTCLICK}") on the
          > desired item. I had to hard code a new $y value to get to the
          > particular item in the list. This produced the desired result. The
          > problem here is that this only works for a particular list of
          items
          > in the application's ComboBox. In general, this drop-down list
          > varies as the user works. Since ComboBoxes are so common, I really
          > need a general function
          >
          > How can I get one of the first 3 methods to make the application
          > actually accept the ComboBox selection?
          >
          > Tim
          >
          >
          >
          >
          >
          >
          >
          > [Non-text portions of this message have been removed]
          >
        • stuart arnold
          Ok, I forgot...I have a func to do this...you do a WM_COMMAND and assemble it. Here s a sniplit of my code: WPARAM wParam = MAKEWPARAM(DlgControlId, wNotify);
          Message 4 of 4 , Jun 29, 2006
          • 0 Attachment
            Ok, I forgot...I have a func to do this...you do a WM_COMMAND and
            assemble it.
            Here's a sniplit of my code:

            WPARAM wParam = MAKEWPARAM(DlgControlId, wNotify);
            LPARAM lParam = (LPARAM) ctlHandle;
            m_nRetVal = (int) SendMessage(dlgHandle, WM_COMMAND, wParam, lParam);

            tis basic. just need to PACk thos WPARAM/LPARAM things.


            -----Original Message-----
            From: perlguitest@yahoogroups.com [mailto:perlguitest@yahoogroups.com]
            On Behalf Of Tim Mitchell
            Sent: Thursday, June 29, 2006 10:11 AM
            To: perlguitest@yahoogroups.com
            Subject: [perlguitest] Re: Making an application accept the ComboBox
            selection



            That sounds like a good idea, but this is the first I've heard about
            SendNotify. I Googled MSDN documentation to find out how to use a
            message called SendNotify or **_SENDNOTIFY and found nothing. Is
            this a C++ or Perl command? Where can I find documentation on it?
            Maybe a small example would help.

            --- In perlguitest@ <mailto:perlguitest%40yahoogroups.com>
            yahoogroups.com, "stuart arnold"
            <stuart.arnold@...> wrote:
            >
            > Did you try a SendNotify() message?
            > I find that some apps (the way they are written) wait for that to
            > collect the data before the OK is pressed.
            >
            >
            > -----Original Message-----
            > From: perlguitest@ <mailto:perlguitest%40yahoogroups.com>
            yahoogroups.com
            [mailto:perlguitest@ <mailto:perlguitest%40yahoogroups.com>
            yahoogroups.com]
            > On Behalf Of Tim Mitchell
            > Sent: Tuesday, June 27, 2006 5:44 PM
            > To: perlguitest@ <mailto:perlguitest%40yahoogroups.com>
            yahoogroups.com
            > Subject: [perlguitest] Making an application accept the ComboBox
            > selection
            >
            >
            >
            > Hi All,
            >
            > I am trying to write a general function to select an item from a
            > combobox. I've successfully found the handle of the ComboBox, then
            > using any one of these three methods...
            >
            > Method 1: Using the functions SendMessage with CB_FINDSTRING and
            > SelComboItem().
            > Method 2: Using the functions SendMessage with CB_FINDSTRING and
            > CB_SETCURSEL.
            > Method 3: Using the functions SendMessage with CB_FINDSTRING and
            > CB_SELECTSTRING.
            >
            > ...I was able to apparently change the selected item in the
            > ComboBox. That is to say that I could see the selection change in
            > the application that I am testing. However when I "click"
            > the "Apply" button of the application, the result is that I really
            > never did change the selection at all. The application used the
            > original default ComboBox selection.
            >
            > I managed to write some code that found the coordinates of the
            > ComboBox, Clicked on it to expose the drop-down list, and then
            used
            > MouseMoveAbsPix( $x, $y ) and SendMouse("{LEFTCLICK}") on the
            > desired item. I had to hard code a new $y value to get to the
            > particular item in the list. This produced the desired result. The
            > problem here is that this only works for a particular list of
            items
            > in the application's ComboBox. In general, this drop-down list
            > varies as the user works. Since ComboBoxes are so common, I really
            > need a general function
            >
            > How can I get one of the first 3 methods to make the application
            > actually accept the ComboBox selection?
            >
            > Tim
            >
            >
            >
            >
            >
            >
            >
            > [Non-text portions of this message have been removed]
            >







            [Non-text portions of this message have been removed]
          Your message has been successfully submitted and would be delivered to recipients shortly.