Try using two dynamic environment variables.
Delayed crash when using CFileDialog or GetOpenFileName - Windows 10, x64 application
I am using Visual Studio 2017 to write a 64-bit application (Windows 10). When I use CFileDialog or GetOpenFileName the program exhibits a delayed crash. The CFileDialog operation seems to work fine. I open the file, process the data, and then the program crashes long after the CFileDialog has closed. The location and timing of the crash varies, but the call stack always points to a heap error. When I eliminate the use CFileDialog (or GetOpenFileName), there is no crashing.
There was a similar problem with CFileDialog associated with Windows 7 and Windows 8 as discussed at stackoverflow.com/questions/12388182/cfiledialog-delayed-crashing.
How can I troubleshoot this problem? Is there a fix for Windows 10 x64?