Identify the characters DrawText will underline
See the question and my original answer on StackOverflowThe SHStripMneumonic function (UNICODE or ANSI) can do this.
Notes:
- it removes all the '&' characters from the input string;
- it returns the last character with a mnemonic, so for example calling it with "my rando&m stri&ng" will remove all '&' from the string and return 'n';
- you can escape a wanted '&' character if you double it.
- it's documented as "available through Windows XP and Windows Server 2003. It might be altered or unavailable in subsequent versions of Windows". For information I tested it on Windows 11 and latest Windows SDK (20348).
Bonus link: Why is the function SHStripMneumonic misspelled?