禁止编辑框粘贴数据
来源:互联网 发布:网络摄像机交换机配置 编辑:程序博客网 时间:2024/06/07 19:23
up vote 0 down vote accepted
I found 2 ways of solving the problem....please check the below...
1st method:
class CNoPasteEdit: public CEdit{public:CNoPasteEdit();~CNoPasteEdit();protected:// This line will need to be added by hand because WM_PASTE is not available in// class wizardafx_msg LRESULT OnPaste(WPARAM wParam, LPARAM lParam);afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);DECLARE_MESSAGE_MAP()};
Then you will need to edit the .cpp file for this class like so
CNoPasteEdit::CNoPasteEdit(){// Put any construction code here}CNoPasteEdit:~:CNoPasteEdit(){// Put any destruction code here}BEGIN_MESSAGE_MAP(CNoPasteEdit, CEdit)// This line is needed because there is no default macro for WM_PASTE messages// This line will also need to be added by handON_MESSAGE(WM_PASTE, OnPaste)ON_WM_CONTEXTMENU()END_MESSAGE_MAP()LRESULT CNoPasteEdit::OnPaste(WPARAM wParam, LPARAM lParam){// Put any code here you want to execute when the user right clicks on the edit// control. Just leave it blank to disable the menu}void CNoPasteEdit::OnContextMenu(CWnd* pWnd, CPoint point){// Put any code here you want to execute when the user tries to paste into the edit// conrtol. Just leave it blank to prevent pasting.}
2nd method: Handle the ON_EN_CHANGE event and capture the text in the CString and check if its more than the limited character..if its..you can clear the text box with a warning message...
- 禁止编辑框粘贴数据
- 输入框禁止粘贴
- 输入框禁止粘贴
- 表单输入框禁止粘贴
- input输入框怎么禁止粘贴
- 下拉框禁止编辑权限
- 禁止复制粘贴
- 文本框 禁止粘贴
- javaScript禁止粘贴复制
- JavaScript-禁止复制、粘贴
- JS禁止复制粘贴
- textbox设置禁止粘贴
- 文本框禁止粘贴
- Edittext禁止复制粘贴
- EditText禁止复制粘贴
- 禁止复制粘贴
- javascript 禁止右键,禁止复制,禁止粘贴
- android界开发如何禁止密码输入框复制粘贴
- CXF 结合spring
- 开源项目之Android GreenDroid(界面库)
- MotionEvent的getX()与getRawX()区别
- Elasticsearch 源码eclipse环境搭建
- 反向css圆角矩形:
- 禁止编辑框粘贴数据
- AIR ADT打包APK笔记
- 程序员要勇于说不
- 如何使listview中的CheckBox被正确选中?
- Android平台的流媒体注意事项
- 答辩结束有感
- Linux初始化Nor Flash芯片及驱动
- thinkphp的display空白
- 任意类任意字段进行升序或降序排序