0

I have created an Edit box accepting password but I need to display a watermark or whatever it calls displaying "password" as default just like when we enter our password in windows 8 startup.

thanks

1 Answers1

3

This is very easy thing to do.
Just take an edit control, right click edit control and click "Add Variable".
Give variable name, say "m_myEdit".
Now "OnInitDialog()" you need to write just one line.

m_myEdit.SetCueBanner(_T("Password"),TRUE);

This will work as you mentioned like windows 8 startup.

Himanshu
  • 4,327
  • 16
  • 31
  • 39
  • @PallaviRai you are welcome :) If my answer is helpful, you can accept it as answer. Which will helpful for future users. – Himanshu Jan 30 '15 at 09:26
  • It's generally more valuable to provide full code in an answer. Instead of describing which steps are required for a particular version of a particular IDE, reproduce the [DDX_Control](https://msdn.microsoft.com/en-us/library/z04ab59a.aspx) entries required in `DoDataExchange`. Alternatively, a call to [CWnd::GetDlgItem](https://msdn.microsoft.com/en-us/library/77d16yhw.aspx) will suffice. – IInspectable Jan 30 '15 at 14:16
  • I provided the steps so that even beginner can understand. and its only one line code that i have provided. I'm feeling its more flexible to work with variable instead of ID's. – Himanshu Jan 31 '15 at 04:14