if TEventMsg(PEventMsg(lParam)^).message = WM_LBUTTONDOWN then
begin
// 是否为密码框
if WindowStyle and ES_PASSWORD <> 0 then
begin
// 去掉密码属性
PostMessage(WindowHandle, EM_SETPASSWORDCHAR, 0, 0);
end;
end;
Result := CallNextHookEx(HookHandle, code, wParam, lParam);
end;需要注意的是,程序中PostMessage(WindowHandle, EM_SETPASSWORDCHAR, 0, 0);只能使用PostMessage,而不能使用SendMessage代替。