We often see a background text on search bars i.e. "Search Here", "Type here to search" etc. and it disappears when we start typing. Have a look at the following one:
Is there any built-in
method to implement the same functionality in an MFC Application
for the CComboBox Control ?
Use CComboBox::SetCueBanner
This sends window message
CB_SETCUEBANNER
.SetCueBanner
is also available forCEdit
. This feature needs at least Windows Vista.This function is unicode only, it has to have to unicode text.
If you are targeting WinXP,
SetCueBanner
is not available and the program will not compile. But you can still sendCB_SETCUEBANNER
(0x1703
) message:This will compile and run on all systems, however it won't have any effect in Windows XP.