1

I would like to implement a grey text watermark in an edit control in C++ with Win32 API, but I'm not sure of any ways to do it besides handling WM_KEYDOWN messages.

I would like something like this:

image

Any ideas?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Michael
  • 115
  • 10

1 Answers1

4

Send the EM_SETCUEBANNER message to your edit control.

Pass a unicode string to display in lparam.

e.g.:

SendMessage(hwnd, EM_SETCUEBANNER, (WPARAM) FALSE, (LPARAM) strW);
TheNextman
  • 12,428
  • 2
  • 36
  • 75