От: | Назарет | http://www.trenajor.ru/ | |
Дата: | 03.04.05 04:03 | ||
Оценка: | 8 (1) |
От: | Chez | ||
Дата: | 01.04.05 12:21 | ||
Оценка: | 4 (1) |
Edit Control Styles
--------------------------------------------------------------------------------
To create an edit control using the CreateWindow or CreateWindowEx function, specify the EDIT class, appropriate window style constants, and a combination of the following edit control styles. After the control has been created, these styles cannot be modified, except as noted.
....
ES_PASSWORD
Displays an asterisk (*) for each character typed into the edit control. This style is valid only for single-line edit controls.
Windows XP: If the edit control is from user32.dll, the default password character is an asterisk. However, if the edit control is from comctl32.dll version 6, the default character is a black circle.
To change the characters that is displayed, or set or clear this style, use the EM_SETPASSWORDCHAR message.
Note Comctl32.dll version 6 is not redistributable but it is included in Microsoft® Windows® XP or later. To use Comctl32.dll version 6, specify it in a manifest. For more information on manifests, see Using Windows XP Visual Styles.
Это почему-то не помогало. Хотя может просто Update окну надо было сделать...If an edit control is created with the ES_PASSWORD style, the default password character is set to an asterisk (*). If an edit control is created without the ES_PASSWORD style, there is no password character. The ES_PASSWORD style is removed if an EM_SETPASSWORDCHAR message is sent with the wParam parameter set to zero.
Chez, ICQ#161095094
Posted via:RSDN@Home;version:1.1.3;muzikstamp:Dvar — Ya Raii Ta Hirrih
От: | Слава Шевцов | http://www.rentaguru.ru/ | |
Дата: | 30.03.05 17:35 | ||
Оценка: |
DWORD dwStyle;
if(SendMessage(m_hwndPasswordCheck, BM_GETCHECK, 0, 0) == BST_CHECKED)
{
dwStyle = GetWindowLong(m_hwndEditPassword, GWL_STYLE);
dwStyle = dwStyle | ES_PASSWORD;
SetWindowLong(m_hwndEditPassword, GWL_STYLE, dwStyle);
}
else
{
dwStyle = GetWindowLong(m_hwndEditPassword, GWL_STYLE);
dwStyle = dwStyle & ~ES_PASSWORD;
SetWindowLong(m_hwndEditPassword, GWL_STYLE, dwStyle);
}
От: | Назарет | http://www.trenajor.ru/ | |
Дата: | 31.03.05 01:43 | ||
Оценка: |
lResult = SendMessage( // returns LRESULT in lResult
(HWND) hWndControl, // handle to destination control
(UINT) EM_SETPASSWORDCHAR, // message ID
(WPARAM) wParam, // = (WPARAM) () wParam;
(LPARAM) lParam // = 0; not used, must be zero );
Parameters
wParam
Specifies the character to be displayed in place of the characters typed by the user. If this parameter is zero, the control removes the current password character and displays the characters typed by the user.
lParam
This parameter is not used
The ES_PASSWORD style is removed if an EM_SETPASSWORDCHAR message is sent with the wParam parameter set to zero.
От: | Слава Шевцов | http://www.rentaguru.ru/ | |
Дата: | 04.04.05 16:43 | ||
Оценка: |
DWORD dwStyle = GetWindowLong(m_hwndEditPassword, GWL_STYLE);
// По чекбоксу либо скрываем, либо показываем пароль в поле
if(SendMessage(m_hwndPasswordCheck, BM_GETCHECK, 0, 0) == BST_CHECKED)
{
// Устанавливаем парольное поле
SetWindowLong(m_hwndEditPassword, GWL_STYLE, dwStyle | ES_PASSWORD);
SendMessage(m_hwndEditPassword, EM_SETPASSWORDCHAR, '*', NULL);
}
else
{
// Устанавливаем непарольное поле
SetWindowLong(m_hwndEditPassword, GWL_STYLE, dwStyle & ~ES_PASSWORD);
SendMessage(m_hwndEditPassword, EM_SETPASSWORDCHAR, NULL, NULL);
}
SetFocus(m_hwndEditPassword); // Переводим фокус в поле с паролём
SetFocus(m_hwndPasswordCheck); // Возвращаем фокус на чекбокс