|
Le Centriste wrote: It is too complicated, you would have to go through many pages, in many assemblies.
Le Centriste wrote: I have signed an NDA which prevents me giving you complete code, or I can get sued.
No, I wouldn't. I'm not asking for the complete code! Just the snippets that define the bloody objects involved!
How do I know the object class you wrote is decorated properly? I don't, and apparently, I can't find out. How do I know that the class exposes the WMI properties AS properties and not just public fields?? I don't, and again, I can't find out.
Le Centriste wrote: I create a ManagementScope object and connect it. (this object is reused, is this the problem?)
Nope. Scopes can be reused over and over. So can Searchers.
Le Centriste wrote: I perform a search and get a ManagementBaseObject from it
No, you don't. ManagementObjectSearcher.Get() returns a ManagementObjectCollection.
Le Centriste wrote: You know, if somebody would ask me "I am adding a row in a DataSet but it is not reflected in the database, what is wrong?" I wouldn't need the complete code from him to figure out that he did not save the DataSet.
For the 3rd time, I never asked you for the complete code!
|
|
|
|
|
Dave Kreskowiak wrote: No, you don't. ManagementObjectSearcher.Get() returns a ManagementObjectCollection.
Ok, I just take the first one, if the Count is superior to 0. I use GUIDs.
-----
Formerly MP(2)
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
You're basically asking us to diagnose a problem with the engine of a car, be we're not allowed to lift the hood, try and start it, listen to it, plug a diag module into it, ... nothing. How on earth are we supposed to solve this problem??
About the only thing we can do is point you at a tons of examples so you can compare the "little black box" you have to the examples and see if you can figure out what's wrong. Here's[^] what you're comparing it to.
|
|
|
|
|
Everything is working, I publish ojbects, I get objects back, and all. I can search, my events work.
So, it must be working. I am just asking for the reasons why this is not working. Btw, I don't get any exception.
Basically what I am asking "Do you know any reason why the SetPropertyValue would not working?". I can read the property, but cannot set it. That is all.
Please, if you don't know the answer, don't post another reply making me look like I am stupid. I don't need that.
-----
Formerly MP(2)
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
Le Centriste wrote: Basically what I am asking "Do you know any reason why the SetPropertyValue would not working?". I can read the property, but cannot set it. That is all.
Yes, about a dozen of them right off the top of my head. OK. We'll start with the most basic of problems.
Did you call the Put method on the ManagementObject after you called its SetPropertyValue ??
Le Centriste wrote: Please, if you don't know the answer,
How the hell is anyone supposed to know the answer?? Without seeing your code, we're all just guessing at what you got wrong or just plain missed!
|
|
|
|
|
I tried that, after casting the ManagementBaseObject to ManagementObject. I got a ManagementException saying that the provider does not implement this functionality.
I am starting to think that the default provider does not allow modifying properties.
-----
Formerly MP(2)
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
Yep, that won't work. ManagementObject is outside the inheritence path of your class. Your class is a sister to ManagementObject.
Curious...why didn't you just inherit from ManagementObject in the first place?
|
|
|
|
|
I inherited from BaseObject, as the documentation says. It does not talk about anything else (except for events).
-----
Formerly MP(2)
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
From the MSDN documentation:
Instrumented applications cannot expose writeable properties on new classes that are not wrappers of underlying unmanaged WMI classes.
A user of a class created by an instrumented application cannot change instance data and then write the data back using a Put operation.
I think I will have to create my classes using something else than the .NET way if I want to have writable properties. It seems to be the same for methods:
Managed code providers cannot define methods.
Yes, I tried using a method.
-----
Formerly MP(2)
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
Yep. I found the same thing in several places. This is something new I didn't know and didn't expect given the documentation on the Management namespace.
It looks like you can only generate ReadOnly properties for a WMI class under .NET. How useless!
Sorry about the rest of the crap I gave you. Usually the coder misses something simple and doesn't realize it. They go 'round and 'round, and when they finally post the code, wallah! Something that could have been solved in 5 minutes. It's all too common.
|
|
|
|
|
Dave Kreskowiak wrote: Sorry about the rest of the crap I gave you. Usually the coder misses something simple and doesn't realize it. They go 'round and 'round, and when they finally post the code, wallah! Something that could have been solved in 5 minutes. It's all too common.
No hard feelings
-----
Formerly MP(2)
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
You get my 5 for perseverance...
|
|
|
|
|
Moi, je te donne 1 pour ton incompréhension à comprendre le problème.
-----
Formerly MP(2)
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
Le Centriste wrote: incompréhension à comprendre
|
|
|
|
|
Je voulais dire "incapacité". Mauvais choix de mots.
En passant, tu liras la fin du thread et tu comprendras pourquoi ce n'était pas nécessaire de poster le code complet.
-----
Formerly MP(2)
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
For the umptiest time, no one asked for the complete code, just the relevant code.
BTW the majority of people in Belgium speak Dutch, not French.
(and most of them know French sufficiently to spot mistakes)
|
|
|
|
|
I thought most people in Belgium spoke Flemish...
-----
Formerly MP(2)
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
Hello,
I'm trying to get the mime type of a file like (application/msword)
that determine the application that will open this file and its extension but I can't do it in my windows app.I want to know how to get the type of a file and how to get the extension from this type.
Thanks.
Dad
|
|
|
|
|
If you are just trying to open the file up, use the following code and Windows will do the work for you with any registered mime type.
I use this to open up .PDF files saved in the database automatically.
System.Diagnostics.Process.Start(file name here);
Hogan
|
|
|
|
|
Great thanks,
but I want to send the mime type to a server that running a file net engine that require the mime type like we do in web apps by using the file upload control ,this is the first part the second is I want to get the extension when I get the file back from the server to write it to the client hard desk by its right extension.
I need help in this .
thanks.
Dad
|
|
|
|
|
I have a program that loads in a large image (14000x10000 pixels) & resizes the image to fit on the screen. Once it is resized I track the pixel that the mouse is over. This is reported back as the actual location on the screen (somwhere within the 1280x1024 of the screen resolution). I would like to know how to get the actual location within the larger image.
Any thoughts?
Thanks
R.Myers
|
|
|
|
|
Just multiply the coordinates with the same scale that you used to shrink the image.
---
single minded; short sighted; long gone;
|
|
|
|
|
If you select one pixel on your screen, the corresponding location on the original
image would be an entire rectangle with approx dimensions of 12*14; its location
can be found as Guffa already explained, as well as its exact size.
|
|
|
|
|
Thanks Luc & guffa.
I think that'll work. (It looks pretty obvious when you said it )
R.Myers
|
|
|
|
|
[I thought I had found my answer earler so I had deleted the other post, but I didn't.]
I am working with data where records are stored in big and little endian.
For example a file has:
16 fields some are intergers and some a doubles and half are stored in big
and the other half in little.
I know that my system should be in a little endian state but..
How do I convert from big to little and little to big?
God Bless,
Jason
DavidCrow wrote: It would not affect me or my family one iota. My wife and I are in charge of when the tv is on, and what it displays.
I do not need any external input for that.
|
|
|
|