When you select a number of files on OpenFileDialog you get the working directory path in a structure member of OPENFILENAME
but when you select a single file you get the path to filename in that variable member.
Would there be a possible way to get the path first before looping and counting to check the number of files?