input box问题!
怎样能使input box输入框中的输入以*****显示? 问题点数:20、回复次数:7Top
1 楼chechy(www.qdocuments.net)回复于 2002-09-18 20:55:44 得分 0
将PasswordChar设为*Top
2 楼yangpeng106(小牛)回复于 2002-09-18 21:00:39 得分 0
同志,我是在使用input box函数!怎么设啊?Top
3 楼blazingfire(烈焰)(对.net极度憎恨中....)回复于 2002-09-18 21:03:25 得分 0
没办法。只有自己作一个窗体再放几个控件了。Top
4 楼yangpeng106(小牛)回复于 2002-09-18 21:04:43 得分 0
哦?
真的没有再方便一点的做法么?Top
5 楼Kingron(单身走我路……)回复于 2002-09-18 21:22:08 得分 20
我们经常使用InputBox,但是,一个缺点就是,Inputbox不能有密码掩码的功能,就是用*掩盖输入的字符,下面的代码演示了一个巧妙的方法来做到这一点:
const
InputBoxMessage = WM_USER + 200;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
procedure InputBoxSetPasswordChar(var Msg: TMessage); message InputBoxMessage;
public
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.InputBoxSetPasswordChar(var Msg: TMessage);
var
hInputForm, hEdit, hButton: HWND;
begin
hInputForm := Screen.Forms[0].Handle;
if (hInputForm <> 0) then
begin
hEdit := FindWindowEx(hInputForm, 0, 'TEdit', nil);
{
// Change button text:
hButton := FindWindowEx(hInputForm, 0, 'TButton', nil);
SendMessage(hButton, WM_SETTEXT, 0, Integer(PChar('Cancel')));
}
SendMessage(hEdit, EM_SETPASSWORDCHAR, Ord('*'), 0);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
InputString: string;
begin
PostMessage(Handle, InputBoxMessage, 0, 0);
InputString := InputBox('Input Box', 'Please Enter a Password', '');
end;Top
6 楼blazingfire(烈焰)(对.net极度憎恨中....)回复于 2002-09-18 21:42:38 得分 0
~~~~~~~~~~五体投地~~~~~~~~~~Kingron神呀!!!!Top
7 楼blazingfire(烈焰)(对.net极度憎恨中....)回复于 2002-09-18 21:43:30 得分 0
强烈建议版主加入精华区!Top




