-
Option Explicit
I use the code below to detect if Combobox has changed. but it only can detect if I type in to combobox. I can not detect if I just simply click the combobox.
Please help, thanks very much
Private Declare Function SendMessage Lib "user32"
Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Const EM_GETMODIFY = &HB8
Private Sub Command1_Click()
Dim rc As Long
rc = FindWindowEx(Combo1.hwnd, 0, "Edit", vbNullString)
If SendMessage(rc, EM_GETMODIFY, 0, 0) Then
MsgBox "Changed"
End If
End Sub
-
Once method is to subclass your Form to catch the WM_COMMAND message. If lParam = Combo1.hWnd, then it changed.
-
Need more
Could you elabrate a little bit more, I am really not smart enough to catch your idea. Thanks