本文介绍了SHBrowseForFolder的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在使用函数SHBrowseForFolder时遇到问题:假设以下情况:
1.程序调用该函数,并带有可以创建新文件夹的选项->.文件夹浏览器对话框打开.
2.用户通过创建新文件夹"按钮创建新文件夹.已经创建了新文件夹",并且用户获得了一个编辑框,他可以在其中对其进行重命名.
3.用户开始输入新的文件夹名称,然后立即按OK(确定)按钮,而无需离开编辑框. ->如果操作系统太慢而无法将"New Folder"重命名为新名称,对话框将在其输出列表中显示"New Folder"(例如,由于正在运行的应用程序与正在浏览文件夹的目标计算机之间的网络连接较慢) .

显然这是一个错误,但可以理解,尽管重命名"较晚,该对话框也必须使用"early"文件夹名称的值快速返回.
可以找到此问题的解决方案或解决方法吗?

在此先感谢您

Hi,

I have a problem using the function SHBrowseForFolder: Suppose the following situation:
1. The programm calls this function with the option that new folders can be created -> folder browser dialog opens.
2. The user makes a new folder via button "Make New Folder" -> "New Folder" has been created and the user gets an edit box where he can rename it.
3. The user begins typing the new folder name and immediately presses OK button WITHOUT leaving the edit box. -> dialog results "New Folder" in its output list if the OS is too slow to rename the "New Folder" to the new name (for example because of a slow network connection between the running application and target machine where the folders are being browsed).

This is clearly an error, but it can be understood, that the dialog must quick return with a value of the "early" folder name despite of "late renaming".
Can be found a solution or workaround for this problem?

Thanks in advance

推荐答案

int nMaxRetries = 10;
while((!File::Exists(path)) && (nMaxRetries-- > 0))
{
   sleep(200);
}


祝你好运!


Good luck!




这篇关于SHBrowseForFolder的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 23:40