Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Windows Controls
Control Library
Edit Control
Messages
 EM_SETCUEBANNER Message

  Switch on low bandwidth view
EM_SETCUEBANNER Message

Sets the textual cue, or tip, that is displayed by the edit control to prompt the user for information.

Syntax

To send this message, call the SendMessage function as follows.
lResult = SendMessage(     // returns LRESULT in lResult
   (HWND) hWndControl,     // handle to destination control
   (UINT) EM_SETCUEBANNER,     // message ID
   (WPARAM) wParam,     // = (WPARAM) (BOOL) wParam;
   (LPARAM) lParam     // = (LPARAM) (LPCWSTR) lParam;
);

Parameters

wParam
[in] TRUE if the cue banner should show even when the edit control has focus; otherwise, FALSE. FALSE is the default behavior—the cue banner disappears when the user clicks in the control.
lParam
[in] A pointer to a Unicode string that contains the text to display as the textual cue.

Return Value

Remarks

An edit control that is used to begin a search may display "Enter search here" in gray text as a textual cue. When the user clicks the text, the text goes away and the user can type.

You cannot set a cue banner on a multiline edit control or on a rich edit control.

Note  To use this API, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see Enabling Visual Styles.

Message Information

HeaderDeclared in Commctrl.h
Minimum operating systems Windows XP

See Also

Edit_SetCueBannerText
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
wParam option note      David Lowndes ... Stanley Roark   |   Edit   |   Show History

wParam TRUE - only appears to work on Vista.

Under XP the cue text always disappears when the control gets focus regardless of this parameter.

Sample for C#      tehnolog ... Stanley Roark   |   Edit   |   Show History

// Alexander Klimov

// http://developer.alexanderklimov.ru/

[DllImport("user32.dll", CharSet = CharSet.Auto)]

private static extern Int32 SendMessage(IntPtr hWnd, int msg,

int wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam);

private const int EM_SETCUEBANNER = 0x1501;

SendMessage(textBox1.Handle, EM_SETCUEBANNER, 0, "Type your question");

Tags What's this?: c# (x) Add a tag
Flag as ContentBug
Error on this page      Stanley Roark   |   Edit   |   Show History
There appears to be an open <strong> tag somewhere here - the whole page is in bold.

Doesn't work with the Asian language pack      David Lowndes ... Stanley Roark   |   Edit   |   Show History
The cue banners don't work when the Asian language pack is installed on XP (the "Install files for East Asian languages" option). See http://blogs.msdn.com/michkap/archive/2006/02/25/538735.aspx
This issue is fixed on Vista.
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker