|
Hi,
In VS 2005 I am using Reflection to parse .Net System libraries. Using GetMembers(BindingFlags) returns some additional methods other what is defined in the interface/class in .Net system library. For filtering out I am using following BindingFlags combination
BindingFlags::Public | BindingFlags::Instance | BindingFlags::Static | BindingFlags::DeclaredOnly
I am trying to get the declared members in class/interface say for example System.Collection.ICollection which has following 4 members:
int Count { get; }
bool IsSynchronized { get; }
object SyncRoot { get; }
void CopyTo(Array array, int index);
However using GetMembers I get following 7 members:
int Count { get; }
bool IsSynchronized { get; }
object SyncRoot { get; }
void CopyTo(Array array, int index);
int get_Count();
bool get_IsSynchronized();
object get_SyncRoot()
I get extra 3 get methods corresponding to each property. How do I suppress or filter out these additional members?
~Manish
|
|
|
|
|
A property is just a declaration which specifies the get and set methods.
Either use GetMethods or take a look at the MemberInfo, theres a whole bunch of info exposed there that you can use for filtering.
|
|
|
|
|
Hi there
I would like to be able to stop all text in a ComboBox from being automatically selected when I tab into a it (it has DropDownStyle of DropDown).
Currently, I check for KeyUp event, and select the text I want to select, rather than the whole lot. This still has the effect of all text being selected temporarily until the tab key is released. Is there any way to suppress the SelectAll behaviour?
Thanks in advance
Paul
One day I want to be a code monkey. Right now, I'm more like a code amoeba...
|
|
|
|
|
Instead of using KeyUp, try wiring Enter or GotFocus event and deselecting the text.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Thanks Mika, GotFocus solved it. Enter occurs before the SelectAll, otherwise I would have used that. Never knew about GotFocus though, so awesome result!
Cheers
Paul
One day I want to be a code monkey. Right now, I'm more like a code amoeba...
|
|
|
|
|
You're welcome
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Hello,
I am developing a client and server application for bluetooth devoce. My server is desktop PC which has dongle attached and client will be Windows Mobile. As client server get connected server will send to client list of some files. from the client side i should be able to download file means copying file from server to client. I am using sockes for eastablise connections. Now i have to send a file from server to client. How can i send a file? Please help me.
Thanks and regards,
Yudhisthira attry(India, Bangalore)
|
|
|
|
|
|
Hi,
i want to show the windows File Association form when user presses a button. I use the following code:
Imports System.Runtime.InteropServices
Public Declare Auto Function OpenWithDialog Lib "shell32.dll" Alias "OpenAs_RunDLL" (ByVal hwnd As IntPtr, ByVal hinst As IntPtr, ByVal lpFile As String, ByVal nShowCmd As Int32) As Int32
Private Sub button_ItemClick(...)
OpenWithDialog(Me.Handle, Marshal.GetHINSTANCE(Me.GetType().Module), "", CInt(AppWinStyle.NormalFocus))
End Sub
Well, it opens a similar form, the "Open With..." form, but i am not looking for the Open With... form. I imagine that i have to make 1-2 changes and after that then it will really open the File Association form(Set Association - Associate a file type or protocol with a specific program).
Any idea what i need to change on this so it work?
Thanks in advance
|
|
|
|
|
|
Hi all..
I need to change a class inheritance at runtime. Specifically I need to change the Control class to inherit from a MyControl class instead of the Component class.
I've been searching for ways to do this. I come across with Reflection.Emit, Profiling API, some code injection tools, but I am still very confused on how to do this. Is there any other way to do this?
Has anyone here have tried to do something similar? If so what techniques have you used?
Thanks,
José Tavares
|
|
|
|
|
In this instance, you can't change the inheritance chain. To do this, would require you to implement the features that the class is relying on from the base class. There are cases where you can appear tochange the inheritance chain, but this behaviour has to be coded in from the start. When you think about it, from a security standpoint, it would be a bad idea to change the behaviour because you could change the implementation to inherit from insecure/dangerous code, and would you really want this if you were a user?
|
|
|
|
|
I understand that and had thought about it already but it would be very helpful for me
Another hypothesis is to change the assembly to reflect this change. Can I change the System.Windows.Forms assembly with this changes (injecting the class into the assembly). If I use this assembly in the directory of the application would the compiler try to load it before it goes to GAC?
I've come across with an application RAIL (http://rail.dei.uc.pt) but it's no longer supported. Do you know any similar tool that allows me to change an assembly?
Thanks,
José Tavares
|
|
|
|
|
The only thing I can think of would be mono.cecil. It might help, but I haven't done enough with it to be sure.
|
|
|
|
|
I gave Mono.Cecil a try and was able to change the BaseType of Control to MyControl instead of Component.
The problem now is that I do not want to replace the System.Windows.Forms.dll in the GAC. I would like to use the new dll in the bin directory of my application. But it seems to be always loading the one in the GAC. Is this somehow possible?
|
|
|
|
|
jpsstavares wrote: I need to change a class inheritance at runtime.
Maybe you do and maybe you don't. Since you did not provide requirements I can only doubt your conclusion. It is far more likely that you need a different design.
led mike
|
|
|
|
|
You're right I forgot to mention that.
I'm doing a test suite to test application's GUIs and one problem to do this is the identification of components. You may have Controls with the same name, with the same automation ID, so there is no unique identifier to a Component that identifies it over different executions and different versions of the software.
The idea is to add an ID to the Control class that would automatically be created and that would allow me to identify controls (I want to add other things but this is my main reason).
Thanks
|
|
|
|
|
jpsstavares wrote: I'm doing a test suite to test application's GUIs
Ok, that explains a lot. Good luck, way outside my area of knowledge.
led mike
|
|
|
|
|
Hi,
Controls have a Tag property that normally is not used at all (by the Control
itself), i.e. it is reserved for the user, so he can attach an object of his
choice. Maybe that is sufficient to solve your identification problem?
|
|
|
|
|
jpsstavares wrote: I'm doing a test suite to test application's GUIs
There are already programs out there that accomplish this. We use QA Wizard Pro[^] from Seapine. Granted, it's not cheap (most programs like this aren't), but it does it's job quite well. Also, their support staff is the most helpful customer support I've ever dealt with.
Brandon
|
|
|
|
|
If they are visual controls, the HWND should be unique for each control.
|
|
|
|
|
Pete O'Hanlon wrote: If they are visual controls, the HWND should be unique for each control.
Yes but they are unique in each execution of the application. But for each test case the application is launched and closed so I cannot use the HWND...
|
|
|
|
|
But you could, if you reacquired the HWND whenever the app was launched. You know the controls you want, and you can hook in and get the HWND when it runs.
|
|
|
|
|
Dear All,
I have a windows application and I have created a setup in Intel System.
When it is installed in the client machine which has AMD processor it is installed successfully, but when clicking on the exe it is giving and error and it is not working.
Then i tried to reproduce it in out environment which has the AMD processor. I faced the same issue and then installed VS 2005 in that system and created the setup and tested the same in the AMD and Inter processor systems it worked well.
Then I gave the same setup to the client and the client is facing the same issue and it throws an error and the application is not opening.
Have any one faced the same issue?
Can any one tell me how to get rid of this?
Thank you a lot in advance.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
M. J. Jaya Chitra wrote: Have any one faced the same issue?
Probably. I have not.
M. J. Jaya Chitra wrote: Can any one tell me how to get rid of this?
Sure. Fix the bugs in your code.
If you need help, be more specific. What AMD processors do fail, and
what Intel processors do succeed in running your code?
And what is your application, what languages and tools did you use, what
fancy stuff is in there?
Could it be those AMDs are multi-core and those Intels are single-core,
implying you have a thread synchronisation problem?
Could it be you are using assembly instructions that exist on AMD but not
on Intel (as in the SIMD instruction sets, which are quite different)?
|
|
|
|