请教下各位了 小弟今天发现SHBrowseForFolder这个函数在win7系统下(编辑器VC8.0) 返回值为空了!而在XP上却能成功返回值,实在费解!谁给指点下吧,先跪谢了!VC++ SHBrowseForFolderVCWindows 7

解决方案 »

  1.   

    好像确实是有这个bug
    http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/a22b664e-cb30-44f4-bf77-b7a385de49f3/
      

  2.   

    这个问题在我电脑上也重现了,我现在是Win7 x86 sp1,但从我用WIN7 Beta开始一直有这个问题。看您的ID应该是个中国人,我英语不好,所以直接打中文了。
    如楼上所说,ulFlags需要用BIF_USENEWUI才会有这个问题,传统风格对话框不会】】-------------
    Yes, there's a workaround, although it's not perfect.  I found it, with the help of a good friend, yesterday.  The only 100% solution I've found so far is to send a TVM_ENSUREVISIBLE to the tree, using TVM_GETNEXTITEM/TVGN_CARET, from BFFM_SELCHANGED. That works. Every time. On those random occasions when the pre-selected item isn't initially visible, there is the apparent scrolling after the dialog displays.
      

  3.   


    Quote: 引用 3 楼 oyljerry 的回复:

    这个问题在我电脑上也重现了,我现在是Win7 x86 sp1,但从我用WIN7 Beta开始一直有这个问题。看您的ID应该是个中国人,我英语不好,所以直接打中文了。
    如楼上所说,ulFlags需要用BIF_USENEWUI才会有这个问题,传统风格对话框不会】】 但是我试了其他的风格 如:BIF_RETURNONLYFSDIRS
                             BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT 等等 都不好使呢
      

  4.   

    问题已解决 谢谢各位!方法如下:
    在调用SHBrowseForFolder()前先memset一下就好了 具体是为什么 我就不懂了..
    BROWSEINFO bi;
    memset(&m_bi,0,sizeof BROWSEINFO);
    SHBrowseForFolder(&m_bi);