Archived

This topic is now archived and is closed to further replies.

passwords

This topic is 5271 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does MSVC++ have a library or built in function for using a password box? Is there a control or anything that would display the asterisks or something instead of the actual key being pressed?

Share this post


Link to post
Share on other sites
EM_SETPASSWORDCHAR
The EM_SETPASSWORDCHAR message sets or removes the password character for an edit control. When a password character is set, that character is displayed in place of the characters typed by the user. You can send this message to either an edit control or a rich edit control.

To send this message, call the SendMessage function with the following parameters.

SendMessage(
(HWND) hWnd, // handle to destination window
EM_SETPASSWORDCHAR, // message to send
(WPARAM) wParam, // character
(LPARAM) lParam // 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.
Return Values
This message does not return a value.

Share this post


Link to post
Share on other sites
I''m just having one problem with that. How do I know what the handle is? I''m popping up a dialog box that is supposed to request the password.

Just a simple program.
winMain(blahblah...)
{
DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)MainDialogProc, 0);
SendMessage((How do I get this?),EM_SETPASSWORDCHAR, (WPARAM)"**",0);
return 0;
}

Is this completely wrong? How do I get the Handle to the dialog box, or do I want the handle to the edit box? Also, do I want to send this message before calling the dialog box?

Share this post


Link to post
Share on other sites