Simonkale
June 22nd, 2001, 07:52 AM
I invoked SendMessage with EM_GetModify to check if the content of the current doc. has been changed or not. But when I run the app for the first time and press File|Newthe function return TRUE, telling that the doc has been modified. What's happening? I haven't typed anything on it.
Aaron Young
June 22nd, 2001, 08:34 PM
You just need to reset the Textbox's Modified status, i.e.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 Const EM_GETMODIFY = &HB8
private Const EM_SETMODIFY = &HB9
private Sub Form_Resize()
Text1.Move 0, 0, ScaleWidth, ScaleHeight
End Sub
private Sub Form_QueryUnload(Cancel as Integer, UnloadMode as Integer)
If SendMessage(Text1.hwnd, EM_GETMODIFY, 0, byval 0) then
Cancel = (MsgBox("Cancel all changes and exit?", vbYesNoCancel + vbDefaultButton3, "Cancel Edits") <> vbYes)
End If
End Sub
private Sub mnuNew_Click()
Text1 = ""
SendMessage Text1.hwnd, EM_SETMODIFY, 0, byval 0
End Sub
Aaron Young
Senior Programmer Analyst
ajyoung@charter.net
Certified AllExperts Expert: http://www.allexperts.com/displayExpert.asp?Expert=11884