|
-
Apr 10th, 2001, 05:10 PM
#1
Thread Starter
Lively Member
I want to detect if combobox has been changed. I use first command button to set a handle for this combobox, then I hope if I changed the combobox, when I click second command, it will detect. But it does not work, can someone help???
Private Sub Command1_Click()
hEdit = FindWindowEx(Combo1.hwnd, 0 , "Edit", vbNullString)
End Sub
Private Sub Command2_Click()
If SendMessage(hEdit, EM_GETMODIFY, True, True) Then
MsgBox "changed"
End If
End Sub
-
Apr 10th, 2001, 05:23 PM
#2
PowerPoster
Here ya go
Code:
Option Explicit
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
-
Apr 10th, 2001, 05:33 PM
#3
Thread Starter
Lively Member
I tried this
Thanks, but it only work if type into that Combobox, it does not work if I just simplely click the combobox
Please help, thanks again
-
Apr 11th, 2001, 05:50 AM
#4
try this...
dim prevconts as string
private sub command1_click()
prevconts = combo1.text
end sub
private sub command2_click()
if prevconts = combo1.text then
msgbox "Contents have not been changed!"
else
msgbox "Contents have been changed!"
end if
end sub
-
Apr 11th, 2001, 09:27 AM
#5
Thread Starter
Lively Member
That is a easy answer
This does not work, I have to use API calls.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|