As a software developer I find it surprising how you keep finding a need for certain things you write as little throw away test programs.
In investigating a forum support question as part of my MVP activities, I saw this thread where the poster noted that since Windows 8 the ShellExecuteEx API seems to behave differently for files with no association – it displays UI rather than returning a “no association” error code.
To check what they said, I ran up ShellExec and for the first time ever I tried to paste in the path to a file that contained characters not in my system’s code page (UK English). It was immediately obvious by the replacement of many of the characters by ‘?’ that ShellExec was not built to support Unicode. Considering that I initially wrote it in 1997 for Windows 9x usage and have done little to alter it subsequently, I guess it’s no surprise that it was still an old school non-Unicode application.
A quick change to the project properties in Visual Studio to build it as Unicode, and a few minor changes in the code to use Unicode strings rather than ANSI ones, and the conversion to Unicode was done. Now when I pasted the Unicode path into the document path field, the path was displayed correctly.
Seeing that “if a job’s worth doing, it’s worth doing well” (thanks for instilling that into me Dad), and I keep finding that I use this test application, this version also adds the buttons that let you populate the file & directory fields using the standard Windows file and folder selection dialogs.