CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1

    EM_GetModify Problem!

    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.


  2. #2
    Join Date
    Sep 1999
    Location
    Red Wing, MN USA
    Posts
    312

    Re: EM_GetModify Problem!

    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
    [email protected]
    Certified AllExperts Expert: http://www.allexperts.com/displayExp...p?Expert=11884
    Aaron Young
    Senior Programmer Analyst (Red Wing Software)
    Certified AllExperts Expert

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured