# SetWindowText problem with &



## bobritter (Sep 9, 2005)

Simple question. The following to set a button label:
SetWindowText(.....,"ABC&DEF" ); or any similar gives ABCDEF with the D underlined. "ABC&&DEF" gives ABC&DEF. All kinds of wierd results.

It's obvious, I think, that & is acting as an underscore control character but I can't find an documentation about it. Also "ABC\&DEF" gives ABC\DEF with the D still underscored.


----------



## IMM (Feb 1, 2002)

You could dig through this one for the ampersand notes - but info isn't easy to come by.
http://msdn.microsoft.com/en-us/library/ms997560.aspx

Sometimes terms such _access key indicator_ (or hot key indicator) are used for that -- it's an indicator that an ALT-{letter} shortcut is available. You will see it used on most menubar menus.
For example - it's the underlined H in the help menu of explorer
If you aren't intending a shortcut with the ampersand and want to display an ampersand - give the control a SS_NOPREFIX 'style'.


----------



## bobritter (Sep 9, 2005)

Thanks! That's what I figured but didn't know about SS_NOPREFIX


----------

