My compiler -- VS 2019 Community -- has. as I said previously, zero heart-burn with the code I wrote. Maybe try changing your message-box function call to MessageBoxW
instead of the generic MessageBox
If you are going to use Unicode/wide characters you should use the specific Unicode/wide character versions of all the Win32 API functions you are using.
How did you create your project's solution files in VS? That could be another source of your problems.
Try starting a NEW project/solution, using the Windows Desktop Wizard
template option. I used that when I wrote the code I posted.
I chose Desktop Application (.exe)
as the application type, selecting Empty project
as an additional option.
Added a new C/C++ file and wrote the code I posted above. Not a single problem except when I mistyped.
I duplicated the above steps yet again and had zero problems. There is likely something that got knocked out of whack with your solution's support files. It can happen.
When mashing together console apps I use the Empty Project template and add header and source files as I need them.