Protected text in a rich edit control
Kenneth L Brown -- browkl@inel.gov
Tuesday, October 29, 1996
Environment: VC++ 4.2-flat, Win 95, NT 4.0
Has anyone used text protection with a CRichEditCtrl? I have set this
up several ways per the documentation and can't seem to get a response
to the EN_PROTECTED message. The documentation says to enable the
message with SetEventMask and handle the WM_NOTIFY message. I did these
things but the notify does not happen when I modify the protected text.
I have verified that the text is protected.
I have done a reasonable search through MSDN, MFC-L and other FAQ's but
could have missed something so if this has been discussed before I
apologize and ask only for direction to the appropriate article.
Thanks,
Kenneth Brown
browkl@inel.gov
Justin_MITCHELL@iegate.derwent.co.uk
Friday, November 01, 1996
[Mini-digest: 2 responses]
Kenneth,
This is the code I use in the CRichEditView derived class, to use
protected text:
This turns protected text on.
m_charformat.dwEffects ^= CFE_PROTECTED;
m_charformat.dwMask |= CFM_PROTECTED;
SetCharFormat(m_charformat);
This is in the message map.
ON_NOTIFY_REFLECT(EN_PROTECTED, OnProtected)
This to respond to the messages.
void CDCRedView::OnProtected(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
}
Justin Mitchell
______________________________ Reply Separator _________________________________
Subject: Protected text in a rich edit control
Author: browkl@inel.gov (Kenneth L Brown) at Internet
Date: 10/29/96 8:48 AM
Environment: VC++ 4.2-flat, Win 95, NT 4.0
Has anyone used text protection with a CRichEditCtrl? I have set this
up several ways per the documentation and can't seem to get a response
to the EN_PROTECTED message. The documentation says to enable the
message with SetEventMask and handle the WM_NOTIFY message. I did these
things but the notify does not happen when I modify the protected text.
I have verified that the text is protected.
I have done a reasonable search through MSDN, MFC-L and other FAQ's but
could have missed something so if this has been discussed before I
apologize and ask only for direction to the appropriate article.
Thanks,
Kenneth Brown
browkl@inel.gov
-----From: rkumar@mail.cswl.com
I did the following in oninitialupdate handler of my richeditview
derived class and i get the en_protected notification
// Enable protect notification
//
long eventmask = GetRichEditCtrl().GetEventMask();
GetRichEditCtrl().SetEventMask((DWORD)eventmask|ENM_PROTECTED);
Ratan
Rkumar@cswl.com
| Вернуться в корень Архива
|