When Clarion’s runtime FILEDIALOG procedure is used as a folder picker (using the FILE:Directory option), users can easily crash the application when browsing OneDrive-backed folders, and possibly other virtual folders.
The problem only occurs when selecting a folder. When FILEDIALOG is used to select a file, Clarion uses the modern Vista-style dialog and the issue does not occur.
Steps to reproduce
1. Compile a Clarion application that calls FILEDIALOG with the FILE:Directory option.
2. Browse to a OneDrive-backed folder (for example, This PC\Documents).
3. Perform either of the following:
o Click Make New Folder and begin typing a folder name. The dialog often enters a loop, repeatedly switching between New Folder, the partially typed name, edit mode, and back again.
o Right-click an existing folder and choose Delete. This consistently crashes the application.
Based on Microsoft’s documentation and other published information, this appears to be a known limitation of applications that still use the legacy pre-Vista folder browser instead of the IFileDialog API introduced in Windows Vista.
It appears that Clarion already uses the modern IFileDialog implementation when selecting files, but continues to use the legacy folder browser when selecting folders.
Replacing the legacy folder picker with IFileDialog is possible, but there are several compatibility details required to mimic the behavior of the older dialog:
1. To preselect a folder:
o Set the initial location to the folder’s parent.
o Set the initial file name to the target folder’s name.
o Register an IFileDialog event handler.
o After the dialog populates the folder list, set the file name a second time in response to the appropriate event.
2. Convert between Clarion STRING values and UTF-16 (Unicode) strings when calling the Windows APIs.