It turns out that the Windows file dialog does not treat this as an error. It returns a successful result with no errors set. One way around this would be to make the dialog itself display an error, however this would require unsetting the OFN_NOTESTFILECREATE flag, which mIRC has used for a long time because there were side-effects without it. So the only remaining option is for mIRC to check if the result of $sfile() is an existing folder. If it is, it will make $sfile() return no value. This will be in the next version.