Pelles C forum

C language => Windows questions => Topic started by: Snowman on June 20, 2015, 12:39:40 PM

Title: Edit_SetCueBannerText and EM_SETCUEBANNER are not working (Pelles C bug?)
Post by: Snowman on June 20, 2015, 12:39:40 PM
I use Windows XP 32-bit and Pelles C 8.00.60.

In my program, I want to enable a "cue banner text" for the edit controls. A cue text is gray text that disappears when the user starts to input data; modern web browsers often use this to show the name of the search engine. Even Internet Explorer 8 does it.

According to MSDN this can be done by using the Edit_SetCueBannerText macro or by sending the EM_SETCUEBANNER message:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb761701%28v=vs.85%29.aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/bb761639%28v=vs.85%29.aspx

The problem is that neither works for me! Is there a bug in my code? Is this a bug in Pelles C?

Or is this feature unsupported on Windows XP -- if so, how come Skype and Internet Explorer 8 can use it just fine?

Attached below is the source code and compiled executable.
Title: Re: Edit_SetCueBannerText and EM_SETCUEBANNER are not working (Pelles C bug?)
Post by: TimoVJL on June 20, 2015, 03:17:28 PM
First check your ComCtl32.dll version.
Title: Re: Edit_SetCueBannerText and EM_SETCUEBANNER are not working (Pelles C bug?)
Post by: Snowman on June 20, 2015, 04:58:08 PM
First check your ComCtl32.dll version.
Using the program you attached: 6.0.2900.6028.
Maybe my project's manifest is wrong?
Title: Re: Edit_SetCueBannerText and EM_SETCUEBANNER are not working (Pelles C bug?)
Post by: jj2007 on June 20, 2015, 05:35:18 PM
I've tested it with my own templates, and indeed, it will not work without an XP manifest.
Title: Re: Edit_SetCueBannerText and EM_SETCUEBANNER are not working (Pelles C bug?)
Post by: Snowman on June 20, 2015, 05:43:36 PM
I've tested it with my own templates, and indeed, it will not work without an XP manifest.
Could you please attach the manifest file for which the cue text feature works for you?
Then I will try that manifest on my previously attached project.
Title: Re: Edit_SetCueBannerText and EM_SETCUEBANNER are not working (Pelles C bug?)
Post by: jj2007 on June 20, 2015, 06:31:51 PM
Here it is.
Title: Re: Edit_SetCueBannerText and EM_SETCUEBANNER are not working (Pelles C bug?)
Post by: Snowman on June 20, 2015, 06:50:47 PM
Thanks but unfortunately it still doesn't work for me. What version of Windows are you using, is it XP?
Title: Re: Edit_SetCueBannerText and EM_SETCUEBANNER are not working (Pelles C bug?)
Post by: jj2007 on June 20, 2015, 09:12:11 PM
OK, I resuscitated my old XP machine: doesn't work, even with a manifest. What is most irritating is that SendMessage and GetLastError insist that everything is just fine. But it isn't.
Conclusion: Works fine with Win7 and a manifest that specifies common controls version 6, otherwise not. I suggest to set the text manually, and clear it when the control gets the focus for the first time.

P.S.: Fascinating  (http://stackoverflow.com/questions/17844655/set-combobox-cue-banner-in-windows-xp)... note this refers to combobox, not edit control:
Quote
You need to use EM_SETCUEBANNER As Integer = &H1501 for XP and CB_SETCUEBANNER As UInteger = &H1703 for Windows 7.

Check this also:
Quote
The problem in Windows XP isn’t that the cue banner shows up in an East Asian Language; it’s that if an East Asian language pack is installed, then the cue banner doesn’t show up at all

Could be the reason why it doesn't show on my old machine, because it does have an East Asian Language pack.
Title: Re: Edit_SetCueBannerText and EM_SETCUEBANNER are not working (Pelles C bug?)
Post by: Snowman on June 22, 2015, 09:35:02 AM
Could be the reason why it doesn't show on my old machine, because it does have an East Asian Language pack.
Thanks, uninstalling the East Asian language support was the solution for me. It is pathetic of Microsoft that they haven't fixed this bug in all these years, while XP was still being supported.