i am working on a USB HID KEYBOARD device. i want to register the device for the notification whenever it gets attached and removed from the system. i want to register it for all windows operating system(for all 32 and 64 bits) starting from XP.
it's a proximity device. User configures the keystrokes from the application provided with the device. As soon as user gets away from the range of the device, the device fires the keystrokes that were configured and saved by the user in the device. The device don't have any keys in it. It just fires the keystrokes configured and saved in it. The device has just the sensor in it.
can anyone provide me the solution how to do register the device?? i am using HID.dll, SETUPAPI.dll and kernel32.dll for this purpose.
thank you for your answer.
I know how to create the CompilerResults and how to call a special method of the CompilerResults.
but I want to call a method as if no other method was called before it.
if I call a method of the assembly, for example foo(), which changes a static variable a, i want to call an other method, for example bar(), which is not affected of the change of the value of the static variable a.
do you know, what I mean. sorry for my bad english.
The statics of a class are executed once, at the first reference to said class. You can't undo that without unloading the class. The whole purpose of statics is to execute once.
And you can't unload a class, the only relevant thing you can unload is an AppDomain. So if you need a fresh class, you could load it in a separate AppDomain, use it, then unload the AppDomain. And again and again.
it's because of the compiler generated types, that have no relation with each other, says that for List<UsingGenericInterface> the compiler generates the type ListUsingGenericInterface and for List<IGenericInterface> they generates the type ListIGenericInterface. the types have no relation with each other and, although the ListIGenericInterface can have the same items than the ListUsingGenericInterface, they are not the same type, so they can't be assigned without a conversion, the compiler doesn't know about the interchangeability, so they doesn't generate one
sorry if my answer aren't so comprehensive, its because i'm a brasiliam and my english is poor
i guess that the compiler generates a interface from IEnumerable<IGenericInterface> and makes all types generated for types that implement IGenericInterface implement that interface, so they are interchangeable.
think like this:
you have a Class A that implements interface I, and a Class B that also implements that interface, you can't write:
A a = new A();
B b = new B();
a = b;
because, although they implement the same interface, they are not the same type.
i think the same concept can be applied to List<A> and List<I>, they are both types that implement IEnumerable<I>, but aren't the same type.
what i really need to search more it's this case:
public IList<IGenericInterface> GetStuff()
at this moment, i can't explain why it didn't work, but i'll discover
Let's take this question ... an interesting one ... into the "Twilight Zone:"
public IEnumerable<IGenericInterface> GetStuffX()
return (new List<UsingGenericInterface>()) as IEnumerable<IGenericInterface>;
public IEnumerable<UsingGenericInterface> GetStuffY()
return (new List<IGenericInterface>()) as IEnumerable<UsingGenericInterface>;
Why do these compile ?
"It is the mark of an educated mind to be able to entertain a thought without accepting it." Aristotle
"The as operator is like a cast operation. However, if the conversion is not possible, as returns null instead of raising an exception." link to the "as" operator in msdn[^]
so, what happens is that the compiler doesn't care if your conversion always returns null.
i'm trying to instal the .net sdk in this computer (don't have admin privileges) to disassemble a dll and see what code the compiler generates for List<IGenericInterface> and for List<UsingGenericInterface> but i suppose that the List<IGenericInterface> implements IList<IGenericInterface> and IEnumerable<IGenericInterface> while List<UsingGenericInterface> implements IList<UsingGenericInterface>, IEnumerable<UsingGenericInterface> and, given that UsingGenericInterface implements IGenericInterface, the List<UsingGenericInterface> also implements IEnumerable<IGenericInterface>
if this is the case, then i think it's a design flaw of the compiler, but i wont take precipitated conclusions.
Last Visit: 31-Dec-99 19:00 Last Update: 31-Jan-23 1:18