Not a Member Yet,
Click here to Register
How do you like the new design?

ID: 264
Viewed: 2223
Added: Jul 26, 2002
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo

User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

From a usenet posting by Randy Birch

The handle provided as the combo hwnd is not the handle to the edit portion
(or list portion for that matter) of the control. It is instead the handle
to the object that contains the combo and list.

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

Highlight all by clicking in box
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

Highlight All
Private Sub Command12_Click()

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

No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.

Replying to a Comment...

Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2018 All Rights Reserved. Conditions