winapimfctchar

why TTN_NEEDTEXTW but not TTN_NEEDTEXTA?


This is an old problem that I've never figured out - wondered if someone here might happen to know the answer off of the top of your head...

In some parts of our software (MFC/Win32/MBCS) my code will only receive

TTN_NEEDTEXTW

In other parts of our software, I'll receive the MBCS correct message

TTN_NEEDTEXTA

It makes no sense to me.

I understand that our software can be compiled Unicode or not (we are set to use Multibyte character set). And I have the vague recollection that each window can be constructed Unicode or not, though this is a vague memory, nothing concrete.

Does anyone know why we'd be getting the wide version message some places in our code, despite being compiled as multibyte?

NOTES:


Solution

  • The common control sends you a WM_NOTIFYFORMAT message to ask you "Would you prefer to receive MBCS notifications or Unicode notifications?" The default is to respond based on whether the window was created via CreateWindowExW or CreateWindowExA.