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

Re: WMSetText to '#32770' dialog then PushChildButton OK, windows send default v

Expand Messages
  • oohay1_2005
    i could find a sample dlg to do WMSetText, but found a sample gui that also uses class 32770 for SelComboItemText: a printing preference dialog (HP color laser
    Message 1 of 16 , Nov 2, 2005
    • 0 Attachment
      i could find a sample dlg to do WMSetText, but found a sample gui that
      also uses class 32770 for SelComboItemText: a printing preference
      dialog (HP color laser jet ps; driver should be bundled with window
      xp; can add driver if not available)

      for example, assume a ui "HP Color LaserJet PS" is present:

      use Win32::GuiTest qw(:ALL);
      use strict;

      my @whnds = WaitWindowLike( undef, "^HP Color LaserJet PS", undef,
      undef, undef, 30 );
      if( !@whnds ){
      die "Cannot find window \n";
      }
      else{
      SetForegroundWindow ($whnds[0]);
      sleep 1;
      SendKeys("%pf");
      sleep 1;
      my $parHnd = WaitWindowLike( "^HP Color LaserJet PS Printing
      Preferences", "^Layout", "^#32770", undef, undef, 2 );
      my $hnd = WaitWindowLike( $parHnd, "^Layout", "^#32770", undef,
      undef, 2 );
      printf( "Layout: %x\n", $hnd);
      PushChildButton ($hnd, "^&Landscape");

      my $hnd = WaitWindowLike( $parHnd, "^Layout", "^#32770", undef,
      undef, 2 );
      my $hnd = WaitWindowLike( $hnd, undef, "^ComboBox", undef, undef, 2 );
      printf( "combo: %x\n", $hnd);

      #SelComboString($hnd, "2");
      SelComboItemText($hnd, "2");
      sleep 2;
      PushButton ("^OK");

      }

      now, manually open same printing pref dialog and notice pages per
      sheet is not the set to 2; similar to problem with WMSetText, value is
      not saved when dialog is closed by PushButton/PushChildButton.



      --- In perlguitest@yahoogroups.com, "Piotr Kaluski" <pkaluski@p...> wrote:
      >
      > --- In perlguitest@yahoogroups.com, "oohay1_2005" <oohay1_2005@y...>
      > wrote:
      > >
      > > why is it that when do WMSetText ($hnd "abc") to a class '#32770'
      > dialog
      > > then PushChildButton ($hnd, "^OK");
      > > gui show "abc" in Edit field but after Ok button is press, windows
      > > send previous/default value?
      > > how to resolve this issue?
      > >
      >
      > Can you be more specific on what is going on? How about some code
      > snippets?
      >
      > --Piotr
      >
    • Piotr Kaluski
      There are some mistakes in your code. Maybe that s the reason. my @whnds = WaitWindowLike( undef, ^HP Color LaserJet PS ....) WaitWindowLike returns scalar
      Message 2 of 16 , Nov 2, 2005
      • 0 Attachment
        There are some mistakes in your code. Maybe that's the reason.

        my @whnds = WaitWindowLike( undef, "^HP Color LaserJet PS" ....)

        WaitWindowLike returns scalar value, not a list (but in your code it
        should work)

        More important thing:

        my $parHnd = WaitWindowLike( "^HP Color LaserJet PS Printing
        Preferences", "^Layout", "^#32770", undef, undef, 2 );

        First parameter expected by WaitWindowLike is a parent handle (which
        I asume you know, since you used the function correctly before).

        Also, check that there is no other button with caption beginning
        with "OK"

        And why have you chosen to use SelComboItemText instead of
        SelComboString?

        --Piotr

        --- In perlguitest@yahoogroups.com, "oohay1_2005" <oohay1_2005@y...>
        wrote:
        >
        > i could find a sample dlg to do WMSetText, but found a sample gui
        that
        > also uses class 32770 for SelComboItemText: a printing preference
        > dialog (HP color laser jet ps; driver should be bundled with window
        > xp; can add driver if not available)
        >
        > for example, assume a ui "HP Color LaserJet PS" is present:
        >
        > use Win32::GuiTest qw(:ALL);
        > use strict;
        >
        > my @whnds = WaitWindowLike( undef, "^HP Color LaserJet PS", undef,
        > undef, undef, 30 );
        > if( !@whnds ){
        > die "Cannot find window \n";
        > }
        > else{
        > SetForegroundWindow ($whnds[0]);
        > sleep 1;
        > SendKeys("%pf");
        > sleep 1;
        > my $parHnd = WaitWindowLike( "^HP Color LaserJet PS Printing
        > Preferences", "^Layout", "^#32770", undef, undef, 2 );
        > my $hnd = WaitWindowLike(
        $parHnd, "^Layout", "^#32770", undef,
        > undef, 2 );
        > printf( "Layout: %x\n", $hnd);
        > PushChildButton ($hnd, "^&Landscape");
        >
        > my $hnd = WaitWindowLike(
        $parHnd, "^Layout", "^#32770", undef,
        > undef, 2 );
        > my $hnd = WaitWindowLike( $hnd, undef, "^ComboBox",
        undef, undef, 2 );
        > printf( "combo: %x\n", $hnd);
        >
        > #SelComboString($hnd, "2");
        > SelComboItemText($hnd, "2");
        > sleep 2;
        > PushButton ("^OK");
        >
        > }
        >
        > now, manually open same printing pref dialog and notice pages per
        > sheet is not the set to 2; similar to problem with WMSetText, value
        is
        > not saved when dialog is closed by PushButton/PushChildButton.
        >
        >
        >
        > --- In perlguitest@yahoogroups.com, "Piotr Kaluski" <pkaluski@p...>
        wrote:
        > >
        > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
        <oohay1_2005@y...>
        > > wrote:
        > > >
        > > > why is it that when do WMSetText ($hnd "abc") to a
        class '#32770'
        > > dialog
        > > > then PushChildButton ($hnd, "^OK");
        > > > gui show "abc" in Edit field but after Ok button is press,
        windows
        > > > send previous/default value?
        > > > how to resolve this issue?
        > > >
        > >
        > > Can you be more specific on what is going on? How about some code
        > > snippets?
        > >
        > > --Piotr
        > >
        >
      • oohay1_2005
        ... question: In the example below, if button OK was not found then dialog would not closed, correct? But, dialog does closed. ... neither method works; it
        Message 3 of 16 , Nov 3, 2005
        • 0 Attachment
          > Also, check that there is no other button with caption beginning
          > with "OK"
          question: In the example below, if button OK was not found then dialog
          would not closed, correct? But, dialog does closed.

          > And why have you chosen to use SelComboItemText instead of
          > SelComboString?
          neither method works; it just happen to be the last method tried.

          The actual #32770 class I was after is McAfee On-Access Properties,
          but it's not common, so installing HP Color LaserJet PS driver should
          be easier to work with.


          --- In perlguitest@yahoogroups.com, "Piotr Kaluski" <pkaluski@p...> wrote:
          >
          > There are some mistakes in your code. Maybe that's the reason.
          >
          > my @whnds = WaitWindowLike( undef, "^HP Color LaserJet PS" ....)
          >
          > WaitWindowLike returns scalar value, not a list (but in your code it
          > should work)
          >
          > More important thing:
          >
          > my $parHnd = WaitWindowLike( "^HP Color LaserJet PS Printing
          > Preferences", "^Layout", "^#32770", undef, undef, 2 );
          >
          > First parameter expected by WaitWindowLike is a parent handle (which
          > I asume you know, since you used the function correctly before).
          >
          > Also, check that there is no other button with caption beginning
          > with "OK"
          >
          > And why have you chosen to use SelComboItemText instead of
          > SelComboString?
          >
          > --Piotr
          >
          > --- In perlguitest@yahoogroups.com, "oohay1_2005" <oohay1_2005@y...>
          > wrote:
          > >
          > > i could find a sample dlg to do WMSetText, but found a sample gui
          > that
          > > also uses class 32770 for SelComboItemText: a printing preference
          > > dialog (HP color laser jet ps; driver should be bundled with window
          > > xp; can add driver if not available)
          > >
          > > for example, assume a ui "HP Color LaserJet PS" is present:
          > >
          > > use Win32::GuiTest qw(:ALL);
          > > use strict;
          > >
          > > my @whnds = WaitWindowLike( undef, "^HP Color LaserJet PS", undef,
          > > undef, undef, 30 );
          > > if( !@whnds ){
          > > die "Cannot find window \n";
          > > }
          > > else{
          > > SetForegroundWindow ($whnds[0]);
          > > sleep 1;
          > > SendKeys("%pf");
          > > sleep 1;
          > > my $parHnd = WaitWindowLike( "^HP Color LaserJet PS Printing
          > > Preferences", "^Layout", "^#32770", undef, undef, 2 );
          > > my $hnd = WaitWindowLike(
          > $parHnd, "^Layout", "^#32770", undef,
          > > undef, 2 );
          > > printf( "Layout: %x\n", $hnd);
          > > PushChildButton ($hnd, "^&Landscape");
          > >
          > > my $hnd = WaitWindowLike(
          > $parHnd, "^Layout", "^#32770", undef,
          > > undef, 2 );
          > > my $hnd = WaitWindowLike( $hnd, undef, "^ComboBox",
          > undef, undef, 2 );
          > > printf( "combo: %x\n", $hnd);
          > >
          > > #SelComboString($hnd, "2");
          > > SelComboItemText($hnd, "2");
          > > sleep 2;
          > > PushButton ("^OK");
          > >
          > > }
          > >
          > > now, manually open same printing pref dialog and notice pages per
          > > sheet is not the set to 2; similar to problem with WMSetText, value
          > is
          > > not saved when dialog is closed by PushButton/PushChildButton.
          > >
          > >
          > >
          > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski" <pkaluski@p...>
          > wrote:
          > > >
          > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
          > <oohay1_2005@y...>
          > > > wrote:
          > > > >
          > > > > why is it that when do WMSetText ($hnd "abc") to a
          > class '#32770'
          > > > dialog
          > > > > then PushChildButton ($hnd, "^OK");
          > > > > gui show "abc" in Edit field but after Ok button is press,
          > windows
          > > > > send previous/default value?
          > > > > how to resolve this issue?
          > > > >
          > > >
          > > > Can you be more specific on what is going on? How about some code
          > > > snippets?
          > > >
          > > > --Piotr
          > > >
          > >
          >
        • lmarlin
          This example may help - even if it s imperfect (see header notes ================================================================= # The goal of this example
          Message 4 of 16 , Nov 4, 2005
          • 0 Attachment
            This example may help - even if it's imperfect (see header notes
            =================================================================
            # The goal of this example is to open
            # the Printing Preferences window for a printer,
            # sets the Landscape option and number of pages per page preference
            # and then Apply
            # and OK

            # when you check the settings after it is done,
            # you see that the Landscape setting is in effect,
            # but the number of pages is still 1

            # Why doesn't the number of pages get set to 2 and "stick"?

            use Win32::GuiTest qw(:ALL);
            use strict;

            my $WinCaption = "^HP LaserJet 2100 PCL6";
            my $MessageClass = "PrintUI_PrinterQueue";

            my @whnds = FindWindowLike( 0, $WinCaption, $MessageClass );
            #
            # want only one window in response to the search
            #
            if ( !( scalar @whnds == 1 && IsWindow($whnds[0])) )
            {
            die "No Printer Window (or too many)";
            }

            SetForegroundWindow ($whnds[0]);
            sleep 1;

            SendKeys("%pf"); # Send keystrokes to access Printing
            Preferences window
            sleep 1;

            my $parHnd = WaitWindowLike( "^HP LaserJet 2100 PCL6 Printing
            Preferences", "^Layout", "^#32770", undef, undef, 2 );

            #
            # Find the Layout tab
            #
            my $hnd = WaitWindowLike(
            $parHnd, "^Layout", "^#32770", undef, undef, 2 );
            printf( "Layout: %x\n", $hnd);
            PushChildButton ($hnd, "^&Landscape");

            my $hnd = WaitWindowLike(
            $parHnd, "^Layout", "^#32770", undef, undef, 2 );
            my $hnd = WaitWindowLike( $hnd, undef, "^ComboBox",
            undef, undef, 2 );
            printf( "combo: %x\n", $hnd);

            # SelComboString($hnd, "2");
            SelComboItemText($hnd, "2");

            sleep 2;

            PushButton ("^&Apply");

            sleep 2;

            PushButton ("^OK");

            Fish


            --- In perlguitest@yahoogroups.com, "oohay1_2005" <oohay1_2005@y...>
            wrote:
            >
            > > Also, check that there is no other button with caption beginning
            > > with "OK"
            > question: In the example below, if button OK was not found then
            dialog
            > would not closed, correct? But, dialog does closed.
            >
            > > And why have you chosen to use SelComboItemText instead of
            > > SelComboString?
            > neither method works; it just happen to be the last method tried.
            >
            > The actual #32770 class I was after is McAfee On-Access Properties,
            > but it's not common, so installing HP Color LaserJet PS driver
            should
            > be easier to work with.
            >
            >
            > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
            <pkaluski@p...> wrote:
            > >
            > > There are some mistakes in your code. Maybe that's the reason.
            > >
            > > my @whnds = WaitWindowLike( undef, "^HP Color LaserJet PS" ....)
            > >
            > > WaitWindowLike returns scalar value, not a list (but in your
            code it
            > > should work)
            > >
            > > More important thing:
            > >
            > > my $parHnd = WaitWindowLike( "^HP Color LaserJet PS Printing
            > > Preferences", "^Layout", "^#32770", undef, undef,
            2 );
            > >
            > > First parameter expected by WaitWindowLike is a parent handle
            (which
            > > I asume you know, since you used the function correctly before).
            > >
            > > Also, check that there is no other button with caption beginning
            > > with "OK"
            > >
            > > And why have you chosen to use SelComboItemText instead of
            > > SelComboString?
            > >
            > > --Piotr
            > >
            > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
            <oohay1_2005@y...>
            > > wrote:
            > > >
            > > > i could find a sample dlg to do WMSetText, but found a sample
            gui
            > > that
            > > > also uses class 32770 for SelComboItemText: a printing
            preference
            > > > dialog (HP color laser jet ps; driver should be bundled with
            window
            > > > xp; can add driver if not available)
            > > >
            > > > for example, assume a ui "HP Color LaserJet PS" is present:
            > > >
            > > > use Win32::GuiTest qw(:ALL);
            > > > use strict;
            > > >
            > > > my @whnds = WaitWindowLike( undef, "^HP Color LaserJet PS",
            undef,
            > > > undef, undef, 30 );
            > > > if( !@whnds ){
            > > > die "Cannot find window \n";
            > > > }
            > > > else{
            > > > SetForegroundWindow ($whnds[0]);
            > > > sleep 1;
            > > > SendKeys("%pf");
            > > > sleep 1;
            > > > my $parHnd = WaitWindowLike( "^HP Color LaserJet PS Printing
            > > > Preferences", "^Layout", "^#32770", undef, undef, 2 );
            > > > my $hnd = WaitWindowLike(
            > > $parHnd, "^Layout", "^#32770", undef,
            > > > undef, 2 );
            > > > printf( "Layout: %x\n", $hnd);
            > > > PushChildButton ($hnd, "^&Landscape");
            > > >
            > > > my $hnd = WaitWindowLike(
            > > $parHnd, "^Layout", "^#32770", undef,
            > > > undef, 2 );
            > > > my $hnd = WaitWindowLike( $hnd, undef, "^ComboBox",
            > > undef, undef, 2 );
            > > > printf( "combo: %x\n", $hnd);
            > > >
            > > > #SelComboString($hnd, "2");
            > > > SelComboItemText($hnd, "2");
            > > > sleep 2;
            > > > PushButton ("^OK");
            > > >
            > > > }
            > > >
            > > > now, manually open same printing pref dialog and notice pages
            per
            > > > sheet is not the set to 2; similar to problem with WMSetText,
            value
            > > is
            > > > not saved when dialog is closed by PushButton/PushChildButton.
            > > >
            > > >
            > > >
            > > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
            <pkaluski@p...>
            > > wrote:
            > > > >
            > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
            > > <oohay1_2005@y...>
            > > > > wrote:
            > > > > >
            > > > > > why is it that when do WMSetText ($hnd "abc") to a
            > > class '#32770'
            > > > > dialog
            > > > > > then PushChildButton ($hnd, "^OK");
            > > > > > gui show "abc" in Edit field but after Ok button is press,
            > > windows
            > > > > > send previous/default value?
            > > > > > how to resolve this issue?
            > > > > >
            > > > >
            > > > > Can you be more specific on what is going on? How about some
            code
            > > > > snippets?
            > > > >
            > > > > --Piotr
            > > > >
            > > >
            > >
            >
          • oohay1_2005
            anyone has any idea why WMSetText and SelCombo* are not working (value/setting not stick) with class 32770 dialogs or how to resolve the issue? thanks.
            Message 5 of 16 , Nov 9, 2005
            • 0 Attachment
              anyone has any idea why WMSetText and SelCombo* are not working
              (value/setting not stick) with class 32770 dialogs or how to resolve
              the issue? thanks.

              --- In perlguitest@yahoogroups.com, "lmarlin" <lmarlin@y...> wrote:
              >
              > This example may help - even if it's imperfect (see header notes
              > =================================================================
              > # The goal of this example is to open
              > # the Printing Preferences window for a printer,
              > # sets the Landscape option and number of pages per page preference
              > # and then Apply
              > # and OK
              >
              > # when you check the settings after it is done,
              > # you see that the Landscape setting is in effect,
              > # but the number of pages is still 1
              >
              > # Why doesn't the number of pages get set to 2 and "stick"?
              >
              > use Win32::GuiTest qw(:ALL);
              > use strict;
              >
              > my $WinCaption = "^HP LaserJet 2100 PCL6";
              > my $MessageClass = "PrintUI_PrinterQueue";
              >
              > my @whnds = FindWindowLike( 0, $WinCaption, $MessageClass );
              > #
              > # want only one window in response to the search
              > #
              > if ( !( scalar @whnds == 1 && IsWindow($whnds[0])) )
              > {
              > die "No Printer Window (or too many)";
              > }
              >
              > SetForegroundWindow ($whnds[0]);
              > sleep 1;
              >
              > SendKeys("%pf"); # Send keystrokes to access Printing
              > Preferences window
              > sleep 1;
              >
              > my $parHnd = WaitWindowLike( "^HP LaserJet 2100 PCL6 Printing
              > Preferences", "^Layout", "^#32770", undef, undef, 2 );
              >
              > #
              > # Find the Layout tab
              > #
              > my $hnd = WaitWindowLike(
              > $parHnd, "^Layout", "^#32770", undef, undef, 2 );
              > printf( "Layout: %x\n", $hnd);
              > PushChildButton ($hnd, "^&Landscape");
              >
              > my $hnd = WaitWindowLike(
              > $parHnd, "^Layout", "^#32770", undef, undef, 2 );
              > my $hnd = WaitWindowLike( $hnd, undef, "^ComboBox",
              > undef, undef, 2 );
              > printf( "combo: %x\n", $hnd);
              >
              > # SelComboString($hnd, "2");
              > SelComboItemText($hnd, "2");
              >
              > sleep 2;
              >
              > PushButton ("^&Apply");
              >
              > sleep 2;
              >
              > PushButton ("^OK");
              >
              > Fish
              >
              >
              > --- In perlguitest@yahoogroups.com, "oohay1_2005" <oohay1_2005@y...>
              > wrote:
              > >
              > > > Also, check that there is no other button with caption beginning
              > > > with "OK"
              > > question: In the example below, if button OK was not found then
              > dialog
              > > would not closed, correct? But, dialog does closed.
              > >
              > > > And why have you chosen to use SelComboItemText instead of
              > > > SelComboString?
              > > neither method works; it just happen to be the last method tried.
              > >
              > > The actual #32770 class I was after is McAfee On-Access Properties,
              > > but it's not common, so installing HP Color LaserJet PS driver
              > should
              > > be easier to work with.
              > >
              > >
              > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
              > <pkaluski@p...> wrote:
              > > >
              > > > There are some mistakes in your code. Maybe that's the reason.
              > > >
              > > > my @whnds = WaitWindowLike( undef, "^HP Color LaserJet PS" ....)
              > > >
              > > > WaitWindowLike returns scalar value, not a list (but in your
              > code it
              > > > should work)
              > > >
              > > > More important thing:
              > > >
              > > > my $parHnd = WaitWindowLike( "^HP Color LaserJet PS Printing
              > > > Preferences", "^Layout", "^#32770", undef, undef,
              > 2 );
              > > >
              > > > First parameter expected by WaitWindowLike is a parent handle
              > (which
              > > > I asume you know, since you used the function correctly before).
              > > >
              > > > Also, check that there is no other button with caption beginning
              > > > with "OK"
              > > >
              > > > And why have you chosen to use SelComboItemText instead of
              > > > SelComboString?
              > > >
              > > > --Piotr
              > > >
              > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
              > <oohay1_2005@y...>
              > > > wrote:
              > > > >
              > > > > i could find a sample dlg to do WMSetText, but found a sample
              > gui
              > > > that
              > > > > also uses class 32770 for SelComboItemText: a printing
              > preference
              > > > > dialog (HP color laser jet ps; driver should be bundled with
              > window
              > > > > xp; can add driver if not available)
              > > > >
              > > > > for example, assume a ui "HP Color LaserJet PS" is present:
              > > > >
              > > > > use Win32::GuiTest qw(:ALL);
              > > > > use strict;
              > > > >
              > > > > my @whnds = WaitWindowLike( undef, "^HP Color LaserJet PS",
              > undef,
              > > > > undef, undef, 30 );
              > > > > if( !@whnds ){
              > > > > die "Cannot find window \n";
              > > > > }
              > > > > else{
              > > > > SetForegroundWindow ($whnds[0]);
              > > > > sleep 1;
              > > > > SendKeys("%pf");
              > > > > sleep 1;
              > > > > my $parHnd = WaitWindowLike( "^HP Color LaserJet PS Printing
              > > > > Preferences", "^Layout", "^#32770", undef, undef, 2 );
              > > > > my $hnd = WaitWindowLike(
              > > > $parHnd, "^Layout", "^#32770", undef,
              > > > > undef, 2 );
              > > > > printf( "Layout: %x\n", $hnd);
              > > > > PushChildButton ($hnd, "^&Landscape");
              > > > >
              > > > > my $hnd = WaitWindowLike(
              > > > $parHnd, "^Layout", "^#32770", undef,
              > > > > undef, 2 );
              > > > > my $hnd = WaitWindowLike( $hnd, undef, "^ComboBox",
              > > > undef, undef, 2 );
              > > > > printf( "combo: %x\n", $hnd);
              > > > >
              > > > > #SelComboString($hnd, "2");
              > > > > SelComboItemText($hnd, "2");
              > > > > sleep 2;
              > > > > PushButton ("^OK");
              > > > >
              > > > > }
              > > > >
              > > > > now, manually open same printing pref dialog and notice pages
              > per
              > > > > sheet is not the set to 2; similar to problem with WMSetText,
              > value
              > > > is
              > > > > not saved when dialog is closed by PushButton/PushChildButton.
              > > > >
              > > > >
              > > > >
              > > > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
              > <pkaluski@p...>
              > > > wrote:
              > > > > >
              > > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
              > > > <oohay1_2005@y...>
              > > > > > wrote:
              > > > > > >
              > > > > > > why is it that when do WMSetText ($hnd "abc") to a
              > > > class '#32770'
              > > > > > dialog
              > > > > > > then PushChildButton ($hnd, "^OK");
              > > > > > > gui show "abc" in Edit field but after Ok button is press,
              > > > windows
              > > > > > > send previous/default value?
              > > > > > > how to resolve this issue?
              > > > > > >
              > > > > >
              > > > > > Can you be more specific on what is going on? How about some
              > code
              > > > > > snippets?
              > > > > >
              > > > > > --Piotr
              > > > > >
              > > > >
              > > >
              > >
              >
            • splemmon
              I had a similar problem with both SelComboItemText and SelComboString functions while automating my application. I found that the selected item would be shown
              Message 6 of 16 , Nov 14, 2005
              • 0 Attachment
                I had a similar problem with both SelComboItemText and SelComboString
                functions while automating my application. I found that the selected
                item would be shown in the combo box, but the item was not saved
                after the OK was clicked. Only the first item in the list would be
                saved. It seemed as though the combo box was updated with the
                selection (visually), but the application wasn't aware of it.

                My workaround was to set focus on the combo box, then send the
                correct number of down arrows:

                SetFocus( $file_type[0] );
                SendKeys( "{DOWN}{DOWN}{DOWN}{DOWN}", 0.25 );

                Regards,

                Steve

                --- In perlguitest@yahoogroups.com, "oohay1_2005" <oohay1_2005@y...>
                wrote:
                >
                > anyone has any idea why WMSetText and SelCombo* are not working
                > (value/setting not stick) with class 32770 dialogs or how to resolve
                > the issue? thanks.
                >
                > --- In perlguitest@yahoogroups.com, "lmarlin" <lmarlin@y...> wrote:
                > >
                > > This example may help - even if it's imperfect (see header notes
                > > =================================================================
                > > # The goal of this example is to open
                > > # the Printing Preferences window for a printer,
                > > # sets the Landscape option and number of pages per page
                preference
                > > # and then Apply
                > > # and OK
                > >
                > > # when you check the settings after it is done,
                > > # you see that the Landscape setting is in effect,
                > > # but the number of pages is still 1
                > >
                > > # Why doesn't the number of pages get set to 2 and "stick"?
                > >
                > > use Win32::GuiTest qw(:ALL);
                > > use strict;
                > >
                > > my $WinCaption = "^HP LaserJet 2100 PCL6";
                > > my $MessageClass = "PrintUI_PrinterQueue";
                > >
                > > my @whnds = FindWindowLike( 0, $WinCaption, $MessageClass );
                > > #
                > > # want only one window in response to the search
                > > #
                > > if ( !( scalar @whnds == 1 && IsWindow($whnds[0])) )
                > > {
                > > die "No Printer Window (or too many)";
                > > }
                > >
                > > SetForegroundWindow ($whnds[0]);
                > > sleep 1;
                > >
                > > SendKeys("%pf"); # Send keystrokes to access
                Printing
                > > Preferences window
                > > sleep 1;
                > >
                > > my $parHnd = WaitWindowLike( "^HP LaserJet 2100 PCL6
                Printing
                > > Preferences", "^Layout", "^#32770", undef, undef, 2 );
                > >
                > > #
                > > # Find the Layout tab
                > > #
                > > my $hnd = WaitWindowLike(
                > > $parHnd, "^Layout", "^#32770", undef, undef, 2 );
                > > printf( "Layout: %x\n", $hnd);
                > > PushChildButton ($hnd, "^&Landscape");
                > >
                > > my $hnd = WaitWindowLike(
                > > $parHnd, "^Layout", "^#32770", undef, undef, 2 );
                > > my $hnd = WaitWindowLike( $hnd, undef, "^ComboBox",
                > > undef, undef, 2 );
                > > printf( "combo: %x\n", $hnd);
                > >
                > > # SelComboString($hnd, "2");
                > > SelComboItemText($hnd, "2");
                > >
                > > sleep 2;
                > >
                > > PushButton ("^&Apply");
                > >
                > > sleep 2;
                > >
                > > PushButton ("^OK");
                > >
                > > Fish
                > >
                > >
                > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                <oohay1_2005@y...>
                > > wrote:
                > > >
                > > > > Also, check that there is no other button with caption
                beginning
                > > > > with "OK"
                > > > question: In the example below, if button OK was not found then
                > > dialog
                > > > would not closed, correct? But, dialog does closed.
                > > >
                > > > > And why have you chosen to use SelComboItemText instead of
                > > > > SelComboString?
                > > > neither method works; it just happen to be the last method
                tried.
                > > >
                > > > The actual #32770 class I was after is McAfee On-Access
                Properties,
                > > > but it's not common, so installing HP Color LaserJet PS driver
                > > should
                > > > be easier to work with.
                > > >
                > > >
                > > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
                > > <pkaluski@p...> wrote:
                > > > >
                > > > > There are some mistakes in your code. Maybe that's the reason.
                > > > >
                > > > > my @whnds = WaitWindowLike( undef, "^HP Color LaserJet
                PS" ....)
                > > > >
                > > > > WaitWindowLike returns scalar value, not a list (but in your
                > > code it
                > > > > should work)
                > > > >
                > > > > More important thing:
                > > > >
                > > > > my $parHnd = WaitWindowLike( "^HP Color LaserJet PS Printing
                > > > > Preferences", "^Layout", "^#32770", undef,
                undef,
                > > 2 );
                > > > >
                > > > > First parameter expected by WaitWindowLike is a parent handle
                > > (which
                > > > > I asume you know, since you used the function correctly
                before).
                > > > >
                > > > > Also, check that there is no other button with caption
                beginning
                > > > > with "OK"
                > > > >
                > > > > And why have you chosen to use SelComboItemText instead of
                > > > > SelComboString?
                > > > >
                > > > > --Piotr
                > > > >
                > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                > > <oohay1_2005@y...>
                > > > > wrote:
                > > > > >
                > > > > > i could find a sample dlg to do WMSetText, but found a
                sample
                > > gui
                > > > > that
                > > > > > also uses class 32770 for SelComboItemText: a printing
                > > preference
                > > > > > dialog (HP color laser jet ps; driver should be bundled
                with
                > > window
                > > > > > xp; can add driver if not available)
                > > > > >
                > > > > > for example, assume a ui "HP Color LaserJet PS" is present:
                > > > > >
                > > > > > use Win32::GuiTest qw(:ALL);
                > > > > > use strict;
                > > > > >
                > > > > > my @whnds = WaitWindowLike( undef, "^HP Color LaserJet PS",
                > > undef,
                > > > > > undef, undef, 30 );
                > > > > > if( !@whnds ){
                > > > > > die "Cannot find window \n";
                > > > > > }
                > > > > > else{
                > > > > > SetForegroundWindow ($whnds[0]);
                > > > > > sleep 1;
                > > > > > SendKeys("%pf");
                > > > > > sleep 1;
                > > > > > my $parHnd = WaitWindowLike( "^HP Color LaserJet PS
                Printing
                > > > > > Preferences", "^Layout", "^#32770", undef, undef, 2 );
                > > > > > my $hnd = WaitWindowLike(
                > > > > $parHnd, "^Layout", "^#32770", undef,
                > > > > > undef, 2 );
                > > > > > printf( "Layout: %x\n", $hnd);
                > > > > > PushChildButton ($hnd, "^&Landscape");
                > > > > >
                > > > > > my $hnd = WaitWindowLike(
                > > > > $parHnd, "^Layout", "^#32770", undef,
                > > > > > undef, 2 );
                > > > > > my $hnd = WaitWindowLike( $hnd,
                undef, "^ComboBox",
                > > > > undef, undef, 2 );
                > > > > > printf( "combo: %x\n", $hnd);
                > > > > >
                > > > > > #SelComboString($hnd, "2");
                > > > > > SelComboItemText($hnd, "2");
                > > > > > sleep 2;
                > > > > > PushButton ("^OK");
                > > > > >
                > > > > > }
                > > > > >
                > > > > > now, manually open same printing pref dialog and notice
                pages
                > > per
                > > > > > sheet is not the set to 2; similar to problem with
                WMSetText,
                > > value
                > > > > is
                > > > > > not saved when dialog is closed by
                PushButton/PushChildButton.
                > > > > >
                > > > > >
                > > > > >
                > > > > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
                > > <pkaluski@p...>
                > > > > wrote:
                > > > > > >
                > > > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                > > > > <oohay1_2005@y...>
                > > > > > > wrote:
                > > > > > > >
                > > > > > > > why is it that when do WMSetText ($hnd "abc") to a
                > > > > class '#32770'
                > > > > > > dialog
                > > > > > > > then PushChildButton ($hnd, "^OK");
                > > > > > > > gui show "abc" in Edit field but after Ok button is
                press,
                > > > > windows
                > > > > > > > send previous/default value?
                > > > > > > > how to resolve this issue?
                > > > > > > >
                > > > > > >
                > > > > > > Can you be more specific on what is going on? How about
                some
                > > code
                > > > > > > snippets?
                > > > > > >
                > > > > > > --Piotr
                > > > > > >
                > > > > >
                > > > >
                > > >
                > >
                >
              • Piotr Kaluski
                OK. Guys, I will try to find some time to have a look at it. It is close to christmass so... well, you know :-). But I will try... --Piotr ... SelComboString
                Message 7 of 16 , Nov 15, 2005
                • 0 Attachment
                  OK.
                  Guys, I will try to find some time to have a look at it. It is close
                  to christmass so... well, you know :-). But I will try...

                  --Piotr


                  --- In perlguitest@yahoogroups.com, "splemmon" <steve_lemmon@h...>
                  wrote:
                  >
                  > I had a similar problem with both SelComboItemText and
                  SelComboString
                  > functions while automating my application. I found that the
                  selected
                  > item would be shown in the combo box, but the item was not saved
                  > after the OK was clicked. Only the first item in the list would be
                  > saved. It seemed as though the combo box was updated with the
                  > selection (visually), but the application wasn't aware of it.
                  >
                  > My workaround was to set focus on the combo box, then send the
                  > correct number of down arrows:
                  >
                  > SetFocus( $file_type[0] );
                  > SendKeys( "{DOWN}{DOWN}{DOWN}{DOWN}", 0.25 );
                  >
                  > Regards,
                  >
                  > Steve
                  >
                  > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                  <oohay1_2005@y...>
                  > wrote:
                  > >
                  > > anyone has any idea why WMSetText and SelCombo* are not working
                  > > (value/setting not stick) with class 32770 dialogs or how to
                  resolve
                  > > the issue? thanks.
                  > >
                  > > --- In perlguitest@yahoogroups.com, "lmarlin" <lmarlin@y...>
                  wrote:
                  > > >
                  > > > This example may help - even if it's imperfect (see header notes
                  > > >
                  =================================================================
                  > > > # The goal of this example is to open
                  > > > # the Printing Preferences window for a printer,
                  > > > # sets the Landscape option and number of pages per page
                  > preference
                  > > > # and then Apply
                  > > > # and OK
                  > > >
                  > > > # when you check the settings after it is done,
                  > > > # you see that the Landscape setting is in effect,
                  > > > # but the number of pages is still 1
                  > > >
                  > > > # Why doesn't the number of pages get set to 2 and "stick"?
                  > > >
                  > > > use Win32::GuiTest qw(:ALL);
                  > > > use strict;
                  > > >
                  > > > my $WinCaption = "^HP LaserJet 2100 PCL6";
                  > > > my $MessageClass = "PrintUI_PrinterQueue";
                  > > >
                  > > > my @whnds = FindWindowLike( 0, $WinCaption, $MessageClass );
                  > > > #
                  > > > # want only one window in response to the search
                  > > > #
                  > > > if ( !( scalar @whnds == 1 && IsWindow($whnds[0])) )
                  > > > {
                  > > > die "No Printer Window (or too many)";
                  > > > }
                  > > >
                  > > > SetForegroundWindow ($whnds[0]);
                  > > > sleep 1;
                  > > >
                  > > > SendKeys("%pf"); # Send keystrokes to access
                  > Printing
                  > > > Preferences window
                  > > > sleep 1;
                  > > >
                  > > > my $parHnd = WaitWindowLike( "^HP LaserJet 2100 PCL6
                  > Printing
                  > > > Preferences", "^Layout", "^#32770", undef, undef, 2 );
                  > > >
                  > > > #
                  > > > # Find the Layout tab
                  > > > #
                  > > > my $hnd = WaitWindowLike(
                  > > > $parHnd, "^Layout", "^#32770", undef, undef, 2 );
                  > > > printf( "Layout: %x\n", $hnd);
                  > > > PushChildButton ($hnd, "^&Landscape");
                  > > >
                  > > > my $hnd = WaitWindowLike(
                  > > > $parHnd, "^Layout", "^#32770", undef, undef, 2 );
                  > > > my $hnd = WaitWindowLike( $hnd,
                  undef, "^ComboBox",
                  > > > undef, undef, 2 );
                  > > > printf( "combo: %x\n", $hnd);
                  > > >
                  > > > # SelComboString($hnd, "2");
                  > > > SelComboItemText($hnd, "2");
                  > > >
                  > > > sleep 2;
                  > > >
                  > > > PushButton ("^&Apply");
                  > > >
                  > > > sleep 2;
                  > > >
                  > > > PushButton ("^OK");
                  > > >
                  > > > Fish
                  > > >
                  > > >
                  > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                  > <oohay1_2005@y...>
                  > > > wrote:
                  > > > >
                  > > > > > Also, check that there is no other button with caption
                  > beginning
                  > > > > > with "OK"
                  > > > > question: In the example below, if button OK was not found
                  then
                  > > > dialog
                  > > > > would not closed, correct? But, dialog does closed.
                  > > > >
                  > > > > > And why have you chosen to use SelComboItemText instead of
                  > > > > > SelComboString?
                  > > > > neither method works; it just happen to be the last method
                  > tried.
                  > > > >
                  > > > > The actual #32770 class I was after is McAfee On-Access
                  > Properties,
                  > > > > but it's not common, so installing HP Color LaserJet PS
                  driver
                  > > > should
                  > > > > be easier to work with.
                  > > > >
                  > > > >
                  > > > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
                  > > > <pkaluski@p...> wrote:
                  > > > > >
                  > > > > > There are some mistakes in your code. Maybe that's the
                  reason.
                  > > > > >
                  > > > > > my @whnds = WaitWindowLike( undef, "^HP Color LaserJet
                  > PS" ....)
                  > > > > >
                  > > > > > WaitWindowLike returns scalar value, not a list (but in
                  your
                  > > > code it
                  > > > > > should work)
                  > > > > >
                  > > > > > More important thing:
                  > > > > >
                  > > > > > my $parHnd = WaitWindowLike( "^HP Color LaserJet PS Printing
                  > > > > > Preferences", "^Layout", "^#32770", undef,
                  > undef,
                  > > > 2 );
                  > > > > >
                  > > > > > First parameter expected by WaitWindowLike is a parent
                  handle
                  > > > (which
                  > > > > > I asume you know, since you used the function correctly
                  > before).
                  > > > > >
                  > > > > > Also, check that there is no other button with caption
                  > beginning
                  > > > > > with "OK"
                  > > > > >
                  > > > > > And why have you chosen to use SelComboItemText instead of
                  > > > > > SelComboString?
                  > > > > >
                  > > > > > --Piotr
                  > > > > >
                  > > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                  > > > <oohay1_2005@y...>
                  > > > > > wrote:
                  > > > > > >
                  > > > > > > i could find a sample dlg to do WMSetText, but found a
                  > sample
                  > > > gui
                  > > > > > that
                  > > > > > > also uses class 32770 for SelComboItemText: a printing
                  > > > preference
                  > > > > > > dialog (HP color laser jet ps; driver should be bundled
                  > with
                  > > > window
                  > > > > > > xp; can add driver if not available)
                  > > > > > >
                  > > > > > > for example, assume a ui "HP Color LaserJet PS" is
                  present:
                  > > > > > >
                  > > > > > > use Win32::GuiTest qw(:ALL);
                  > > > > > > use strict;
                  > > > > > >
                  > > > > > > my @whnds = WaitWindowLike( undef, "^HP Color LaserJet
                  PS",
                  > > > undef,
                  > > > > > > undef, undef, 30 );
                  > > > > > > if( !@whnds ){
                  > > > > > > die "Cannot find window \n";
                  > > > > > > }
                  > > > > > > else{
                  > > > > > > SetForegroundWindow ($whnds[0]);
                  > > > > > > sleep 1;
                  > > > > > > SendKeys("%pf");
                  > > > > > > sleep 1;
                  > > > > > > my $parHnd = WaitWindowLike( "^HP Color LaserJet PS
                  > Printing
                  > > > > > > Preferences", "^Layout", "^#32770", undef, undef, 2 );
                  > > > > > > my $hnd = WaitWindowLike(
                  > > > > > $parHnd, "^Layout", "^#32770", undef,
                  > > > > > > undef, 2 );
                  > > > > > > printf( "Layout: %x\n", $hnd);
                  > > > > > > PushChildButton ($hnd, "^&Landscape");
                  > > > > > >
                  > > > > > > my $hnd = WaitWindowLike(
                  > > > > > $parHnd, "^Layout", "^#32770", undef,
                  > > > > > > undef, 2 );
                  > > > > > > my $hnd = WaitWindowLike( $hnd,
                  > undef, "^ComboBox",
                  > > > > > undef, undef, 2 );
                  > > > > > > printf( "combo: %x\n", $hnd);
                  > > > > > >
                  > > > > > > #SelComboString($hnd, "2");
                  > > > > > > SelComboItemText($hnd, "2");
                  > > > > > > sleep 2;
                  > > > > > > PushButton ("^OK");
                  > > > > > >
                  > > > > > > }
                  > > > > > >
                  > > > > > > now, manually open same printing pref dialog and notice
                  > pages
                  > > > per
                  > > > > > > sheet is not the set to 2; similar to problem with
                  > WMSetText,
                  > > > value
                  > > > > > is
                  > > > > > > not saved when dialog is closed by
                  > PushButton/PushChildButton.
                  > > > > > >
                  > > > > > >
                  > > > > > >
                  > > > > > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
                  > > > <pkaluski@p...>
                  > > > > > wrote:
                  > > > > > > >
                  > > > > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                  > > > > > <oohay1_2005@y...>
                  > > > > > > > wrote:
                  > > > > > > > >
                  > > > > > > > > why is it that when do WMSetText ($hnd "abc") to a
                  > > > > > class '#32770'
                  > > > > > > > dialog
                  > > > > > > > > then PushChildButton ($hnd, "^OK");
                  > > > > > > > > gui show "abc" in Edit field but after Ok button is
                  > press,
                  > > > > > windows
                  > > > > > > > > send previous/default value?
                  > > > > > > > > how to resolve this issue?
                  > > > > > > > >
                  > > > > > > >
                  > > > > > > > Can you be more specific on what is going on? How about
                  > some
                  > > > code
                  > > > > > > > snippets?
                  > > > > > > >
                  > > > > > > > --Piotr
                  > > > > > > >
                  > > > > > >
                  > > > > >
                  > > > >
                  > > >
                  > >
                  >
                • splemmon
                  Piotr, Appreciate your assistance... though I ve found plenty of other bugs that can keep you busy during the holidays ;-) As for the ComboBox anomalies, I ve
                  Message 8 of 16 , Nov 17, 2005
                  • 0 Attachment
                    Piotr,

                    Appreciate your assistance... though I've found plenty of other bugs
                    that can keep you busy during the holidays ;-)

                    As for the ComboBox anomalies, I've noticed in my application that
                    class "ComboBox (Unicode)", which is a part of the Windows Form
                    SaveFileDialog .NET component (specifically the file extension
                    selection), exhibits the problem, whereas those of
                    class "WindowsForms10.COMBOBOX.app3" do not. Perhaps this may provide
                    a clue to identify where the trouble lies.

                    Regards,

                    Steve

                    --- In perlguitest@yahoogroups.com, "Piotr Kaluski" <pkaluski@p...>
                    wrote:
                    >
                    > OK.
                    > Guys, I will try to find some time to have a look at it. It is
                    close
                    > to christmass so... well, you know :-). But I will try...
                    >
                    > --Piotr
                    >
                    >
                    > --- In perlguitest@yahoogroups.com, "splemmon" <steve_lemmon@h...>
                    > wrote:
                    > >
                    > > I had a similar problem with both SelComboItemText and
                    > SelComboString
                    > > functions while automating my application. I found that the
                    > selected
                    > > item would be shown in the combo box, but the item was not saved
                    > > after the OK was clicked. Only the first item in the list would
                    be
                    > > saved. It seemed as though the combo box was updated with the
                    > > selection (visually), but the application wasn't aware of it.
                    > >
                    > > My workaround was to set focus on the combo box, then send the
                    > > correct number of down arrows:
                    > >
                    > > SetFocus( $file_type[0] );
                    > > SendKeys( "{DOWN}{DOWN}{DOWN}{DOWN}", 0.25 );
                    > >
                    > > Regards,
                    > >
                    > > Steve
                    > >
                    > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                    > <oohay1_2005@y...>
                    > > wrote:
                    > > >
                    > > > anyone has any idea why WMSetText and SelCombo* are not working
                    > > > (value/setting not stick) with class 32770 dialogs or how to
                    > resolve
                    > > > the issue? thanks.
                    > > >
                    > > > --- In perlguitest@yahoogroups.com, "lmarlin" <lmarlin@y...>
                    > wrote:
                    > > > >
                    > > > > This example may help - even if it's imperfect (see header
                    notes
                    > > > >
                    > =================================================================
                    > > > > # The goal of this example is to open
                    > > > > # the Printing Preferences window for a printer,
                    > > > > # sets the Landscape option and number of pages per page
                    > > preference
                    > > > > # and then Apply
                    > > > > # and OK
                    > > > >
                    > > > > # when you check the settings after it is done,
                    > > > > # you see that the Landscape setting is in effect,
                    > > > > # but the number of pages is still 1
                    > > > >
                    > > > > # Why doesn't the number of pages get set to 2 and "stick"?
                    > > > >
                    > > > > use Win32::GuiTest qw(:ALL);
                    > > > > use strict;
                    > > > >
                    > > > > my $WinCaption = "^HP LaserJet 2100 PCL6";
                    > > > > my $MessageClass = "PrintUI_PrinterQueue";
                    > > > >
                    > > > > my @whnds = FindWindowLike( 0, $WinCaption, $MessageClass );
                    > > > > #
                    > > > > # want only one window in response to the search
                    > > > > #
                    > > > > if ( !( scalar @whnds == 1 && IsWindow($whnds[0])) )
                    > > > > {
                    > > > > die "No Printer Window (or too many)";
                    > > > > }
                    > > > >
                    > > > > SetForegroundWindow ($whnds[0]);
                    > > > > sleep 1;
                    > > > >
                    > > > > SendKeys("%pf"); # Send keystrokes to access
                    > > Printing
                    > > > > Preferences window
                    > > > > sleep 1;
                    > > > >
                    > > > > my $parHnd = WaitWindowLike( "^HP LaserJet 2100 PCL6
                    > > Printing
                    > > > > Preferences", "^Layout", "^#32770", undef, undef, 2 );
                    > > > >
                    > > > > #
                    > > > > # Find the Layout tab
                    > > > > #
                    > > > > my $hnd = WaitWindowLike(
                    > > > > $parHnd, "^Layout", "^#32770", undef, undef, 2 );
                    > > > > printf( "Layout: %x\n", $hnd);
                    > > > > PushChildButton ($hnd, "^&Landscape");
                    > > > >
                    > > > > my $hnd = WaitWindowLike(
                    > > > > $parHnd, "^Layout", "^#32770", undef, undef, 2 );
                    > > > > my $hnd = WaitWindowLike( $hnd,
                    > undef, "^ComboBox",
                    > > > > undef, undef, 2 );
                    > > > > printf( "combo: %x\n", $hnd);
                    > > > >
                    > > > > # SelComboString($hnd, "2");
                    > > > > SelComboItemText($hnd, "2");
                    > > > >
                    > > > > sleep 2;
                    > > > >
                    > > > > PushButton ("^&Apply");
                    > > > >
                    > > > > sleep 2;
                    > > > >
                    > > > > PushButton ("^OK");
                    > > > >
                    > > > > Fish
                    > > > >
                    > > > >
                    > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                    > > <oohay1_2005@y...>
                    > > > > wrote:
                    > > > > >
                    > > > > > > Also, check that there is no other button with caption
                    > > beginning
                    > > > > > > with "OK"
                    > > > > > question: In the example below, if button OK was not found
                    > then
                    > > > > dialog
                    > > > > > would not closed, correct? But, dialog does closed.
                    > > > > >
                    > > > > > > And why have you chosen to use SelComboItemText instead
                    of
                    > > > > > > SelComboString?
                    > > > > > neither method works; it just happen to be the last method
                    > > tried.
                    > > > > >
                    > > > > > The actual #32770 class I was after is McAfee On-Access
                    > > Properties,
                    > > > > > but it's not common, so installing HP Color LaserJet PS
                    > driver
                    > > > > should
                    > > > > > be easier to work with.
                    > > > > >
                    > > > > >
                    > > > > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
                    > > > > <pkaluski@p...> wrote:
                    > > > > > >
                    > > > > > > There are some mistakes in your code. Maybe that's the
                    > reason.
                    > > > > > >
                    > > > > > > my @whnds = WaitWindowLike( undef, "^HP Color LaserJet
                    > > PS" ....)
                    > > > > > >
                    > > > > > > WaitWindowLike returns scalar value, not a list (but in
                    > your
                    > > > > code it
                    > > > > > > should work)
                    > > > > > >
                    > > > > > > More important thing:
                    > > > > > >
                    > > > > > > my $parHnd = WaitWindowLike( "^HP Color LaserJet PS
                    Printing
                    > > > > > > Preferences", "^Layout", "^#32770", undef,
                    > > undef,
                    > > > > 2 );
                    > > > > > >
                    > > > > > > First parameter expected by WaitWindowLike is a parent
                    > handle
                    > > > > (which
                    > > > > > > I asume you know, since you used the function correctly
                    > > before).
                    > > > > > >
                    > > > > > > Also, check that there is no other button with caption
                    > > beginning
                    > > > > > > with "OK"
                    > > > > > >
                    > > > > > > And why have you chosen to use SelComboItemText instead
                    of
                    > > > > > > SelComboString?
                    > > > > > >
                    > > > > > > --Piotr
                    > > > > > >
                    > > > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                    > > > > <oohay1_2005@y...>
                    > > > > > > wrote:
                    > > > > > > >
                    > > > > > > > i could find a sample dlg to do WMSetText, but found a
                    > > sample
                    > > > > gui
                    > > > > > > that
                    > > > > > > > also uses class 32770 for SelComboItemText: a printing
                    > > > > preference
                    > > > > > > > dialog (HP color laser jet ps; driver should be bundled
                    > > with
                    > > > > window
                    > > > > > > > xp; can add driver if not available)
                    > > > > > > >
                    > > > > > > > for example, assume a ui "HP Color LaserJet PS" is
                    > present:
                    > > > > > > >
                    > > > > > > > use Win32::GuiTest qw(:ALL);
                    > > > > > > > use strict;
                    > > > > > > >
                    > > > > > > > my @whnds = WaitWindowLike( undef, "^HP Color LaserJet
                    > PS",
                    > > > > undef,
                    > > > > > > > undef, undef, 30 );
                    > > > > > > > if( !@whnds ){
                    > > > > > > > die "Cannot find window \n";
                    > > > > > > > }
                    > > > > > > > else{
                    > > > > > > > SetForegroundWindow ($whnds[0]);
                    > > > > > > > sleep 1;
                    > > > > > > > SendKeys("%pf");
                    > > > > > > > sleep 1;
                    > > > > > > > my $parHnd = WaitWindowLike( "^HP Color LaserJet PS
                    > > Printing
                    > > > > > > > Preferences", "^Layout", "^#32770", undef, undef, 2 );
                    > > > > > > > my $hnd = WaitWindowLike(
                    > > > > > > $parHnd, "^Layout", "^#32770", undef,
                    > > > > > > > undef, 2 );
                    > > > > > > > printf( "Layout: %x\n", $hnd);
                    > > > > > > > PushChildButton ($hnd, "^&Landscape");
                    > > > > > > >
                    > > > > > > > my $hnd = WaitWindowLike(
                    > > > > > > $parHnd, "^Layout", "^#32770", undef,
                    > > > > > > > undef, 2 );
                    > > > > > > > my $hnd = WaitWindowLike( $hnd,
                    > > undef, "^ComboBox",
                    > > > > > > undef, undef, 2 );
                    > > > > > > > printf( "combo: %x\n", $hnd);
                    > > > > > > >
                    > > > > > > > #SelComboString($hnd, "2");
                    > > > > > > > SelComboItemText($hnd, "2");
                    > > > > > > > sleep 2;
                    > > > > > > > PushButton ("^OK");
                    > > > > > > >
                    > > > > > > > }
                    > > > > > > >
                    > > > > > > > now, manually open same printing pref dialog and notice
                    > > pages
                    > > > > per
                    > > > > > > > sheet is not the set to 2; similar to problem with
                    > > WMSetText,
                    > > > > value
                    > > > > > > is
                    > > > > > > > not saved when dialog is closed by
                    > > PushButton/PushChildButton.
                    > > > > > > >
                    > > > > > > >
                    > > > > > > >
                    > > > > > > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
                    > > > > <pkaluski@p...>
                    > > > > > > wrote:
                    > > > > > > > >
                    > > > > > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                    > > > > > > <oohay1_2005@y...>
                    > > > > > > > > wrote:
                    > > > > > > > > >
                    > > > > > > > > > why is it that when do WMSetText ($hnd "abc") to a
                    > > > > > > class '#32770'
                    > > > > > > > > dialog
                    > > > > > > > > > then PushChildButton ($hnd, "^OK");
                    > > > > > > > > > gui show "abc" in Edit field but after Ok button is
                    > > press,
                    > > > > > > windows
                    > > > > > > > > > send previous/default value?
                    > > > > > > > > > how to resolve this issue?
                    > > > > > > > > >
                    > > > > > > > >
                    > > > > > > > > Can you be more specific on what is going on? How
                    about
                    > > some
                    > > > > code
                    > > > > > > > > snippets?
                    > > > > > > > >
                    > > > > > > > > --Piotr
                    > > > > > > > >
                    > > > > > > >
                    > > > > > >
                    > > > > >
                    > > > >
                    > > >
                    > >
                    >
                  • Piotr Kaluski
                    I checked that. You are right. The problem exists. I don t know why to be honest. Steven s workaround is the only one which comes to my mind at the moment. In
                    Message 9 of 16 , Nov 19, 2005
                    • 0 Attachment
                      I checked that.
                      You are right. The problem exists. I don't know why to be honest.
                      Steven's workaround is the only one which comes to my mind at the
                      moment. In case of the printer driver, you can just type "2" instead
                      of appropriate number of down arrows.
                      Steven, do you have the source code to the application you are talking
                      about?

                      --Piotr


                      --- In perlguitest@yahoogroups.com, "Piotr Kaluski" <pkaluski@p...> wrote:
                      >
                      > OK.
                      > Guys, I will try to find some time to have a look at it. It is close
                      > to christmass so... well, you know :-). But I will try...
                      >
                      > --Piotr
                      >
                      >
                      > --- In perlguitest@yahoogroups.com, "splemmon" <steve_lemmon@h...>
                      > wrote:
                      > >
                      > > I had a similar problem with both SelComboItemText and
                      > SelComboString
                      > > functions while automating my application. I found that the
                      > selected
                      > > item would be shown in the combo box, but the item was not saved
                      > > after the OK was clicked. Only the first item in the list would be
                      > > saved. It seemed as though the combo box was updated with the
                      > > selection (visually), but the application wasn't aware of it.
                      > >
                      > > My workaround was to set focus on the combo box, then send the
                      > > correct number of down arrows:
                      > >
                      > > SetFocus( $file_type[0] );
                      > > SendKeys( "{DOWN}{DOWN}{DOWN}{DOWN}", 0.25 );
                      > >
                      > > Regards,
                      > >
                      > > Steve
                      > >
                      > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                      > <oohay1_2005@y...>
                      > > wrote:
                      > > >
                      > > > anyone has any idea why WMSetText and SelCombo* are not working
                      > > > (value/setting not stick) with class 32770 dialogs or how to
                      > resolve
                      > > > the issue? thanks.
                      > > >
                      > > > --- In perlguitest@yahoogroups.com, "lmarlin" <lmarlin@y...>
                      > wrote:
                      > > > >
                      > > > > This example may help - even if it's imperfect (see header notes
                      > > > >
                      > =================================================================
                      > > > > # The goal of this example is to open
                      > > > > # the Printing Preferences window for a printer,
                      > > > > # sets the Landscape option and number of pages per page
                      > > preference
                      > > > > # and then Apply
                      > > > > # and OK
                      > > > >
                      > > > > # when you check the settings after it is done,
                      > > > > # you see that the Landscape setting is in effect,
                      > > > > # but the number of pages is still 1
                      > > > >
                      > > > > # Why doesn't the number of pages get set to 2 and "stick"?
                      > > > >
                      > > > > use Win32::GuiTest qw(:ALL);
                      > > > > use strict;
                      > > > >
                      > > > > my $WinCaption = "^HP LaserJet 2100 PCL6";
                      > > > > my $MessageClass = "PrintUI_PrinterQueue";
                      > > > >
                      > > > > my @whnds = FindWindowLike( 0, $WinCaption, $MessageClass );
                      > > > > #
                      > > > > # want only one window in response to the search
                      > > > > #
                      > > > > if ( !( scalar @whnds == 1 && IsWindow($whnds[0])) )
                      > > > > {
                      > > > > die "No Printer Window (or too many)";
                      > > > > }
                      > > > >
                      > > > > SetForegroundWindow ($whnds[0]);
                      > > > > sleep 1;
                      > > > >
                      > > > > SendKeys("%pf"); # Send keystrokes to access
                      > > Printing
                      > > > > Preferences window
                      > > > > sleep 1;
                      > > > >
                      > > > > my $parHnd = WaitWindowLike( "^HP LaserJet 2100 PCL6
                      > > Printing
                      > > > > Preferences", "^Layout", "^#32770", undef, undef, 2 );
                      > > > >
                      > > > > #
                      > > > > # Find the Layout tab
                      > > > > #
                      > > > > my $hnd = WaitWindowLike(
                      > > > > $parHnd, "^Layout", "^#32770", undef, undef, 2 );
                      > > > > printf( "Layout: %x\n", $hnd);
                      > > > > PushChildButton ($hnd, "^&Landscape");
                      > > > >
                      > > > > my $hnd = WaitWindowLike(
                      > > > > $parHnd, "^Layout", "^#32770", undef, undef, 2 );
                      > > > > my $hnd = WaitWindowLike( $hnd,
                      > undef, "^ComboBox",
                      > > > > undef, undef, 2 );
                      > > > > printf( "combo: %x\n", $hnd);
                      > > > >
                      > > > > # SelComboString($hnd, "2");
                      > > > > SelComboItemText($hnd, "2");
                      > > > >
                      > > > > sleep 2;
                      > > > >
                      > > > > PushButton ("^&Apply");
                      > > > >
                      > > > > sleep 2;
                      > > > >
                      > > > > PushButton ("^OK");
                      > > > >
                      > > > > Fish
                      > > > >
                      > > > >
                      > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                      > > <oohay1_2005@y...>
                      > > > > wrote:
                      > > > > >
                      > > > > > > Also, check that there is no other button with caption
                      > > beginning
                      > > > > > > with "OK"
                      > > > > > question: In the example below, if button OK was not found
                      > then
                      > > > > dialog
                      > > > > > would not closed, correct? But, dialog does closed.
                      > > > > >
                      > > > > > > And why have you chosen to use SelComboItemText instead of
                      > > > > > > SelComboString?
                      > > > > > neither method works; it just happen to be the last method
                      > > tried.
                      > > > > >
                      > > > > > The actual #32770 class I was after is McAfee On-Access
                      > > Properties,
                      > > > > > but it's not common, so installing HP Color LaserJet PS
                      > driver
                      > > > > should
                      > > > > > be easier to work with.
                      > > > > >
                      > > > > >
                      > > > > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
                      > > > > <pkaluski@p...> wrote:
                      > > > > > >
                      > > > > > > There are some mistakes in your code. Maybe that's the
                      > reason.
                      > > > > > >
                      > > > > > > my @whnds = WaitWindowLike( undef, "^HP Color LaserJet
                      > > PS" ....)
                      > > > > > >
                      > > > > > > WaitWindowLike returns scalar value, not a list (but in
                      > your
                      > > > > code it
                      > > > > > > should work)
                      > > > > > >
                      > > > > > > More important thing:
                      > > > > > >
                      > > > > > > my $parHnd = WaitWindowLike( "^HP Color LaserJet PS Printing
                      > > > > > > Preferences", "^Layout", "^#32770", undef,
                      > > undef,
                      > > > > 2 );
                      > > > > > >
                      > > > > > > First parameter expected by WaitWindowLike is a parent
                      > handle
                      > > > > (which
                      > > > > > > I asume you know, since you used the function correctly
                      > > before).
                      > > > > > >
                      > > > > > > Also, check that there is no other button with caption
                      > > beginning
                      > > > > > > with "OK"
                      > > > > > >
                      > > > > > > And why have you chosen to use SelComboItemText instead of
                      > > > > > > SelComboString?
                      > > > > > >
                      > > > > > > --Piotr
                      > > > > > >
                      > > > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                      > > > > <oohay1_2005@y...>
                      > > > > > > wrote:
                      > > > > > > >
                      > > > > > > > i could find a sample dlg to do WMSetText, but found a
                      > > sample
                      > > > > gui
                      > > > > > > that
                      > > > > > > > also uses class 32770 for SelComboItemText: a printing
                      > > > > preference
                      > > > > > > > dialog (HP color laser jet ps; driver should be bundled
                      > > with
                      > > > > window
                      > > > > > > > xp; can add driver if not available)
                      > > > > > > >
                      > > > > > > > for example, assume a ui "HP Color LaserJet PS" is
                      > present:
                      > > > > > > >
                      > > > > > > > use Win32::GuiTest qw(:ALL);
                      > > > > > > > use strict;
                      > > > > > > >
                      > > > > > > > my @whnds = WaitWindowLike( undef, "^HP Color LaserJet
                      > PS",
                      > > > > undef,
                      > > > > > > > undef, undef, 30 );
                      > > > > > > > if( !@whnds ){
                      > > > > > > > die "Cannot find window \n";
                      > > > > > > > }
                      > > > > > > > else{
                      > > > > > > > SetForegroundWindow ($whnds[0]);
                      > > > > > > > sleep 1;
                      > > > > > > > SendKeys("%pf");
                      > > > > > > > sleep 1;
                      > > > > > > > my $parHnd = WaitWindowLike( "^HP Color LaserJet PS
                      > > Printing
                      > > > > > > > Preferences", "^Layout", "^#32770", undef, undef, 2 );
                      > > > > > > > my $hnd = WaitWindowLike(
                      > > > > > > $parHnd, "^Layout", "^#32770", undef,
                      > > > > > > > undef, 2 );
                      > > > > > > > printf( "Layout: %x\n", $hnd);
                      > > > > > > > PushChildButton ($hnd, "^&Landscape");
                      > > > > > > >
                      > > > > > > > my $hnd = WaitWindowLike(
                      > > > > > > $parHnd, "^Layout", "^#32770", undef,
                      > > > > > > > undef, 2 );
                      > > > > > > > my $hnd = WaitWindowLike( $hnd,
                      > > undef, "^ComboBox",
                      > > > > > > undef, undef, 2 );
                      > > > > > > > printf( "combo: %x\n", $hnd);
                      > > > > > > >
                      > > > > > > > #SelComboString($hnd, "2");
                      > > > > > > > SelComboItemText($hnd, "2");
                      > > > > > > > sleep 2;
                      > > > > > > > PushButton ("^OK");
                      > > > > > > >
                      > > > > > > > }
                      > > > > > > >
                      > > > > > > > now, manually open same printing pref dialog and notice
                      > > pages
                      > > > > per
                      > > > > > > > sheet is not the set to 2; similar to problem with
                      > > WMSetText,
                      > > > > value
                      > > > > > > is
                      > > > > > > > not saved when dialog is closed by
                      > > PushButton/PushChildButton.
                      > > > > > > >
                      > > > > > > >
                      > > > > > > >
                      > > > > > > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
                      > > > > <pkaluski@p...>
                      > > > > > > wrote:
                      > > > > > > > >
                      > > > > > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                      > > > > > > <oohay1_2005@y...>
                      > > > > > > > > wrote:
                      > > > > > > > > >
                      > > > > > > > > > why is it that when do WMSetText ($hnd "abc") to a
                      > > > > > > class '#32770'
                      > > > > > > > > dialog
                      > > > > > > > > > then PushChildButton ($hnd, "^OK");
                      > > > > > > > > > gui show "abc" in Edit field but after Ok button is
                      > > press,
                      > > > > > > windows
                      > > > > > > > > > send previous/default value?
                      > > > > > > > > > how to resolve this issue?
                      > > > > > > > > >
                      > > > > > > > >
                      > > > > > > > > Can you be more specific on what is going on? How about
                      > > some
                      > > > > code
                      > > > > > > > > snippets?
                      > > > > > > > >
                      > > > > > > > > --Piotr
                      > > > > > > > >
                      > > > > > > >
                      > > > > > >
                      > > > > >
                      > > > >
                      > > >
                      > >
                      >
                    • Piotr Kaluski
                      Hi, I believe I know the reason of problems. I am not 100% sure that the explanation given below is correct, but at least it is not contradictory with my
                      Message 10 of 16 , Nov 21, 2005
                      • 0 Attachment
                        Hi,
                        I believe I know the reason of problems.
                        I am not 100% sure that the explanation given below is correct, but
                        at least it is not contradictory with my observations.

                        Application can be informed about new selection in a combo box by
                        several events/notifications. One of such events is CBN_SELCHANGE.
                        However, not every application uses this event and Microsoft does not
                        recommend it. This is what they say:

                        "A drop-down combo box or drop-down list box sends the CBN_CLOSEUP
                        notification to the parent window or dialog-box procedure when the
                        drop-down list closes. If the user changed the current selection, the
                        combo box also sends the CBN_SELCHANGE notification when the drop-
                        down list closes. To execute a specific process each time the user
                        selects a list item, you can handle either the CBN_SELCHANGE or
                        CBN_CLOSEUP notification message. Typically, you would wait for the
                        CBN_CLOSEUP notification before processing a change in the current
                        selection. This can be particularly important if a significant amount
                        of processing is required. "

                        So it seams that some applications watch for CBN_CLOSEUP, which is
                        generated when a list of combo box is closed. They probably also
                        check keyboard events. That's why SendKeys solution works.

                        Let's have a look at the code (last few lines from the "printing
                        preferences" example). In the light of facts given above, the
                        following does not work:

                        SelComboString($hnd, "2");
                        PushButton( "^OK" );

                        It is because only CBN_SELCHANGE event is generated.

                        But if you do this:

                        SendMessage( $hnd, 0x014F, 1, 0 );
                        SelComboString($hnd, "2");
                        PushButton( "^OK" );

                        This magic SendMessage sends 0x014F which is CB_SHOWDROPDOWN which
                        shows a list box of a combo box. Then you select a value
                        (SelComboString) and you PushButton, which causes that a window is
                        closed and list box of a combo box is closed which generates
                        CBN_CLOSEUP.

                        This problem brings some bigger issue. To which extent we should be
                        smart and use sophisticated features of controls to set their values?
                        Using mouse clicks or SendKeys seems less clean, but it is much more
                        safe, since it generates all expected side effects.

                        I think that in case of combo box, we should implement the function,
                        which does a following:
                        It opens a list, selects an item and clicks on it.

                        --Piotr


                        --- In perlguitest@yahoogroups.com, "Piotr Kaluski" <pkaluski@p...>
                        wrote:
                        >
                        > I checked that.
                        > You are right. The problem exists. I don't know why to be honest.
                        > Steven's workaround is the only one which comes to my mind at the
                        > moment. In case of the printer driver, you can just type "2" instead
                        > of appropriate number of down arrows.
                        > Steven, do you have the source code to the application you are
                        talking
                        > about?
                        >
                        > --Piotr
                        >
                        >
                        > --- In perlguitest@yahoogroups.com, "Piotr Kaluski" <pkaluski@p...>
                        wrote:
                        > >
                        > > OK.
                        > > Guys, I will try to find some time to have a look at it. It is
                        close
                        > > to christmass so... well, you know :-). But I will try...
                        > >
                        > > --Piotr
                        > >
                        > >
                        > > --- In perlguitest@yahoogroups.com, "splemmon"
                        <steve_lemmon@h...>
                        > > wrote:
                        > > >
                        > > > I had a similar problem with both SelComboItemText and
                        > > SelComboString
                        > > > functions while automating my application. I found that the
                        > > selected
                        > > > item would be shown in the combo box, but the item was not
                        saved
                        > > > after the OK was clicked. Only the first item in the list would
                        be
                        > > > saved. It seemed as though the combo box was updated with the
                        > > > selection (visually), but the application wasn't aware of it.
                        > > >
                        > > > My workaround was to set focus on the combo box, then send the
                        > > > correct number of down arrows:
                        > > >
                        > > > SetFocus( $file_type[0] );
                        > > > SendKeys( "{DOWN}{DOWN}{DOWN}{DOWN}", 0.25 );
                        > > >
                        > > > Regards,
                        > > >
                        > > > Steve
                        > > >
                        > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                        > > <oohay1_2005@y...>
                        > > > wrote:
                        > > > >
                        > > > > anyone has any idea why WMSetText and SelCombo* are not
                        working
                        > > > > (value/setting not stick) with class 32770 dialogs or how to
                        > > resolve
                        > > > > the issue? thanks.
                        > > > >
                        > > > > --- In perlguitest@yahoogroups.com, "lmarlin" <lmarlin@y...>
                        > > wrote:
                        > > > > >
                        > > > > > This example may help - even if it's imperfect (see header
                        notes
                        > > > > >
                        > > =================================================================
                        > > > > > # The goal of this example is to open
                        > > > > > # the Printing Preferences window for a printer,
                        > > > > > # sets the Landscape option and number of pages per page
                        > > > preference
                        > > > > > # and then Apply
                        > > > > > # and OK
                        > > > > >
                        > > > > > # when you check the settings after it is done,
                        > > > > > # you see that the Landscape setting is in effect,
                        > > > > > # but the number of pages is still 1
                        > > > > >
                        > > > > > # Why doesn't the number of pages get set to 2 and "stick"?
                        > > > > >
                        > > > > > use Win32::GuiTest qw(:ALL);
                        > > > > > use strict;
                        > > > > >
                        > > > > > my $WinCaption = "^HP LaserJet 2100 PCL6";
                        > > > > > my $MessageClass = "PrintUI_PrinterQueue";
                        > > > > >
                        > > > > > my @whnds = FindWindowLike( 0, $WinCaption,
                        $MessageClass );
                        > > > > > #
                        > > > > > # want only one window in response to the search
                        > > > > > #
                        > > > > > if ( !( scalar @whnds == 1 && IsWindow($whnds[0])) )
                        > > > > > {
                        > > > > > die "No Printer Window (or too many)";
                        > > > > > }
                        > > > > >
                        > > > > > SetForegroundWindow ($whnds[0]);
                        > > > > > sleep 1;
                        > > > > >
                        > > > > > SendKeys("%pf"); # Send keystrokes to
                        access
                        > > > Printing
                        > > > > > Preferences window
                        > > > > > sleep 1;
                        > > > > >
                        > > > > > my $parHnd = WaitWindowLike( "^HP LaserJet 2100 PCL6
                        > > > Printing
                        > > > > > Preferences", "^Layout", "^#32770", undef, undef, 2 );
                        > > > > >
                        > > > > > #
                        > > > > > # Find the Layout tab
                        > > > > > #
                        > > > > > my $hnd = WaitWindowLike(
                        > > > > > $parHnd, "^Layout", "^#32770", undef, undef, 2 );
                        > > > > > printf( "Layout: %x\n", $hnd);
                        > > > > > PushChildButton ($hnd, "^&Landscape");
                        > > > > >
                        > > > > > my $hnd = WaitWindowLike(
                        > > > > > $parHnd, "^Layout", "^#32770", undef, undef, 2 );
                        > > > > > my $hnd = WaitWindowLike( $hnd,
                        > > undef, "^ComboBox",
                        > > > > > undef, undef, 2 );
                        > > > > > printf( "combo: %x\n", $hnd);
                        > > > > >
                        > > > > > # SelComboString($hnd, "2");
                        > > > > > SelComboItemText($hnd, "2");
                        > > > > >
                        > > > > > sleep 2;
                        > > > > >
                        > > > > > PushButton ("^&Apply");
                        > > > > >
                        > > > > > sleep 2;
                        > > > > >
                        > > > > > PushButton ("^OK");
                        > > > > >
                        > > > > > Fish
                        > > > > >
                        > > > > >
                        > > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                        > > > <oohay1_2005@y...>
                        > > > > > wrote:
                        > > > > > >
                        > > > > > > > Also, check that there is no other button with caption
                        > > > beginning
                        > > > > > > > with "OK"
                        > > > > > > question: In the example below, if button OK was not
                        found
                        > > then
                        > > > > > dialog
                        > > > > > > would not closed, correct? But, dialog does closed.
                        > > > > > >
                        > > > > > > > And why have you chosen to use SelComboItemText instead
                        of
                        > > > > > > > SelComboString?
                        > > > > > > neither method works; it just happen to be the last
                        method
                        > > > tried.
                        > > > > > >
                        > > > > > > The actual #32770 class I was after is McAfee On-Access
                        > > > Properties,
                        > > > > > > but it's not common, so installing HP Color LaserJet PS
                        > > driver
                        > > > > > should
                        > > > > > > be easier to work with.
                        > > > > > >
                        > > > > > >
                        > > > > > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
                        > > > > > <pkaluski@p...> wrote:
                        > > > > > > >
                        > > > > > > > There are some mistakes in your code. Maybe that's the
                        > > reason.
                        > > > > > > >
                        > > > > > > > my @whnds = WaitWindowLike( undef, "^HP Color LaserJet
                        > > > PS" ....)
                        > > > > > > >
                        > > > > > > > WaitWindowLike returns scalar value, not a list (but in
                        > > your
                        > > > > > code it
                        > > > > > > > should work)
                        > > > > > > >
                        > > > > > > > More important thing:
                        > > > > > > >
                        > > > > > > > my $parHnd = WaitWindowLike( "^HP Color LaserJet PS
                        Printing
                        > > > > > > > Preferences", "^Layout", "^#32770",
                        undef,
                        > > > undef,
                        > > > > > 2 );
                        > > > > > > >
                        > > > > > > > First parameter expected by WaitWindowLike is a parent
                        > > handle
                        > > > > > (which
                        > > > > > > > I asume you know, since you used the function correctly
                        > > > before).
                        > > > > > > >
                        > > > > > > > Also, check that there is no other button with caption
                        > > > beginning
                        > > > > > > > with "OK"
                        > > > > > > >
                        > > > > > > > And why have you chosen to use SelComboItemText instead
                        of
                        > > > > > > > SelComboString?
                        > > > > > > >
                        > > > > > > > --Piotr
                        > > > > > > >
                        > > > > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                        > > > > > <oohay1_2005@y...>
                        > > > > > > > wrote:
                        > > > > > > > >
                        > > > > > > > > i could find a sample dlg to do WMSetText, but found
                        a
                        > > > sample
                        > > > > > gui
                        > > > > > > > that
                        > > > > > > > > also uses class 32770 for SelComboItemText: a
                        printing
                        > > > > > preference
                        > > > > > > > > dialog (HP color laser jet ps; driver should be
                        bundled
                        > > > with
                        > > > > > window
                        > > > > > > > > xp; can add driver if not available)
                        > > > > > > > >
                        > > > > > > > > for example, assume a ui "HP Color LaserJet PS" is
                        > > present:
                        > > > > > > > >
                        > > > > > > > > use Win32::GuiTest qw(:ALL);
                        > > > > > > > > use strict;
                        > > > > > > > >
                        > > > > > > > > my @whnds = WaitWindowLike( undef, "^HP Color
                        LaserJet
                        > > PS",
                        > > > > > undef,
                        > > > > > > > > undef, undef, 30 );
                        > > > > > > > > if( !@whnds ){
                        > > > > > > > > die "Cannot find window \n";
                        > > > > > > > > }
                        > > > > > > > > else{
                        > > > > > > > > SetForegroundWindow ($whnds[0]);
                        > > > > > > > > sleep 1;
                        > > > > > > > > SendKeys("%pf");
                        > > > > > > > > sleep 1;
                        > > > > > > > > my $parHnd = WaitWindowLike( "^HP Color
                        LaserJet PS
                        > > > Printing
                        > > > > > > > > Preferences", "^Layout", "^#32770", undef, undef, 2 );
                        > > > > > > > > my $hnd = WaitWindowLike(
                        > > > > > > > $parHnd, "^Layout", "^#32770", undef,
                        > > > > > > > > undef, 2 );
                        > > > > > > > > printf( "Layout: %x\n", $hnd);
                        > > > > > > > > PushChildButton ($hnd, "^&Landscape");
                        > > > > > > > >
                        > > > > > > > > my $hnd = WaitWindowLike(
                        > > > > > > > $parHnd, "^Layout", "^#32770", undef,
                        > > > > > > > > undef, 2 );
                        > > > > > > > > my $hnd = WaitWindowLike( $hnd,
                        > > > undef, "^ComboBox",
                        > > > > > > > undef, undef, 2 );
                        > > > > > > > > printf( "combo: %x\n", $hnd);
                        > > > > > > > >
                        > > > > > > > > #SelComboString($hnd, "2");
                        > > > > > > > > SelComboItemText($hnd, "2");
                        > > > > > > > > sleep 2;
                        > > > > > > > > PushButton ("^OK");
                        > > > > > > > >
                        > > > > > > > > }
                        > > > > > > > >
                        > > > > > > > > now, manually open same printing pref dialog and
                        notice
                        > > > pages
                        > > > > > per
                        > > > > > > > > sheet is not the set to 2; similar to problem with
                        > > > WMSetText,
                        > > > > > value
                        > > > > > > > is
                        > > > > > > > > not saved when dialog is closed by
                        > > > PushButton/PushChildButton.
                        > > > > > > > >
                        > > > > > > > >
                        > > > > > > > >
                        > > > > > > > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
                        > > > > > <pkaluski@p...>
                        > > > > > > > wrote:
                        > > > > > > > > >
                        > > > > > > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                        > > > > > > > <oohay1_2005@y...>
                        > > > > > > > > > wrote:
                        > > > > > > > > > >
                        > > > > > > > > > > why is it that when do WMSetText ($hnd "abc") to
                        a
                        > > > > > > > class '#32770'
                        > > > > > > > > > dialog
                        > > > > > > > > > > then PushChildButton ($hnd, "^OK");
                        > > > > > > > > > > gui show "abc" in Edit field but after Ok button
                        is
                        > > > press,
                        > > > > > > > windows
                        > > > > > > > > > > send previous/default value?
                        > > > > > > > > > > how to resolve this issue?
                        > > > > > > > > > >
                        > > > > > > > > >
                        > > > > > > > > > Can you be more specific on what is going on? How
                        about
                        > > > some
                        > > > > > code
                        > > > > > > > > > snippets?
                        > > > > > > > > >
                        > > > > > > > > > --Piotr
                        > > > > > > > > >
                        > > > > > > > >
                        > > > > > > >
                        > > > > > >
                        > > > > >
                        > > > >
                        > > >
                        > >
                        >
                      • splemmon
                        Hi Piotr, I can confirm your workaround for both SelComboString and SelComboItemText functions. However I wonder if it is the lack of CBN_SELCHANGE message
                        Message 11 of 16 , Nov 22, 2005
                        • 0 Attachment
                          Hi Piotr,

                          I can confirm your workaround for both SelComboString and
                          SelComboItemText functions. However I wonder if it is the lack of
                          CBN_SELCHANGE message that is the culprit, not CBN_CLOSEUP.

                          From the MS documentation it states that CBN_SELCHANGE is *not* sent
                          when the selection is changed via the CB_SETCURSEL message:

                          "When the user changes the current selection in a combo box, the
                          parent window or dialog-box procedure receives a WM_COMMAND message
                          with the notification message CBN_SELCHANGE in the high-order word
                          of the wParam parameter. This notification message is not sent when
                          the current selection is set using the CB_SETCURSEL message."

                          Looking at the SelComboItemText function code below, I see that it
                          uses the CB_SETCURSEL message to select the item which would imply
                          that CBN_SELCHANGE is not sent to the application.

                          RETVAL = (SendMessage(hWnd, CB_SETCURSEL, i, 0) != CB_ERR);

                          Agreed that although mouse clicks and SendKeys generate all side
                          effects that a user would encounter, my preference is to avoid using
                          them whenever possible to avoid forcing the application under test to
                          the foreground.

                          Regards,

                          Steve

                          --- In perlguitest@yahoogroups.com, "Piotr Kaluski" <pkaluski@p...>
                          wrote:
                          >
                          > Hi,
                          > I believe I know the reason of problems.
                          > I am not 100% sure that the explanation given below is correct, but
                          > at least it is not contradictory with my observations.
                          >
                          > Application can be informed about new selection in a combo box by
                          > several events/notifications. One of such events is CBN_SELCHANGE.
                          > However, not every application uses this event and Microsoft does
                          not
                          > recommend it. This is what they say:
                          >
                          > "A drop-down combo box or drop-down list box sends the CBN_CLOSEUP
                          > notification to the parent window or dialog-box procedure when the
                          > drop-down list closes. If the user changed the current selection,
                          the
                          > combo box also sends the CBN_SELCHANGE notification when the drop-
                          > down list closes. To execute a specific process each time the user
                          > selects a list item, you can handle either the CBN_SELCHANGE or
                          > CBN_CLOSEUP notification message. Typically, you would wait for the
                          > CBN_CLOSEUP notification before processing a change in the current
                          > selection. This can be particularly important if a significant
                          amount
                          > of processing is required. "
                          >
                          > So it seams that some applications watch for CBN_CLOSEUP, which is
                          > generated when a list of combo box is closed. They probably also
                          > check keyboard events. That's why SendKeys solution works.
                          >
                          > Let's have a look at the code (last few lines from the "printing
                          > preferences" example). In the light of facts given above, the
                          > following does not work:
                          >
                          > SelComboString($hnd, "2");
                          > PushButton( "^OK" );
                          >
                          > It is because only CBN_SELCHANGE event is generated.
                          >
                          > But if you do this:
                          >
                          > SendMessage( $hnd, 0x014F, 1, 0 );
                          > SelComboString($hnd, "2");
                          > PushButton( "^OK" );
                          >
                          > This magic SendMessage sends 0x014F which is CB_SHOWDROPDOWN which
                          > shows a list box of a combo box. Then you select a value
                          > (SelComboString) and you PushButton, which causes that a window is
                          > closed and list box of a combo box is closed which generates
                          > CBN_CLOSEUP.
                          >
                          > This problem brings some bigger issue. To which extent we should be
                          > smart and use sophisticated features of controls to set their
                          values?
                          > Using mouse clicks or SendKeys seems less clean, but it is much
                          more
                          > safe, since it generates all expected side effects.
                          >
                          > I think that in case of combo box, we should implement the
                          function,
                          > which does a following:
                          > It opens a list, selects an item and clicks on it.
                          >
                          > --Piotr
                          >
                          >
                          > --- In perlguitest@yahoogroups.com, "Piotr Kaluski" <pkaluski@p...>
                          > wrote:
                          > >
                          > > I checked that.
                          > > You are right. The problem exists. I don't know why to be
                          honest.
                          > > Steven's workaround is the only one which comes to my mind at the
                          > > moment. In case of the printer driver, you can just type "2"
                          instead
                          > > of appropriate number of down arrows.
                          > > Steven, do you have the source code to the application you are
                          > talking
                          > > about?
                          > >
                          > > --Piotr
                          > >
                          > >
                          > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
                          <pkaluski@p...>
                          > wrote:
                          > > >
                          > > > OK.
                          > > > Guys, I will try to find some time to have a look at it. It is
                          > close
                          > > > to christmass so... well, you know :-). But I will try...
                          > > >
                          > > > --Piotr
                          > > >
                          > > >
                          > > > --- In perlguitest@yahoogroups.com, "splemmon"
                          > <steve_lemmon@h...>
                          > > > wrote:
                          > > > >
                          > > > > I had a similar problem with both SelComboItemText and
                          > > > SelComboString
                          > > > > functions while automating my application. I found that the
                          > > > selected
                          > > > > item would be shown in the combo box, but the item was not
                          > saved
                          > > > > after the OK was clicked. Only the first item in the list
                          would
                          > be
                          > > > > saved. It seemed as though the combo box was updated with the
                          > > > > selection (visually), but the application wasn't aware of it.
                          > > > >
                          > > > > My workaround was to set focus on the combo box, then send
                          the
                          > > > > correct number of down arrows:
                          > > > >
                          > > > > SetFocus( $file_type[0] );
                          > > > > SendKeys( "{DOWN}{DOWN}{DOWN}{DOWN}", 0.25 );
                          > > > >
                          > > > > Regards,
                          > > > >
                          > > > > Steve
                          > > > >
                          > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                          > > > <oohay1_2005@y...>
                          > > > > wrote:
                          > > > > >
                          > > > > > anyone has any idea why WMSetText and SelCombo* are not
                          > working
                          > > > > > (value/setting not stick) with class 32770 dialogs or how
                          to
                          > > > resolve
                          > > > > > the issue? thanks.
                          > > > > >
                          > > > > > --- In perlguitest@yahoogroups.com, "lmarlin"
                          <lmarlin@y...>
                          > > > wrote:
                          > > > > > >
                          > > > > > > This example may help - even if it's imperfect (see
                          header
                          > notes
                          > > > > > >
                          > > >
                          =================================================================
                          > > > > > > # The goal of this example is to open
                          > > > > > > # the Printing Preferences window for a printer,
                          > > > > > > # sets the Landscape option and number of pages per page
                          > > > > preference
                          > > > > > > # and then Apply
                          > > > > > > # and OK
                          > > > > > >
                          > > > > > > # when you check the settings after it is done,
                          > > > > > > # you see that the Landscape setting is in effect,
                          > > > > > > # but the number of pages is still 1
                          > > > > > >
                          > > > > > > # Why doesn't the number of pages get set to 2
                          and "stick"?
                          > > > > > >
                          > > > > > > use Win32::GuiTest qw(:ALL);
                          > > > > > > use strict;
                          > > > > > >
                          > > > > > > my $WinCaption = "^HP LaserJet 2100 PCL6";
                          > > > > > > my $MessageClass = "PrintUI_PrinterQueue";
                          > > > > > >
                          > > > > > > my @whnds = FindWindowLike( 0, $WinCaption,
                          > $MessageClass );
                          > > > > > > #
                          > > > > > > # want only one window in response to the search
                          > > > > > > #
                          > > > > > > if ( !( scalar @whnds == 1 && IsWindow($whnds[0])) )
                          > > > > > > {
                          > > > > > > die "No Printer Window (or too many)";
                          > > > > > > }
                          > > > > > >
                          > > > > > > SetForegroundWindow ($whnds[0]);
                          > > > > > > sleep 1;
                          > > > > > >
                          > > > > > > SendKeys("%pf"); # Send keystrokes to
                          > access
                          > > > > Printing
                          > > > > > > Preferences window
                          > > > > > > sleep 1;
                          > > > > > >
                          > > > > > > my $parHnd = WaitWindowLike( "^HP LaserJet 2100
                          PCL6
                          > > > > Printing
                          > > > > > > Preferences", "^Layout", "^#32770", undef, undef, 2 );
                          > > > > > >
                          > > > > > > #
                          > > > > > > # Find the Layout tab
                          > > > > > > #
                          > > > > > > my $hnd = WaitWindowLike(
                          > > > > > > $parHnd, "^Layout", "^#32770", undef, undef, 2 );
                          > > > > > > printf( "Layout: %x\n", $hnd);
                          > > > > > > PushChildButton ($hnd, "^&Landscape");
                          > > > > > >
                          > > > > > > my $hnd = WaitWindowLike(
                          > > > > > > $parHnd, "^Layout", "^#32770", undef, undef, 2 );
                          > > > > > > my $hnd = WaitWindowLike( $hnd,
                          > > > undef, "^ComboBox",
                          > > > > > > undef, undef, 2 );
                          > > > > > > printf( "combo: %x\n", $hnd);
                          > > > > > >
                          > > > > > > # SelComboString($hnd, "2");
                          > > > > > > SelComboItemText($hnd, "2");
                          > > > > > >
                          > > > > > > sleep 2;
                          > > > > > >
                          > > > > > > PushButton ("^&Apply");
                          > > > > > >
                          > > > > > > sleep 2;
                          > > > > > >
                          > > > > > > PushButton ("^OK");
                          > > > > > >
                          > > > > > > Fish
                          > > > > > >
                          > > > > > >
                          > > > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                          > > > > <oohay1_2005@y...>
                          > > > > > > wrote:
                          > > > > > > >
                          > > > > > > > > Also, check that there is no other button with
                          caption
                          > > > > beginning
                          > > > > > > > > with "OK"
                          > > > > > > > question: In the example below, if button OK was not
                          > found
                          > > > then
                          > > > > > > dialog
                          > > > > > > > would not closed, correct? But, dialog does closed.
                          > > > > > > >
                          > > > > > > > > And why have you chosen to use SelComboItemText
                          instead
                          > of
                          > > > > > > > > SelComboString?
                          > > > > > > > neither method works; it just happen to be the last
                          > method
                          > > > > tried.
                          > > > > > > >
                          > > > > > > > The actual #32770 class I was after is McAfee On-Access
                          > > > > Properties,
                          > > > > > > > but it's not common, so installing HP Color LaserJet PS
                          > > > driver
                          > > > > > > should
                          > > > > > > > be easier to work with.
                          > > > > > > >
                          > > > > > > >
                          > > > > > > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
                          > > > > > > <pkaluski@p...> wrote:
                          > > > > > > > >
                          > > > > > > > > There are some mistakes in your code. Maybe that's
                          the
                          > > > reason.
                          > > > > > > > >
                          > > > > > > > > my @whnds = WaitWindowLike( undef, "^HP Color
                          LaserJet
                          > > > > PS" ....)
                          > > > > > > > >
                          > > > > > > > > WaitWindowLike returns scalar value, not a list (but
                          in
                          > > > your
                          > > > > > > code it
                          > > > > > > > > should work)
                          > > > > > > > >
                          > > > > > > > > More important thing:
                          > > > > > > > >
                          > > > > > > > > my $parHnd = WaitWindowLike( "^HP Color LaserJet PS
                          > Printing
                          > > > > > > > > Preferences", "^Layout", "^#32770",
                          > undef,
                          > > > > undef,
                          > > > > > > 2 );
                          > > > > > > > >
                          > > > > > > > > First parameter expected by WaitWindowLike is a
                          parent
                          > > > handle
                          > > > > > > (which
                          > > > > > > > > I asume you know, since you used the function
                          correctly
                          > > > > before).
                          > > > > > > > >
                          > > > > > > > > Also, check that there is no other button with
                          caption
                          > > > > beginning
                          > > > > > > > > with "OK"
                          > > > > > > > >
                          > > > > > > > > And why have you chosen to use SelComboItemText
                          instead
                          > of
                          > > > > > > > > SelComboString?
                          > > > > > > > >
                          > > > > > > > > --Piotr
                          > > > > > > > >
                          > > > > > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                          > > > > > > <oohay1_2005@y...>
                          > > > > > > > > wrote:
                          > > > > > > > > >
                          > > > > > > > > > i could find a sample dlg to do WMSetText, but
                          found
                          > a
                          > > > > sample
                          > > > > > > gui
                          > > > > > > > > that
                          > > > > > > > > > also uses class 32770 for SelComboItemText: a
                          > printing
                          > > > > > > preference
                          > > > > > > > > > dialog (HP color laser jet ps; driver should be
                          > bundled
                          > > > > with
                          > > > > > > window
                          > > > > > > > > > xp; can add driver if not available)
                          > > > > > > > > >
                          > > > > > > > > > for example, assume a ui "HP Color LaserJet PS" is
                          > > > present:
                          > > > > > > > > >
                          > > > > > > > > > use Win32::GuiTest qw(:ALL);
                          > > > > > > > > > use strict;
                          > > > > > > > > >
                          > > > > > > > > > my @whnds = WaitWindowLike( undef, "^HP Color
                          > LaserJet
                          > > > PS",
                          > > > > > > undef,
                          > > > > > > > > > undef, undef, 30 );
                          > > > > > > > > > if( !@whnds ){
                          > > > > > > > > > die "Cannot find window \n";
                          > > > > > > > > > }
                          > > > > > > > > > else{
                          > > > > > > > > > SetForegroundWindow ($whnds[0]);
                          > > > > > > > > > sleep 1;
                          > > > > > > > > > SendKeys("%pf");
                          > > > > > > > > > sleep 1;
                          > > > > > > > > > my $parHnd = WaitWindowLike( "^HP Color
                          > LaserJet PS
                          > > > > Printing
                          > > > > > > > > > Preferences", "^Layout", "^#32770", undef, undef,
                          2 );
                          > > > > > > > > > my $hnd = WaitWindowLike(
                          > > > > > > > > $parHnd, "^Layout", "^#32770", undef,
                          > > > > > > > > > undef, 2 );
                          > > > > > > > > > printf( "Layout: %x\n", $hnd);
                          > > > > > > > > > PushChildButton ($hnd, "^&Landscape");
                          > > > > > > > > >
                          > > > > > > > > > my $hnd = WaitWindowLike(
                          > > > > > > > > $parHnd, "^Layout", "^#32770", undef,
                          > > > > > > > > > undef, 2 );
                          > > > > > > > > > my $hnd = WaitWindowLike( $hnd,
                          > > > > undef, "^ComboBox",
                          > > > > > > > > undef, undef, 2 );
                          > > > > > > > > > printf( "combo: %x\n", $hnd);
                          > > > > > > > > >
                          > > > > > > > > > #SelComboString($hnd, "2");
                          > > > > > > > > > SelComboItemText($hnd, "2");
                          > > > > > > > > > sleep 2;
                          > > > > > > > > > PushButton ("^OK");
                          > > > > > > > > >
                          > > > > > > > > > }
                          > > > > > > > > >
                          > > > > > > > > > now, manually open same printing pref dialog and
                          > notice
                          > > > > pages
                          > > > > > > per
                          > > > > > > > > > sheet is not the set to 2; similar to problem with
                          > > > > WMSetText,
                          > > > > > > value
                          > > > > > > > > is
                          > > > > > > > > > not saved when dialog is closed by
                          > > > > PushButton/PushChildButton.
                          > > > > > > > > >
                          > > > > > > > > >
                          > > > > > > > > >
                          > > > > > > > > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
                          > > > > > > <pkaluski@p...>
                          > > > > > > > > wrote:
                          > > > > > > > > > >
                          > > > > > > > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                          > > > > > > > > <oohay1_2005@y...>
                          > > > > > > > > > > wrote:
                          > > > > > > > > > > >
                          > > > > > > > > > > > why is it that when do WMSetText ($hnd "abc")
                          to
                          > a
                          > > > > > > > > class '#32770'
                          > > > > > > > > > > dialog
                          > > > > > > > > > > > then PushChildButton ($hnd, "^OK");
                          > > > > > > > > > > > gui show "abc" in Edit field but after Ok
                          button
                          > is
                          > > > > press,
                          > > > > > > > > windows
                          > > > > > > > > > > > send previous/default value?
                          > > > > > > > > > > > how to resolve this issue?
                          > > > > > > > > > > >
                          > > > > > > > > > >
                          > > > > > > > > > > Can you be more specific on what is going on? How
                          > about
                          > > > > some
                          > > > > > > code
                          > > > > > > > > > > snippets?
                          > > > > > > > > > >
                          > > > > > > > > > > --Piotr
                          > > > > > > > > > >
                          > > > > > > > > >
                          > > > > > > > >
                          > > > > > > >
                          > > > > > >
                          > > > > >
                          > > > >
                          > > >
                          > >
                          >
                        • oohay1_2005
                          I ve also confirmed that: SendMessage( $hnd, 0x014F, 1, 0 ); will work for some comboboxes but not others. It seems like all comboboxes that also alters some
                          Message 12 of 16 , Nov 22, 2005
                          • 0 Attachment
                            I've also confirmed that:
                            SendMessage( $hnd, 0x014F, 1, 0 );
                            will work for some comboboxes but not others. It seems like all
                            comboboxes that also alters some bitmap on gui does not work.
                            Is there any other tricks that can resolve this?

                            Sendkey will work in most cases, but when a combobox have the same
                            word as the first string, eg:
                            "Type 1"
                            "Type 2"
                            "Type 3"
                            ... it would require sending additional keys; which might become
                            inaccurate if focus is accidentally not on correct handle...

                            Is there a link where I can search for additional info on
                            SendMessage's flags/paramenters, similar to the flag 0x014F?


                            --- In perlguitest@yahoogroups.com, "Piotr Kaluski" <pkaluski@p...> wrote:
                            >
                            > Hi,
                            > I believe I know the reason of problems.
                            > I am not 100% sure that the explanation given below is correct, but
                            > at least it is not contradictory with my observations.
                            >
                            > Application can be informed about new selection in a combo box by
                            > several events/notifications. One of such events is CBN_SELCHANGE.
                            > However, not every application uses this event and Microsoft does not
                            > recommend it. This is what they say:
                            >
                            > "A drop-down combo box or drop-down list box sends the CBN_CLOSEUP
                            > notification to the parent window or dialog-box procedure when the
                            > drop-down list closes. If the user changed the current selection, the
                            > combo box also sends the CBN_SELCHANGE notification when the drop-
                            > down list closes. To execute a specific process each time the user
                            > selects a list item, you can handle either the CBN_SELCHANGE or
                            > CBN_CLOSEUP notification message. Typically, you would wait for the
                            > CBN_CLOSEUP notification before processing a change in the current
                            > selection. This can be particularly important if a significant amount
                            > of processing is required. "
                            >
                            > So it seams that some applications watch for CBN_CLOSEUP, which is
                            > generated when a list of combo box is closed. They probably also
                            > check keyboard events. That's why SendKeys solution works.
                            >
                            > Let's have a look at the code (last few lines from the "printing
                            > preferences" example). In the light of facts given above, the
                            > following does not work:
                            >
                            > SelComboString($hnd, "2");
                            > PushButton( "^OK" );
                            >
                            > It is because only CBN_SELCHANGE event is generated.
                            >
                            > But if you do this:
                            >
                            > SendMessage( $hnd, 0x014F, 1, 0 );
                            > SelComboString($hnd, "2");
                            > PushButton( "^OK" );
                            >
                            > This magic SendMessage sends 0x014F which is CB_SHOWDROPDOWN which
                            > shows a list box of a combo box. Then you select a value
                            > (SelComboString) and you PushButton, which causes that a window is
                            > closed and list box of a combo box is closed which generates
                            > CBN_CLOSEUP.
                            >
                            > This problem brings some bigger issue. To which extent we should be
                            > smart and use sophisticated features of controls to set their values?
                            > Using mouse clicks or SendKeys seems less clean, but it is much more
                            > safe, since it generates all expected side effects.
                            >
                            > I think that in case of combo box, we should implement the function,
                            > which does a following:
                            > It opens a list, selects an item and clicks on it.
                            >
                            > --Piotr
                            >
                            >
                          • Piotr Kaluski
                            SelComboItemText uses CB_SETCURSEL, but SelComboString uses CB_SELECTSTRING which does trigger CBN_SELCHANGE. As for forcing application to the foreground. I
                            Message 13 of 16 , Nov 23, 2005
                            • 0 Attachment
                              SelComboItemText uses CB_SETCURSEL, but SelComboString uses
                              CB_SELECTSTRING which does trigger CBN_SELCHANGE.
                              As for forcing application to the foreground. I agree that it looks
                              more elegant if you can just order GUI tests and have them done in
                              the background. However, I have heard that even commercial tools'
                              vendors recommend not to do anything when gui test is running.
                              Secondly, moving to foreground is an event with side effects and you
                              never know how application under test handles that. Interaction with
                              human user always involves moving to foreground, so I think it is
                              much more safer to push stuff to the foreground and just leave the PC
                              alone.
                              But this is only my personal opinion....
                              --Piotr


                              --- In perlguitest@yahoogroups.com, "splemmon" <steve_lemmon@h...>
                              wrote:
                              >
                              > Hi Piotr,
                              >
                              > I can confirm your workaround for both SelComboString and
                              > SelComboItemText functions. However I wonder if it is the lack of
                              > CBN_SELCHANGE message that is the culprit, not CBN_CLOSEUP.
                              >
                              > From the MS documentation it states that CBN_SELCHANGE is *not*
                              sent
                              > when the selection is changed via the CB_SETCURSEL message:
                              >
                              > "When the user changes the current selection in a combo box, the
                              > parent window or dialog-box procedure receives a WM_COMMAND message
                              > with the notification message CBN_SELCHANGE in the high-order word
                              > of the wParam parameter. This notification message is not sent when
                              > the current selection is set using the CB_SETCURSEL message."
                              >
                              > Looking at the SelComboItemText function code below, I see that it
                              > uses the CB_SETCURSEL message to select the item which would imply
                              > that CBN_SELCHANGE is not sent to the application.
                              >
                              > RETVAL = (SendMessage(hWnd, CB_SETCURSEL, i, 0) != CB_ERR);
                              >
                              > Agreed that although mouse clicks and SendKeys generate all side
                              > effects that a user would encounter, my preference is to avoid
                              using
                              > them whenever possible to avoid forcing the application under test
                              to
                              > the foreground.
                              >
                              > Regards,
                              >
                              > Steve
                              >
                              > --- In perlguitest@yahoogroups.com, "Piotr Kaluski" <pkaluski@p...>
                              > wrote:
                              > >
                              > > Hi,
                              > > I believe I know the reason of problems.
                              > > I am not 100% sure that the explanation given below is correct,
                              but
                              > > at least it is not contradictory with my observations.
                              > >
                              > > Application can be informed about new selection in a combo box by
                              > > several events/notifications. One of such events is
                              CBN_SELCHANGE.
                              > > However, not every application uses this event and Microsoft does
                              > not
                              > > recommend it. This is what they say:
                              > >
                              > > "A drop-down combo box or drop-down list box sends the
                              CBN_CLOSEUP
                              > > notification to the parent window or dialog-box procedure when
                              the
                              > > drop-down list closes. If the user changed the current selection,
                              > the
                              > > combo box also sends the CBN_SELCHANGE notification when the drop-
                              > > down list closes. To execute a specific process each time the
                              user
                              > > selects a list item, you can handle either the CBN_SELCHANGE or
                              > > CBN_CLOSEUP notification message. Typically, you would wait for
                              the
                              > > CBN_CLOSEUP notification before processing a change in the
                              current
                              > > selection. This can be particularly important if a significant
                              > amount
                              > > of processing is required. "
                              > >
                              > > So it seams that some applications watch for CBN_CLOSEUP, which
                              is
                              > > generated when a list of combo box is closed. They probably also
                              > > check keyboard events. That's why SendKeys solution works.
                              > >
                              > > Let's have a look at the code (last few lines from the "printing
                              > > preferences" example). In the light of facts given above, the
                              > > following does not work:
                              > >
                              > > SelComboString($hnd, "2");
                              > > PushButton( "^OK" );
                              > >
                              > > It is because only CBN_SELCHANGE event is generated.
                              > >
                              > > But if you do this:
                              > >
                              > > SendMessage( $hnd, 0x014F, 1, 0 );
                              > > SelComboString($hnd, "2");
                              > > PushButton( "^OK" );
                              > >
                              > > This magic SendMessage sends 0x014F which is CB_SHOWDROPDOWN
                              which
                              > > shows a list box of a combo box. Then you select a value
                              > > (SelComboString) and you PushButton, which causes that a window
                              is
                              > > closed and list box of a combo box is closed which generates
                              > > CBN_CLOSEUP.
                              > >
                              > > This problem brings some bigger issue. To which extent we should
                              be
                              > > smart and use sophisticated features of controls to set their
                              > values?
                              > > Using mouse clicks or SendKeys seems less clean, but it is much
                              > more
                              > > safe, since it generates all expected side effects.
                              > >
                              > > I think that in case of combo box, we should implement the
                              > function,
                              > > which does a following:
                              > > It opens a list, selects an item and clicks on it.
                              > >
                              > > --Piotr
                              > >
                              > >
                              > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
                              <pkaluski@p...>
                              > > wrote:
                              > > >
                              > > > I checked that.
                              > > > You are right. The problem exists. I don't know why to be
                              > honest.
                              > > > Steven's workaround is the only one which comes to my mind at
                              the
                              > > > moment. In case of the printer driver, you can just type "2"
                              > instead
                              > > > of appropriate number of down arrows.
                              > > > Steven, do you have the source code to the application you are
                              > > talking
                              > > > about?
                              > > >
                              > > > --Piotr
                              > > >
                              > > >
                              > > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
                              > <pkaluski@p...>
                              > > wrote:
                              > > > >
                              > > > > OK.
                              > > > > Guys, I will try to find some time to have a look at it. It
                              is
                              > > close
                              > > > > to christmass so... well, you know :-). But I will try...
                              > > > >
                              > > > > --Piotr
                              > > > >
                              > > > >
                              > > > > --- In perlguitest@yahoogroups.com, "splemmon"
                              > > <steve_lemmon@h...>
                              > > > > wrote:
                              > > > > >
                              > > > > > I had a similar problem with both SelComboItemText and
                              > > > > SelComboString
                              > > > > > functions while automating my application. I found that the
                              > > > > selected
                              > > > > > item would be shown in the combo box, but the item was not
                              > > saved
                              > > > > > after the OK was clicked. Only the first item in the list
                              > would
                              > > be
                              > > > > > saved. It seemed as though the combo box was updated with
                              the
                              > > > > > selection (visually), but the application wasn't aware of
                              it.
                              > > > > >
                              > > > > > My workaround was to set focus on the combo box, then send
                              > the
                              > > > > > correct number of down arrows:
                              > > > > >
                              > > > > > SetFocus( $file_type[0] );
                              > > > > > SendKeys( "{DOWN}{DOWN}{DOWN}{DOWN}", 0.25 );
                              > > > > >
                              > > > > > Regards,
                              > > > > >
                              > > > > > Steve
                              > > > > >
                              > > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                              > > > > <oohay1_2005@y...>
                              > > > > > wrote:
                              > > > > > >
                              > > > > > > anyone has any idea why WMSetText and SelCombo* are not
                              > > working
                              > > > > > > (value/setting not stick) with class 32770 dialogs or how
                              > to
                              > > > > resolve
                              > > > > > > the issue? thanks.
                              > > > > > >
                              > > > > > > --- In perlguitest@yahoogroups.com, "lmarlin"
                              > <lmarlin@y...>
                              > > > > wrote:
                              > > > > > > >
                              > > > > > > > This example may help - even if it's imperfect (see
                              > header
                              > > notes
                              > > > > > > >
                              > > > >
                              > =================================================================
                              > > > > > > > # The goal of this example is to open
                              > > > > > > > # the Printing Preferences window for a printer,
                              > > > > > > > # sets the Landscape option and number of pages per
                              page
                              > > > > > preference
                              > > > > > > > # and then Apply
                              > > > > > > > # and OK
                              > > > > > > >
                              > > > > > > > # when you check the settings after it is done,
                              > > > > > > > # you see that the Landscape setting is in effect,
                              > > > > > > > # but the number of pages is still 1
                              > > > > > > >
                              > > > > > > > # Why doesn't the number of pages get set to 2
                              > and "stick"?
                              > > > > > > >
                              > > > > > > > use Win32::GuiTest qw(:ALL);
                              > > > > > > > use strict;
                              > > > > > > >
                              > > > > > > > my $WinCaption = "^HP LaserJet 2100 PCL6";
                              > > > > > > > my $MessageClass = "PrintUI_PrinterQueue";
                              > > > > > > >
                              > > > > > > > my @whnds = FindWindowLike( 0, $WinCaption,
                              > > $MessageClass );
                              > > > > > > > #
                              > > > > > > > # want only one window in response to the search
                              > > > > > > > #
                              > > > > > > > if ( !( scalar @whnds == 1 && IsWindow($whnds[0])) )
                              > > > > > > > {
                              > > > > > > > die "No Printer Window (or too many)";
                              > > > > > > > }
                              > > > > > > >
                              > > > > > > > SetForegroundWindow ($whnds[0]);
                              > > > > > > > sleep 1;
                              > > > > > > >
                              > > > > > > > SendKeys("%pf"); # Send keystrokes to
                              > > access
                              > > > > > Printing
                              > > > > > > > Preferences window
                              > > > > > > > sleep 1;
                              > > > > > > >
                              > > > > > > > my $parHnd = WaitWindowLike( "^HP LaserJet 2100
                              > PCL6
                              > > > > > Printing
                              > > > > > > > Preferences", "^Layout", "^#32770", undef, undef, 2 );
                              > > > > > > >
                              > > > > > > > #
                              > > > > > > > # Find the Layout tab
                              > > > > > > > #
                              > > > > > > > my $hnd = WaitWindowLike(
                              > > > > > > > $parHnd, "^Layout", "^#32770", undef, undef, 2 );
                              > > > > > > > printf( "Layout: %x\n", $hnd);
                              > > > > > > > PushChildButton ($hnd, "^&Landscape");
                              > > > > > > >
                              > > > > > > > my $hnd = WaitWindowLike(
                              > > > > > > > $parHnd, "^Layout", "^#32770", undef, undef, 2 );
                              > > > > > > > my $hnd = WaitWindowLike( $hnd,
                              > > > > undef, "^ComboBox",
                              > > > > > > > undef, undef, 2 );
                              > > > > > > > printf( "combo: %x\n", $hnd);
                              > > > > > > >
                              > > > > > > > # SelComboString($hnd, "2");
                              > > > > > > > SelComboItemText($hnd, "2");
                              > > > > > > >
                              > > > > > > > sleep 2;
                              > > > > > > >
                              > > > > > > > PushButton ("^&Apply");
                              > > > > > > >
                              > > > > > > > sleep 2;
                              > > > > > > >
                              > > > > > > > PushButton ("^OK");
                              > > > > > > >
                              > > > > > > > Fish
                              > > > > > > >
                              > > > > > > >
                              > > > > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                              > > > > > <oohay1_2005@y...>
                              > > > > > > > wrote:
                              > > > > > > > >
                              > > > > > > > > > Also, check that there is no other button with
                              > caption
                              > > > > > beginning
                              > > > > > > > > > with "OK"
                              > > > > > > > > question: In the example below, if button OK was not
                              > > found
                              > > > > then
                              > > > > > > > dialog
                              > > > > > > > > would not closed, correct? But, dialog does closed.
                              > > > > > > > >
                              > > > > > > > > > And why have you chosen to use SelComboItemText
                              > instead
                              > > of
                              > > > > > > > > > SelComboString?
                              > > > > > > > > neither method works; it just happen to be the last
                              > > method
                              > > > > > tried.
                              > > > > > > > >
                              > > > > > > > > The actual #32770 class I was after is McAfee On-
                              Access
                              > > > > > Properties,
                              > > > > > > > > but it's not common, so installing HP Color LaserJet
                              PS
                              > > > > driver
                              > > > > > > > should
                              > > > > > > > > be easier to work with.
                              > > > > > > > >
                              > > > > > > > >
                              > > > > > > > > --- In perlguitest@yahoogroups.com, "Piotr Kaluski"
                              > > > > > > > <pkaluski@p...> wrote:
                              > > > > > > > > >
                              > > > > > > > > > There are some mistakes in your code. Maybe that's
                              > the
                              > > > > reason.
                              > > > > > > > > >
                              > > > > > > > > > my @whnds = WaitWindowLike( undef, "^HP Color
                              > LaserJet
                              > > > > > PS" ....)
                              > > > > > > > > >
                              > > > > > > > > > WaitWindowLike returns scalar value, not a list
                              (but
                              > in
                              > > > > your
                              > > > > > > > code it
                              > > > > > > > > > should work)
                              > > > > > > > > >
                              > > > > > > > > > More important thing:
                              > > > > > > > > >
                              > > > > > > > > > my $parHnd = WaitWindowLike( "^HP Color LaserJet PS
                              > > Printing
                              > > > > > > > > > Preferences", "^Layout", "^#32770",
                              > > undef,
                              > > > > > undef,
                              > > > > > > > 2 );
                              > > > > > > > > >
                              > > > > > > > > > First parameter expected by WaitWindowLike is a
                              > parent
                              > > > > handle
                              > > > > > > > (which
                              > > > > > > > > > I asume you know, since you used the function
                              > correctly
                              > > > > > before).
                              > > > > > > > > >
                              > > > > > > > > > Also, check that there is no other button with
                              > caption
                              > > > > > beginning
                              > > > > > > > > > with "OK"
                              > > > > > > > > >
                              > > > > > > > > > And why have you chosen to use SelComboItemText
                              > instead
                              > > of
                              > > > > > > > > > SelComboString?
                              > > > > > > > > >
                              > > > > > > > > > --Piotr
                              > > > > > > > > >
                              > > > > > > > > > --- In perlguitest@yahoogroups.com, "oohay1_2005"
                              > > > > > > > <oohay1_2005@y...>
                              > > > > > > > > > wrote:
                              > > > > > > > > > >
                              > > > > > > > > > > i could find a sample dlg to do WMSetText, but
                              > found
                              > > a
                              > > > > > sample
                              > > > > > > > gui
                              > > > > > > > > > that
                              > > > > > > > > > > also uses class 32770 for SelComboItemText: a
                              > > printing
                              > > > > > > > preference
                              > > > > > > > > > > dialog (HP color laser jet ps; driver should be
                              > > bundled
                              > > > > > with
                              > > > > > > > window
                              > > > > > > > > > > xp; can add driver if not available)
                              > > > > > > > > > >
                              > > > > > > > > > > for example, assume a ui "HP Color LaserJet PS"
                              is
                              > > > > present:
                              > > > > > > > > > >
                              > > > > > > > > > > use Win32::GuiTest qw(:ALL);
                              > > > > > > > > > > use strict;
                              > > > > > > > > > >
                              > > > > > > > > > > my @whnds = WaitWindowLike( undef, "^HP Color
                              > > LaserJet
                              > > > > PS",
                              > > > > > > > undef,
                              > > > > > > > > > > undef, undef, 30 );
                              > > > > > > > > > > if( !@whnds ){
                              > > > > > > > > > > die "Cannot find window \n";
                              > > > > > > > > > > }
                              > > > > > > > > > > else{
                              > > > > > > > > > > SetForegroundWindow ($whnds[0]);
                              > > > > > > > > > > sleep 1;
                              > > > > > > > > > > SendKeys("%pf");
                              > > > > > > > > > > sleep 1;
                              > > > > > > > > > > my $parHnd = WaitWindowLike( "^HP Color
                              > > LaserJet PS
                              > > > > > Printing
                              > > > > > > > > > > Preferences", "^Layout", "^#32770", undef, undef,
                              > 2 );
                              > > > > > > > > > > my $hnd = WaitWindowLike(
                              > > > > > > > > > $parHnd, "^Layout", "^#32770", undef,
                              > > > > > > > > > > undef, 2 );
                              > > > > > > > > > > printf( "Layout: %x\n", $hnd);
                              > > > > > > > > > > PushChildButton ($hnd, "^&Landscape");
                              > > > > > > > > > >
                              > > > > > > > > > > my $hnd = WaitWindowLike(
                              > > > > > > > > > $parHnd, "^Layout", "^#32770", undef,
                              > > > > > > > > > > undef, 2 );
                              > > > > > > > > > > my $hnd = WaitWindowLike( $hnd,
                              > > > > > undef, "^ComboBox",
                              > > > > > > > > > undef, undef, 2 );
                              > > > > > > > > > > printf( "combo: %x\n", $hnd);
                              > > > > > > > > > >
                              > > > > > > > > > > #SelComboString($hnd, "2");
                              > > > > > > > > > > SelComboItemText($hnd, "2");
                              > > > > > > > > > > sleep 2;
                              > > > > > > > > > > PushButton ("^OK");
                              > > > > > > > > > >
                              > > > > > > > > > > }
                              > > > > > > > > > >
                              > > > > > > > > > > now, manually open same printing pref dialog and
                              > > notice
                              > > > > > pages
                              > > > > > > > per
                              > > > > > > > > > > sheet is not the set to 2; similar to problem
                              with
                              > > > > > WMSetText,
                              > > > > > > > value
                              > > > > > > > > > is
                              > > > > > > > > > > not saved when dialog is closed by
                              > > > > > PushButton/PushChildButton.
                              > > > > > > > > > >
                              > > > > > > > > > >
                              > > > > > > > > > >
                              > > > > > > > > > > --- In perlguitest@yahoogroups.com, "Piotr
                              Kaluski"
                              > > > > > > > <pkaluski@p...>
                              > > > > > > > > > wrote:
                              > > > > > > > > > > >
                              > > > > > > > > > > > --- In
                              perlguitest@yahoogroups.com, "oohay1_2005"
                              > > > > > > > > > <oohay1_2005@y...>
                              > > > > > > > > > > > wrote:
                              > > > > > > > > > > > >
                              > > > > > > > > > > > > why is it that when do WMSetText ($hnd "abc")
                              > to
                              > > a
                              > > > > > > > > > class '#32770'
                              > > > > > > > > > > > dialog
                              > > > > > > > > > > > > then PushChildButton ($hnd, "^OK");
                              > > > > > > > > > > > > gui show "abc" in Edit field but after Ok
                              > button
                              > > is
                              > > > > > press,
                              > > > > > > > > > windows
                              > > > > > > > > > > > > send previous/default value?
                              > > > > > > > > > > > > how to resolve this issue?
                              > > > > > > > > > > > >
                              > > > > > > > > > > >
                              > > > > > > > > > > > Can you be more specific on what is going on?
                              How
                              > > about
                              > > > > > some
                              > > > > > > > code
                              > > > > > > > > > > > snippets?
                              > > > > > > > > > > >
                              > > > > > > > > > > > --Piotr
                              > > > > > > > > > > >
                              > > > > > > > > > >
                              > > > > > > > > >
                              > > > > > > > >
                              > > > > > > >
                              > > > > > >
                              > > > > >
                              > > > >
                              > > >
                              > >
                              >
                            • Piotr Kaluski
                              Goto to msdn.microsoft.com and then MSDN Library Win32 and COM Development User Interface Windows Shell Windows Controls Individual Control
                              Message 14 of 16 , Nov 23, 2005
                              • 0 Attachment
                                Goto to msdn.microsoft.com and then
                                MSDN Library > Win32 and COM Development > User Interface >
                                Windows Shell > Windows Controls > Individual Control Information
                                > ComboBox Controls >

                                --Piotr

                                --- In perlguitest@yahoogroups.com, "oohay1_2005" <oohay1_2005@y...>
                                wrote:
                                >
                                > I've also confirmed that:
                                > SendMessage( $hnd, 0x014F, 1, 0 );
                                > will work for some comboboxes but not others. It seems like all
                                > comboboxes that also alters some bitmap on gui does not work.
                                > Is there any other tricks that can resolve this?
                                >
                                > Sendkey will work in most cases, but when a combobox have the same
                                > word as the first string, eg:
                                > "Type 1"
                                > "Type 2"
                                > "Type 3"
                                > ... it would require sending additional keys; which might become
                                > inaccurate if focus is accidentally not on correct handle...
                                >
                                > Is there a link where I can search for additional info on
                                > SendMessage's flags/paramenters, similar to the flag 0x014F?
                                >
                                >
                                > --- In perlguitest@yahoogroups.com, "Piotr Kaluski" <pkaluski@p...>
                                wrote:
                                > >
                                > > Hi,
                                > > I believe I know the reason of problems.
                                > > I am not 100% sure that the explanation given below is correct,
                                but
                                > > at least it is not contradictory with my observations.
                                > >
                                > > Application can be informed about new selection in a combo box by
                                > > several events/notifications. One of such events is
                                CBN_SELCHANGE.
                                > > However, not every application uses this event and Microsoft does
                                not
                                > > recommend it. This is what they say:
                                > >
                                > > "A drop-down combo box or drop-down list box sends the
                                CBN_CLOSEUP
                                > > notification to the parent window or dialog-box procedure when
                                the
                                > > drop-down list closes. If the user changed the current selection,
                                the
                                > > combo box also sends the CBN_SELCHANGE notification when the drop-
                                > > down list closes. To execute a specific process each time the
                                user
                                > > selects a list item, you can handle either the CBN_SELCHANGE or
                                > > CBN_CLOSEUP notification message. Typically, you would wait for
                                the
                                > > CBN_CLOSEUP notification before processing a change in the
                                current
                                > > selection. This can be particularly important if a significant
                                amount
                                > > of processing is required. "
                                > >
                                > > So it seams that some applications watch for CBN_CLOSEUP, which
                                is
                                > > generated when a list of combo box is closed. They probably also
                                > > check keyboard events. That's why SendKeys solution works.
                                > >
                                > > Let's have a look at the code (last few lines from the "printing
                                > > preferences" example). In the light of facts given above, the
                                > > following does not work:
                                > >
                                > > SelComboString($hnd, "2");
                                > > PushButton( "^OK" );
                                > >
                                > > It is because only CBN_SELCHANGE event is generated.
                                > >
                                > > But if you do this:
                                > >
                                > > SendMessage( $hnd, 0x014F, 1, 0 );
                                > > SelComboString($hnd, "2");
                                > > PushButton( "^OK" );
                                > >
                                > > This magic SendMessage sends 0x014F which is CB_SHOWDROPDOWN
                                which
                                > > shows a list box of a combo box. Then you select a value
                                > > (SelComboString) and you PushButton, which causes that a window
                                is
                                > > closed and list box of a combo box is closed which generates
                                > > CBN_CLOSEUP.
                                > >
                                > > This problem brings some bigger issue. To which extent we should
                                be
                                > > smart and use sophisticated features of controls to set their
                                values?
                                > > Using mouse clicks or SendKeys seems less clean, but it is much
                                more
                                > > safe, since it generates all expected side effects.
                                > >
                                > > I think that in case of combo box, we should implement the
                                function,
                                > > which does a following:
                                > > It opens a list, selects an item and clicks on it.
                                > >
                                > > --Piotr
                                > >
                                > >
                                >
                              Your message has been successfully submitted and would be delivered to recipients shortly.