2

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.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
user190770
  • 121
  • 2
  • 2
    You understand that Server Core is explicitly *not intended* to run applications that display a user interface? – Cody Gray - on strike Apr 04 '11 at 15:56
  • Yeah, this is run from an app that is replacing the shell UI. The user actually doesn't have access to the command line. – user190770 Apr 04 '11 at 16:12
  • That doesn't make any sense. Server Core doesn't have a shell UI, so you can't *replace* it. Why is there a **user** at all? The whole point of Server Core is to reduce the attack center of an isolated server in a far away datacenter, controlled only remotely by admins who *like* command line interfaces. It's not for users, and not for people who want a GUI. Re-installing the machine with the *full* version of Windows Server is the best option; that's what I use as my day-to-day OS. – Cody Gray - on strike Apr 04 '11 at 16:16

2 Answers2

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.

user190770
  • 121
  • 2
  • 1
    I assume the problem is described in the [documentation](http://msdn.microsoft.com/en-us/library/bb773205.aspx): `Note: If COM is initialized through CoInitializeEx with the COINIT_MULTITHREADED flag set, SHBrowseForFolder fails if BIF_NEWDIALOGSTYLE is passed.` – Cody Gray - on strike Apr 06 '11 at 06:33
0

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

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536