
Using SendMessage with LB_STRINGSELECT
For multi-selection LB:
SendMessage(hwnd, LB_SETSEL, TRUE, StringPos) ' select item
SendMessage(hwnd, LB_SETCARETINDEX, StringPos) ' set focus rect
For single-selection LB:
SendMessage(hwnd, LB_SETCURSEL, StringPos, 0)
George
Quote:
>Hi.
>I'm using SendMessage functions to find and position a string in a
>listbox, works fine. Does anyone know the syntax for using
>LB_SELECTSTRING to select the found string? Not really needed, but
>would be that little extra while moving listitems back and forth
>between boxes. ie:
>StringPos = SendMessageByString&(List1.hWnd, LB_FINDSTRING, 0,
>SearchString) ' Find search string
>If (StringPos >= 0) Then
> Result = SendMessageByNum(List1.hWnd, LB_SETTOPINDEX,
>CInt(StringPos), 0) ' ok, scroll the listbox to it
>???? Which function here?
>Any help much appreciated!
>Fred
>-----------------------------------------------------
>Corporate Pages: http://www.{*filter*}space.com/~fredf
>-----------------------------------------------------
===========================================================================
====
George R. Torralba xxxxxxxxxxxx Batang Cebu!!!
Seattle, Washington 206.227.0821 MIME mail accepted
===============================================================================