Results 1 to 3 of 3

Thread: Detect if Combobox changed

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2001
    Location
    Springfield
    Posts
    120
    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
    MM

  2. #2
    Megatron
    Guest
    Once method is to subclass your Form to catch the WM_COMMAND message. If lParam = Combo1.hWnd, then it changed.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2001
    Location
    Springfield
    Posts
    120

    Need more

    Could you elabrate a little bit more, I am really not smart enough to catch your idea. Thanks
    MM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width