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

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

Expand Messages
  • Piotr Kaluski
    Goto to msdn.microsoft.com and then MSDN Library Win32 and COM Development User Interface Windows Shell Windows Controls Individual Control
    Message 1 of 16 , Nov 23, 2005
      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.