如何在Windows Server Core上的WPF应用程序中使用“浏览文件夹"对话框? [英] How can I use the Browse for Folder dialog from a WPF app on Windows Server Core?

查看:151
本文介绍了如何在Windows Server Core上的WPF应用程序中使用“浏览文件夹"对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用FolderBrowserDialog,这似乎可以在我的开发机器上使用.但是, Windows 2008 R2 Server Core 不支持此功能.我仍然尝试运行此代码-出现对话框,但是主显示窗格不可用.

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.

我也尝试过使用Windows shell32 API(SHBrowseForFolder)获得完全相同的结果. ComDlg32 GetOpenFileName似乎可以很好地选择文件.

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

不确定要尝试什么.

推荐答案

对于为什么这样做是有疑问的.我同意这种观点.我没有给出很多关于什么以及为什么的细节,这可能会引起一些混乱.

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.

此问题的编程答案是SHBrowseForFolder中使用的BROWSEINFO结构中的标志包括NEWDIALOGSTYLE.删除该标志会为我正确显示浏览对话框.

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.

这篇关于如何在Windows Server Core上的WPF应用程序中使用“浏览文件夹"对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆