Results 1 to 5 of 5

Thread: Detect if Combobox changed

  1. #1

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

    Cool

    Is there an API call can detect if Combobox has been changed. I know sendmessage is working for Textbox, but it does not work for ComboBox
    MM

  2. #2
    Megatron
    Guest
    It's the EM_GETMODIFY message. (Same as an edit control), because the "typing field" of the combobox is actually an edit control.

  3. #3
    Addicted Member
    Join Date
    Nov 2000
    Posts
    217
    Megatron, could u give an example of using that notification message? I can't seem to figure it out.

  4. #4

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

    EM

    I did use EM_GetModify, but it does not work for combo. Please help

    Public Const EM_GETMODIFY = &HB8
    Public Const EM_SETMODIFY = &HB9
    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 PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Public Function isChanged(frm As Form)
    Dim cntl
    For Each cntl In frm
    If PostMessage(cntl.hwnd, EM_GETMODIFY, True, True) Then
    MsgBox "changed"
    Exit Function
    End If
    Next
    End Function
    MM

  5. #5
    Megatron
    Guest
    Well, first you need the handle of the Edit control inside the combobox. This can be done via FindwindowEx.
    Code:
    hEdit = FindWindowEx(Combo_handle, 0, "Edit", vbNullString)

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