Using SendMessage with LB_STRINGSELECT 
Author Message
 Using SendMessage with LB_STRINGSELECT

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
-----------------------------------------------------



Mon, 17 Aug 1998 03:00:00 GMT  
 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
===============================================================================


Tue, 18 Aug 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. using SPY ++ and using sendMessage

2. Question about SendMessage(EM_CANUNDO) and SendMessage(EM_UNDO)

3. Using SendMessage with strings

4. Passing string between application using SendMessage

5. using sendmessage api to change combo box sorted property at run time

6. A problem using the SendMessage function

7. Resizing Image in RTB using SendMessage API

8. VB4 - page control printing from RichTextBox using SendMessage()

9. using sendmessage to send shortcuts

10. help using api sendmessage to search listbox

11. Sending Restore Command to DOS Window using VB4 and SendMessage API

12. Sending an event from a DLL to a VB app using SendMessage()

 

 
Powered by phpBB® Forum Software