如何检查窗口句柄是否为密码字段?

时间:2015-08-04 11:10:44

标签: c# c++

我有一个窗口句柄(HWND),它是从另一个进程捕获的,而不是当前进程。现在我必须检查编辑控件是密码字段还是普通文本字段。我可以成功吗?

 I am trying with this one but always I got 0 as result.

uint EM_GETPASSWORDCHAR = 210;

SendMessage(hWnd.ToInt32(),EM_GETPASSWORDCHAR,0,0);

1 个答案:

答案 0 :(得分:2)

这应该这样做:

LONG style = GetWindowLong(hWnd, GWL_STYLE);
if( (style & ES_PASSWORD) == ES_PASSWORD ) {
    // is a password window
}