EN_PROTECTED和RichEdit [英] EN_PROTECTED and RichEdit

查看:259
本文介绍了EN_PROTECTED和RichEdit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试更改受保护的文本时,会将EN_PROTECTED通知消息发送给Rich Edit控件的父级。这对我有用,我已经在richedit20和richedit50上尝试过。对此受保护文本的任何更改都会立即触发EN_PROTECTED消息。 (设置起来有点复杂,但是我已经正确地完成了。)

The EN_PROTECTED notify message is sent to the parent of a rich edit control when there is an attempt to change "protected" text. This works for me and I've tried it with both richedit20 and richedit50. Any change to this protected text immediately triggers the EN_PROTECTED message. (Its a little complicated to set it up, but I've done that correctly.)

但是,文档说父母是否响应EN_PROTECTED返回非零值消息,它将防止更改受保护的文本。这对我不起作用。

However, the documentation says if the parent returns non zero in response to the EN_PROTECTED message, it will prevent the protected text from being changed. This is not working for me.

推荐答案

我使用MFC创建了一个简单的测试对话框测试应用-通过对话框编辑添加richedit控件,并添加了对在应用程序初始化中 AfxInitRichEdit ,向对话框中添加一些代码以将文本放入控件( SetWindowText ),然后选择第二个字,应用 CFE_PROTECTED 效果,然后为 EN_PROTECTED 添加一个处理程序,在该处理程序中,我只设置了 * pResult = TRUE

I created a simple test dialog test app, using MFC - add the richedit control via the dialog edit, added a call to AfxInitRichEdit in the app initialization, added some code to the dialog to put text in the control (SetWindowText), selected the second word, applied the CFE_PROTECTED effects and then added a handler for EN_PROTECTED, in the handler i just set *pResult = TRUE.

当我运行该应用程序时,一切正常。因为我不能能够修改受保护的单词,但是我可以修改其余文本。

When i ran the app it all worked fine; in that i was not able to modify the protected word but i could modify the rest of the text.

不幸的是,这并不能真正导致我们确定您的代码为何不起作用的最终原因-从我看来,这似乎是正确的。我想可能是RichEdit20 dll的版本-我的是5.31.23.1224

Unfortunately that really doesn't lead us to a conclusive reason as to why your code doesn't work - from what i can see it appears correct. Could be the version of the RichEdit20 dll i suppose - mine is 5.31.23.1224

这篇关于EN_PROTECTED和RichEdit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆