473,395 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 |
BindingFlags.NonPublic);
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
System::Globalization::CultureInfo("en-US",false));

//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?

-=Chad=-
Feb 9 '06 #1
1 1455
Chad,

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
extensible.

Anyway, see this post for more details and the download link:
http://msdn.microsoft.com/newsgroups...8d0&sloc=en-us

-- Tim Scott
http://geekswithblogs.net/tscott
Feb 9 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Flare | last post by:
Hi. In extension to my former qustion about the command pattern (wich im still interested in) i´ve tried to implement the Servlet with reflection. My idea is, to create a new class wich inherit...
3
by: Ken Durden | last post by:
Hey, I posted this a few months ago and got completely off-the-chart responses. At the time I wasn't using reflection very much, but more and more I find myself wanting to use it to write...
4
by: Picho | last post by:
Hi all, Using reflection, I can invoke/call private methods of an object. is this intended? if yes, why? in what scenario (example would be good) should I be givven the option to use...
2
by: Jason | last post by:
Hello, I"m trying to invoke a method using reflection on a DLL that is already within a project. However, I"m having a few problems and didn't know if anyone has any bright ideas. Please note,...
6
by: Andrew Robinson | last post by:
assuming that I have a class public class MyClass { public string FirstName { get {...} set {...} } } how can I assign the FirstName property using reflection on a generic class
4
by: Per Bolmstedt | last post by:
(This question has been asked previously in this group, but I don't think it was ever really properly answered.) I want to use reflection - preferably - to find all Web Forms in my web site that...
7
by: Paul Hadfield | last post by:
Hi, I'm running into one problem with trying to call "Type.GetCustomAttributes(...)" on my reflected code. Basically - I can't trap my own custom attribute - I can only catch / identify system...
4
by: =?Utf-8?B?QWJoaQ==?= | last post by:
I am using Reflection to invoke methods dynamically. I have got a special requirement where I need to pass a value to method by setting the custom method attribute. As I cannot change the...
11
by: Joe | last post by:
Hi all! I have an application which uses plug-ins. The plug-ins implement an interface. I have a case where 1 plug-in needs access to the an object of the calling application. I could create an...
6
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Hi I am slightly familiar with reflection but have never done the following I know how to find a class and call but I haven't done the following The Method return a List of Another Class And...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.