How can I use the Browse for Folder dialog from a WPF app on Windows Server Core?

孤街醉人 提交于 2019-12-22 12:52:14

问题


I've tried using the FolderBrowserDialog and that seems to work on my development machine. However, this is not supported on a Windows 2008 R2 Server Core. I tried running this code anyway - the dialog appears, but the main display pane is not available.

I've also tried using Windows shell32 API (SHBrowseForFolder) with the exact same results. ComDlg32 GetOpenFileName seems to work fine for selecting a file.

Not sure what else to try.


回答1:


There have been questions about why this is necessary. I agree with the sentiment. I did not give away a lot of details about the what and the why, and this is probably leading to some confusion.

The programming answer to this question was that the flags in the BROWSEINFO structure used in SHBrowseForFolder included NEWDIALOGSTYLE. Removing that flag displays the browse dialog properly for me.




回答2:


You cannot use what isn't there. Ask the administrator to reconfigure the machine.



来源:https://stackoverflow.com/questions/5541056/how-can-i-use-the-browse-for-folder-dialog-from-a-wpf-app-on-windows-server-core

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!