I have different behaviour with nFileExtension. When I don't type an extension (not even a dot), then nFileExtension is 0, and if I end filename with a dot, then nFileExtension points to the NULL terminating character (lpstrFile's length). This is with lpstrDefExt=NULL.