yjgx007 谢谢你呀,就是类似“支付宝”的效果:https://alipay.com/。 class CXXXXPropPage : public COlePropertyPage { DECLARE_DYNCREATE(CNaLanActiveXPropPage) DECLARE_OLECREATE_EX(CNaLanActiveXPropPage)// Constructor public: CNaLanActiveXPropPage();// Dialog Data //{{AFX_DATA(CNaLanActiveXPropPage) enum { IDD = IDD_PROPPAGE_NALANACTIVEX }; // NOTE - ClassWizard will add data members here. // DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_DATA ....... } COlePropertyPage是继承自CDialog我就是在对话框(IDD_PROPPAGE_NALANACTIVEX )上添加了一个CEdite控件,并把它的属性设为PassWord. 呵呵,很简陋吧。我对ActiveX不熟悉的。现在第一个问题基本解决了,只是要防止木马,怎么屏蔽一些消息呀?不如我只要键盘消息。
那个控件是为了防止其它程序hook这个password输入框的,因此,除了键盘消息,像WM_GETTEXT消息是无效的. 不知道理解得对不对, 如果你要开发一个这样的ActiveX控件, 就要自定义Edit的消息, 当遇到WM_GETTEXT时返回一个空值, 而不用系统默认的返回值:The DefWindowProc function copies the text associated with the window into the specified buffer and returns the number of characters copied.
class CXXXXPropPage : public COlePropertyPage
{
DECLARE_DYNCREATE(CNaLanActiveXPropPage)
DECLARE_OLECREATE_EX(CNaLanActiveXPropPage)// Constructor
public:
CNaLanActiveXPropPage();// Dialog Data
//{{AFX_DATA(CNaLanActiveXPropPage)
enum { IDD = IDD_PROPPAGE_NALANACTIVEX };
// NOTE - ClassWizard will add data members here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_DATA
.......
}
COlePropertyPage是继承自CDialog我就是在对话框(IDD_PROPPAGE_NALANACTIVEX )上添加了一个CEdite控件,并把它的属性设为PassWord.
呵呵,很简陋吧。我对ActiveX不熟悉的。现在第一个问题基本解决了,只是要防止木马,怎么屏蔽一些消息呀?不如我只要键盘消息。
不知道理解得对不对, 如果你要开发一个这样的ActiveX控件, 就要自定义Edit的消息, 当遇到WM_GETTEXT时返回一个空值, 而不用系统默认的返回值:The DefWindowProc function copies the text associated with the window into the specified buffer and returns the number of characters copied.
{
if ((message==WM_GETTEXT)||(message==EM_GETLINE))
{
return 0;
}
return CEdit::DefWindowProc(message, wParam, lParam);
}
完全可以了,
但是在ActiveX怎么不可以啊?