0

This is the window title of my application:

STRINGTABLE 
BEGIN
    IDR_MAINFRAME           "EasyCash&&Tax"
    ...

It shows "EasyCash&Tax" correctly in the window, but "EasyCash&&Tax" in the taskbar:

enter image description here

If I change it to

    IDR_MAINFRAME           "EasyCash&Tax"

it will appear correctly in the taskbar but in the window title it will appear as "EasyCashTax" with the 'T' underlined because '&' is interpreted as keyboard shortcut indicator.

I'm using VS2008.

thomiel
  • 2,467
  • 22
  • 37
  • 2
    Why is this question tagged as "MFC"? This rather appears to be a WinAPI problem. If the application is MFC-based, please let us know if the window you are displaying is `CFrameWnd`-derived or `CDialog`-derived (if the application was created by the Wizard as "Dialog-based"). Don't know how many users still have VS2008 installed, but your problem may be reproducible even with newer versions of MFC. – Constantine Georgiou Feb 09 '20 at 20:31
  • 3
    `&` is a special character only when it appears in dialog controls, a button for example. Otherwise, `&` will appear in window title as is. Maybe you have a custom draw title bar which uses `DrawText` to show window's title, and it doesn't use `DT_HIDEPREFIX` flag. – Barmak Shemirani Feb 10 '20 at 01:07
  • @Constantine Georgiou I just didn't want to make presumtions. It's a MDI using CMDIFrameWndEx, not a dialog-base application. – thomiel Feb 10 '20 at 13:47
  • @Barmak Shemirani have you tested it with VS2008? I can confirm that '&' is being translated correctly in a VS2017 MDI application. This is definitly a quirk of VS2008 or the MFC9 framework. – thomiel Feb 10 '20 at 13:47
  • Show screenshot of your window title bar. I did test it with VS2008, it shows `&` as is. I have the basic version of VS2008. I think other versions come with FeaturePack or something. – Barmak Shemirani Feb 10 '20 at 13:56
  • Checked with VS2017 too, and indeed, it's impossible to make the ampersand NOT be displayed. The text is displayed as is, in both cases. As @BarmakShemirani said, maybe some custom drawing is to blame. I mostly suspect those "themes". If your application is using them, better switch to native. Don't know what's so fascinating in making your app look like an old version of MS-Office, for example. Instead I find the "native" appearance not just acceptable, but even desirable. Otherwise, a fix could be locate the custom drawing in the MFC code and change it. – Constantine Georgiou Feb 11 '20 at 10:23
  • @Constantine Georgiou I have indeed used themes: https://github.com/Thomas-Mielke-Software/EasyCash/blob/master/Uxtheme.h -- This is a good clue I will pursue. – thomiel Feb 11 '20 at 14:25
  • @Barmak Shemirani I have SP1 & Feature Pack installed. You will find a screenshot here: https://www.easyct.de/downloads.php?cat_id=1&download_id=1 and a screenshot of the taskbar here: https://github.com/Thomas-Mielke-Software/EasyCash/issues/2 – thomiel Feb 11 '20 at 14:29
  • You haven't posted a link to any screen shot. There is probably a bug in FeaturePack which you have to fix. Or if you are using Unicode, find a different Unicode character similar to `&` – Barmak Shemirani Feb 12 '20 at 22:05
  • @Barmak Shemirani I added a screenshot to the question. (Just messed up the code a bit more by applying a CSplitterWnd in the CChildFrame, see here: https://stackoverflow.com/questions/66186021 ) – thomiel Feb 13 '21 at 14:27

0 Answers0