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 Sub Command12_Click() Const EM_GETMODIFY = &HB8 Dim hWndEdit As Long Dim dirty As Long 'get the handle to the edit portion 'of the combo control. FindWindowEx finds the 'child hwnds associated with the hwnd passed. 'With a combo, the first returned is the edit. hWndEdit = FindWindowEx(Combo1.hwnd, 0&, 0&, 0&) 'see if the text has changed dirty = SendMessageLong(hWndEdit, EM_GETMODIFY, 0&, 0&) 'the result MsgBox IIf(dirty, "Text has changed", "No change") End Sub To check for the dirty state, you first need to obtain the hwnd to the edit box. This should remain the same throughout the running of the app, so the FindWindowEx portion can be placed into a form load event or the like, if desired. |