How to detect that file dialog has been created using GetOpenFileName?
I take a part in developing of namespace shell extension(NSE) containing file list from some folders. I have some problems with Ope开发者_如何转开发n file dialog (OFD) created with the flag OFN_ALLOWMULTISELECT
on Window Vista.
If application uses OFD created using IFileOpenDialog
my NSE works fine.
If application uses OFD created using GetOpenFileName
and user selects some files then he gets an incorrect result because this function returns the string:
<Folder name>\0<File name 1>\0<File name2>\0\0
I must use single select mode in my NSE if application uses OFD created using GetOpenFileName
.
The question is:
Is here is any way to detect in my NSE that OFD has been created using GetOpenFileName
?
The old GetOpenFileName dialog was never designed to handle multiple files in different parent folders.
Trying to fix this by detecting the type of open dialog used is wrong and GetOpenFileName might just be a wrapper on top of the new interface.
When your IShellFolder::EnumObjects method is called, look for the SHCONTF_FLATLIST
flag. If the flag is not set then you should revert to some type of simple mode where all items have the same parent. I realize that this is not exactly what the flag is for but it is probably the best non-hacky solution.
精彩评论