Re: window messages
From: Tom Esh (tjeshGibberish_at_earthlink.net)
Date: 02/23/04
- Next message: Tom Esh: "Re: FreeSpace and GetDiskFreeSpace API not works in 2003 services"
- Previous message: JonWayn: "Re: window messages"
- In reply to: JonWayn: "window messages"
- Next in thread: JonWayn: "Re: window messages"
- Reply: JonWayn: "Re: window messages"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 23 Feb 2004 00:15:32 -0500
If this is a continuation of your previous thread (Updating
Listboxes), then you're sending the wrong notification code.
CBN_EDITCHANGE only applies to combos with an edit control, not those
with just a dropdown. It should be CBN_SELCHANGE.
Also when sending SELECTSTRING, make sure your string in lParam is
passed ByVal. Your "SendMessageText" declare may do that, however if
so it will not work with WM_COMMAND, since lParam is not a string in
that case.
Ex:
Public Const WM_COMMAND = &H111
Public Const CBN_SELCHANGE = 1
Public Const CB_SELECTSTRING = &H14D
Public Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" _
(ByVal hWnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long
Public Declare Function GetDlgCtrlID Lib "user32" _
(ByVal hWnd As Long) As Long
\
Dim wParam As Long
wParam = (CBN_SELCHANGE * &H10000) + GetDlgCtrlID(hChild)
SendMessage hChild,CB_SELECTSTRING, -1&, ByVal TempString
SendMessage Wnd,WM_COMMAND, wParam, ByVal hChild
On Sun, 22 Feb 2004 21:13:06 -0500, "JonWayn" <jongunn@bellsouth.net>
wrote:
>TempString = "Local" & vbNullChaR
>? SendMessageText(hChild,CB_SELECTSTRING,-1,TempString) ' *
>LoWord = GetDlgCtrlID(hChild)
>HiWord = CB_EDITCHANGE
>
>lngDWord = (lngDWord And &HFFFF) Or (HiWord * 2 ^ 16)
>lngDWord = (lngDWord And &HFFFF0000) Or LoWord
>
>? SendMessageText(Wnd,WM_COMMAND,lDWord,hChild) ' **
>
>'================================================================
>Refer to the asterisks above:
>
>* Works fine - changes the edit control portion of the combobox to 'Local
>Disk (C:)' in my experiments, from a subfolder of C:
>
>
>** Does nothing whatsoever
>
>CB_FINDSTRING and CB_SELECTSTRING work fine for this combobox. However, with
>the FileName combobox, CB_GETCOUNT returns the right number of items, but
>neither CB_SELECTSTRING nor CB_FINDSTRING works.
>
-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
- Next message: Tom Esh: "Re: FreeSpace and GetDiskFreeSpace API not works in 2003 services"
- Previous message: JonWayn: "Re: window messages"
- In reply to: JonWayn: "window messages"
- Next in thread: JonWayn: "Re: window messages"
- Reply: JonWayn: "Re: window messages"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|