Why would you want a modeless CFileDialog? I can't think of any case where a user would select some sort of open/save button and have the software not wait for an input or a cancel.
Regardless of that though, if you really want it, just make your own class derived from CFileDialog (you'll have to replace DoModal() with a call to Create()). Override the virtual methods OnOK() and OnCancel() and you have your own modeless CFileDialog.
Although that product is not free, this is probably the best solution (Active-X control) if you want to uses it from a MFC application and do not want to uses .NET framework and you still want to support XP (or even older OS).
My light bulb turned on when you mentioned about the CFile::shareExclusive flag. In my code to open file for reading, I didn't have CFile::shareDenyNone, I guess it defaults to shareExclusive when I don't specify it? After I set the flag, the program works. It looks like my program was stepping on its own foot.
I'm just still puzzled as to why it works for one file, but not the other when I don't use the shareDenyNone flag. Any ideas?
Thank you for helping me out, I feel so relief now that the problem is solved!!
Not that I am aware of; unfortunately MFC is a very specialised framework and does not sit well with other languages. If you code in pure Win32 then you can access DLL's from .NET languages via the P/Invoke[^] mechanism, which is considerably easier.