Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to set EM_SETCUEBANNER in a Edit Control

How to set EM_SETCUEBANNER in a Edit Control

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vishalgpt
    wrote on last edited by
    #1

    Hi to all, I am unable to get the Cue Banner Text in the Edit control. Below is the code i had used.

    case WM_INITDIALOG:
    SendMessage(GetDlgItem(hwnd,IDC_USER), EM_SETCUEBANNER, 0, (LPARAM)TEXT("Username"));
    break;

    Is something extra is required to achieve the cue banner in edit control. :zzz:

    Regards, Vishal

    K _ 2 Replies Last reply
    0
    • V vishalgpt

      Hi to all, I am unable to get the Cue Banner Text in the Edit control. Below is the code i had used.

      case WM_INITDIALOG:
      SendMessage(GetDlgItem(hwnd,IDC_USER), EM_SETCUEBANNER, 0, (LPARAM)TEXT("Username"));
      break;

      Is something extra is required to achieve the cue banner in edit control. :zzz:

      Regards, Vishal

      K Offline
      K Offline
      krmed
      wrote on last edited by
      #2

      The text for your "Username" must be wide character

      case WM_INITDIALOG:
      SendMessage(GetDlgItem(hwnd,IDC_USER), EM_SETCUEBANNER, 0, (LPARAM)L"Username");
      break;

      Other than that, it's supported on WinXP and later - and I believe you need to have WINVER set to 0501 or higher - at least you used to need that. If your project is Unicode, then the TEXT macro will do, but if it's not Unicode, you must use the L prefix to create a wide character string. Hope this helps

      Karl - WK5M PP-ASEL-IA (N43CS) PGP Key: 0xDB02E193 PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193

      V 1 Reply Last reply
      0
      • K krmed

        The text for your "Username" must be wide character

        case WM_INITDIALOG:
        SendMessage(GetDlgItem(hwnd,IDC_USER), EM_SETCUEBANNER, 0, (LPARAM)L"Username");
        break;

        Other than that, it's supported on WinXP and later - and I believe you need to have WINVER set to 0501 or higher - at least you used to need that. If your project is Unicode, then the TEXT macro will do, but if it's not Unicode, you must use the L prefix to create a wide character string. Hope this helps

        Karl - WK5M PP-ASEL-IA (N43CS) PGP Key: 0xDB02E193 PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193

        V Offline
        V Offline
        vishalgpt
        wrote on last edited by
        #3

        Everything is ok but still can't get the Cue Banner Text in Edit control. :(

        Regards, Vishal

        1 Reply Last reply
        0
        • V vishalgpt

          Hi to all, I am unable to get the Cue Banner Text in the Edit control. Below is the code i had used.

          case WM_INITDIALOG:
          SendMessage(GetDlgItem(hwnd,IDC_USER), EM_SETCUEBANNER, 0, (LPARAM)TEXT("Username"));
          break;

          Is something extra is required to achieve the cue banner in edit control. :zzz:

          Regards, Vishal

          _ Offline
          _ Offline
          _Superman_
          wrote on last edited by
          #4

          What you've given is correct. You're probably not seeing the banner because the edit control has the focus. You can give the value of 1 for wParam to show the banner even if the control has focus.

          SendMessage(GetDlgItem(hwnd,IDC_USER), EM_SETCUEBANNER, 1, (LPARAM)TEXT("Username"));

          «_Superman_»  _I love work. It gives me something to do between weekends.

          _Microsoft MVP (Visual C++)

          Polymorphism in C

          K 1 Reply Last reply
          0
          • _ _Superman_

            What you've given is correct. You're probably not seeing the banner because the edit control has the focus. You can give the value of 1 for wParam to show the banner even if the control has focus.

            SendMessage(GetDlgItem(hwnd,IDC_USER), EM_SETCUEBANNER, 1, (LPARAM)TEXT("Username"));

            «_Superman_»  _I love work. It gives me something to do between weekends.

            _Microsoft MVP (Visual C++)

            Polymorphism in C

            K Offline
            K Offline
            krmed
            wrote on last edited by
            #5

            You're probably right that the control has focus, thus preventing the cue banner from showing, however the OP must still insure that it's a Unicode build if TEXT is used. If the build is non-Unicode, the L prefix is required.

            Karl - WK5M PP-ASEL-IA (N43CS) PGP Key: 0xDB02E193 PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups