scottwis / OpenFileOrFolderDialog

66 stars 43 forks source link

Window doesn't show under VS 2015 #4

Open reubengann opened 8 years ago

reubengann commented 8 years ago

Hi, I imported OpenFileOrFolderDialog.cs, InteropUtil.cs, InternalErrorException.cs, and Util.cs into my Visual C# project, then following the example code, made a button and attached code `private void LoadFolderButton_Click(object sender, EventArgs e) { using (OpenFileOrFolderDialog folderBrowserDialog1 = new OpenFileOrFolderDialog()) { folderBrowserDialog1.AcceptFiles = false; folderBrowserDialog1.Path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); folderBrowserDialog1.ShowDialog(); }

}`

However, no window shows up. I traced the code, and as soon as the OpenFileOrFolderDialog constructor ends, the body of the using block is executed. There are no compilation errors or anything, just nothing shows up. I'm targeting .NET 4.5.2, if that matters. Is this a known limitation or is there something I can do here?

Thanks

scottwis commented 8 years ago

You also need to copy the resource files and the custom build logic in the msbuild file.

Otherwise it won't work.

If you don't have the Visual C++ tools installed you will need to install them. The msbuild file needs the native resource compiler to compile the dialog resources used in customizing the Windows file dialog.

The Win32 API that opens the file dialog won't work if it can't find the resource id that is provided to it.

Sent from my iPhone

On Aug 23, 2016, at 7:33 PM, reubengann notifications@github.com wrote:

Hi, I imported OpenFileOrFolderDialog.cs, InteropUtil.cs, InternalErrorException.cs, and Util.cs into my Visual C# project, then following the example code, made a button and attached code `private void LoadFolderButton_Click(object sender, EventArgs e) { using (OpenFileOrFolderDialog folderBrowserDialog1 = new OpenFileOrFolderDialog()) { folderBrowserDialog1.AcceptFiles = false; folderBrowserDialog1.Path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); folderBrowserDialog1.ShowDialog(); }

}`

However, no window shows up. I traced the code, and as soon as the OpenFileOrFolderDialog constructor ends, the body of the using block is executed. There are no compilation errors or anything, just nothing shows up. I'm targeting .NET 4.5.2, if that matters. Is this a known limitation or is there something I can do here?

Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

dnagasree commented 7 years ago

Hi Iam also not getting the dialog I even copied res1.rc and resource.h.Still window not coming up

what is custom build logic in the msbuild file??

where I get it??

GarkGarcia commented 6 years ago

I also can't get it to open. I have an exact copy of your GitHub repository and I got the following error:

Error The command ""C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\\bin\rc.exe" /i "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\include;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include" /i "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\include" /r /fo "obj\Debug\res1.res" res1.rc" was closed with code 9009.

WindowsFormsApplication1.csproj 103

Also, I got the following in the output window:

"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\\bin\rc.exe"' is not recognized as an internal or external command, operable program or batch file

I tried locating the path to rc.exe so that I could fix it, but I couldn't find it (I still need to dig a little bit more thought). Do I need to install something I don't have?