For dealing with that complicated issue it is better to work with the
MFC CFileDialog class. Maybe you only need to overwrite the CFileDialog::OnItemSelected() function.
But my experience was, that it is tricky and you better stay near the Microsoft code.
Take also a look at this discussion on
codeguru.