Sign in to follow this  
Jnz86

[.net] FolderBrowserDialog not working

Recommended Posts

Jnz86    228
Hi, i use the following code to ask user for folder:
FolderBrowserDialog* fb = new FolderBrowserDialog();
System::Windows::Forms::DialogResult res = fb->ShowDialog();

if (fb != DialogResult::OK)
   return;

And this is what i get: Well, as you can see it doesn't work. Maybe someone had similar problem ? And btw, i checked the msdn... [Edited by - Jnz86 on July 19, 2005 8:43:58 AM]

Share this post


Link to post
Share on other sites
jods    367
I remember seeing this before. It's a known bug.

Unfortuneately for you, I don't remember the whereabouts, but I'm sure you'll find the answer quite easily with google.

Regards,
jods

Share this post


Link to post
Share on other sites
ernow    732
The Folderbrowser dialog is a very special dialog for two reasons:
1. It needs special security permissions. So if your code is not running under Full trust (use caspol.exe -rsg to find out about that) you might need to assign the file/folderbrowser permission to your app.
2. It is an ActiveX (COM) control that needs the [STAThread] attribute on the main thread. (Did you remove that???)

Cheers

Share this post


Link to post
Share on other sites
Jnz86    228
Quote:

2. It is an ActiveX (COM) control that needs the [STAThread] attribute on the main thread. (Did you remove that???)


my WinMain looks like this:


System::Threading::Thread::CurrentThread->ApartmentState = System::Threading::ApartmentState::STA;

Application::Run(new ptIDE::FormIDE());



so if i understood well the STAThread attribute is OK, right? (Sorry I am new to .NET)

Quote:

1. It needs special security permissions. So if your code is not running under Full trust (use caspol.exe -rsg to find out about that) you might need to assign the file/folderbrowser permission to your app.

I need to check that...

Share this post


Link to post
Share on other sites
ernow    732
Your STA attribute seems to be ok.

Are you running from a (mapped) network drive a share or something like that?

Cheers

Share this post


Link to post
Share on other sites
Jnz86    228
Quote:

Are you running from a (mapped) network drive a share or something like that?

No, i am running locally on my PC.

Share this post


Link to post
Share on other sites
Jnz86    228
Quote:

1. It needs special security permissions. So if your code is not running under Full trust (use caspol.exe -rsg to find out about that) you might need to assign the file/folderbrowser permission to your app.


Tell me more about it, maybe it's the problem...
Also, maybe you know some kind of link, or smthing which can help me :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this