问题
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