Not a Member Yet,
Click here to Register

ID: 264
Viewed: 2679
Added: Jul 26, 2002
Version:
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
desired.

Highlight all by clicking in box
<!---Declaration--->
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
<!---Code--->
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
;


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 - 2024 snippetlibrary.com All Rights Reserved. Conditions
Do NOT follow this link or you will be banned from the site!