470,810 Members | 1,456 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,810 developers. It's quick & easy.

Reflection Issues

I've got everything going nearly except one line of code. I think I'm in
over my head here so, I'm going to ask for some help.

Basically what the preposal is that you will be able to open a folder browse
dialogue with a root other than those specified in
Environment::SpecialFolders::. and I'm hoping that I would be able to
specify network as the root and the defaultpath as the usersdomain much like
it is done on mstsc.exe (RDT)

Only one snag I can't get this line of reflection code to pan.

I got this code reference and I've tried to put into C++.

FieldInfo fi = t.GetField("rootFolder", BindingFlags.Instance |
fi.SetValue(fbd, (System.Environment.SpecialFolder) csidl);

Type * t = fbd->GetType();

FieldInfo * fi = t->GetField("rootFolder",
((BindingFlags)(BindingFlags::Instance | BindingFlags::NonPublic)));

//This line didn't always used to be so nasty but it basically all
comes down to the fourth argument

// fi->SetValue(fbd, S"rootFolder",
((BindingFlags)(BindingFlags::Instance | BindingFlags::NonPublic)),
(System::Environment::SpecialFolder) csidl, new

//fi->SetValue(fbd, (System::Environment::SpecialFolder) csidl );

This line returns the error:

error C2664: 'void System::Reflection::FieldInfo::SetValue(System::Ob ject
__gc *,System::Object __gc *)' : cannot convert parameter 2 from
'System::Reflection::BindingFlags' to 'System::Object __gc *'

refer here for complete reference code.

I need to know if this is all in vein or can it be done!
If so is this the right approach?

Feb 9 '06 #1
1 1253

This isn't an answer to your exact question, but it might be helpful if you
don't get it answered.

Another option for you (worst case) would be to write your own folder browse
dialog. Then you could make it have any behaviour you want.

On another thread, someone was asking about a folder browse dialog that
would let you browse folders on a remote system. Anyway, it sounded like a
fun bit of code and I wrote up a quick prototype folder browse dialog. It
begins to replicate the functionality of the standard folder browse dialog.
You could extend it to show whatever you wanted as root and items.

It's not usually good to write your own when you should be able to extend
off of something. Unfortunately, the folder browse dialog is not very

Anyway, see this post for more details and the download link:

-- Tim Scott
Feb 9 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Flare | last post: by
4 posts views Thread by Picho | last post: by
2 posts views Thread by Jason | last post: by
6 posts views Thread by Andrew Robinson | last post: by
4 posts views Thread by Per Bolmstedt | last post: by
11 posts views Thread by Joe | last post: by
6 posts views Thread by =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.