|
I was using This Code...
//---Code---//
ManagementObjectSearcher mySearcher = new ManagementObjectSearcher("root\\WMI","SELECT * from Win32_TemparatureProbe");
foreach (ManagementBaseObject obj in mySearcher.Get())
{
if (obj == null)
{
label1.Text = "didn't find";
}
else
{
label1.Text = obj["Accuracy"].ToString ();
}
}
//---Code End---//
But No RESULT.
Plz me code for How to Get HardWare Information from CPU like Temparature,Voltage,FanSpeed. code in .Net
Thanks
Madhu.T
|
|
|
|
|
WMI wont get you there. I dont know what will either though.
|
|
|
|
|
You get much better results when you spell Temperature correctly
ManagementObjectSearcher mySearcher = new ManagementObjectSearcher("SELECT * from Win32_TemperatureProbe");
Also, maybe see the Win32_Processor WMI class for voltage info.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm continuing my quest to get rid of magic strings to identify members. This is so the compiler can check more deeply and to avoid problems with obfuscators.
I've come up with this, but it seems more like a kludge than a hack. Has anyone got any bright ideas?
Thanks
Nick
class TestFirstClassMembers
{
static readonly Module sModule = Assembly.GetExecutingAssembly().GetModules()[ 0 ];
internal static void Test()
{
Trace.WriteLine( "\n\nTestFirstClassMembers" );
var mi = new Member( ( Func<Class, int> ) ( o => o.Field ) );
var ml = new Member( ( Func<Class, long> ) ( o => o.FieldLong ) );
var ms = new Member( ( Func<Class, String> ) ( o => o.FieldString ) );
var mp = new Member( ( Func<Class, int> ) ( o => o.Property ) );
var mf = new Member( ( Func<Class, int> ) ( o => o.Function() ) );
var mm = new Member( ( Action<Class, int, string> ) ( ( o, i, s ) => o.Method( i, s ) ) );
}
class Class
{
public int Field = 0;
public long FieldLong = 0;
public String FieldString = String.Empty;
public int Property { get; set; }
public int Function() { return 0; }
public void Method( int i, string s ) { }
}
class Member
{
public Member( Delegate d )
{
MethodBody body = d.Method.GetMethodBody();
byte[] il = body.GetILAsByteArray();
for ( int i = 0 ; i < il.Length ; i++ )
{
switch ( il[ i ] )
{
case 0x6F:
case 0x7B:
{
int token = BitConverter.ToInt32( il, i + 1 );
var m = sModule.ResolveMember( token );
Trace.WriteLine( m.ToString() + ": " + m.Name + " " + m.GetType().ToString() );
}
break;
}
}
}
}
}
----------------------------------
Be excellent to each other
|
|
|
|
|
Nick Butler wrote: I'm continuing my quest to get rid of magic strings to identify members. This is so the compiler can check more deeply and to avoid problems with obfuscators.
I've come up with this, but it seems more like a kludge than a hack. Has anyone got any bright ideas?
What are you trying to do? Specifically with the MethodBody.
|
|
|
|
|
Thanks for replying leppie. I was hoping you might help.
I want to specify any member of a class in a way that the compiler can check. For instance, this is not acceptable because it will not work if you rename the field, or even "Find all references".
var fi = typeof( Class ).GetField( "Field" );
So, I thought I could use a lambda which I can pass as a delegate that the compiler can check. The code in the lambda must be just a call the the member you want to specify. The only way I can think of to get at the code is to look at the IL.
I may well be barking up the wrong tree, but I can't think of a neater way...
----------------------------------
Be excellent to each other
|
|
|
|
|
Nick Butler wrote: I may well be barking up the wrong tree, but I can't think of a neater way...
I think I understand (but not really completely), but your way is neat within the context
|
|
|
|
|
Thanks.
I think what I'm trying to do is make all members first-class objects like in Smalltalk. Maybe I should just change language...
----------------------------------
Be excellent to each other
|
|
|
|
|
Maybe
|
|
|
|
|
I want to create a program that launches when I hit some combination of keys e.g. <ctrl> + 1.
My goal is to let a copy operation <ctrl> + c to be pasted into a file for e.g. c:\file1.txt no mater from which program the user is copy information from.
_____________________________
...and justice for all
|
|
|
|
|
d00_ape wrote: let a copy operation <ctrl> + c to be pasted into a file
I think you are trying to steal sensitive information with out informing the user.
*jaans
|
|
|
|
|
|
You can add a shortcut key to the item in the start menu, but that is limited to alt+ctrl key combinations.
Why not let the program run in the background and register a hotkey to catch the key combination?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Yes that is what I want to do!
The best solution would be that when I press for e.g. ctrl + c the selected text (no matter program) copies the information to the clipboard ant print it to a file.
But if I need to press ctrl + c and then ctrl + alt + c to make this possible I would also be ok.
_____________________________
...and justice for all
|
|
|
|
|
Hello dear experts,
I am trying to automate the powerpoint 2003 application using C# and Microsoft Powerpoint Object Library 11.0 but MSDN and Dev Center are lacking the documentation for this COM library. We have a few articles in CodeProject and they are good for the beginning but I believe I still need the SDK for the library. My google searches also turned me down. Any suggestions?
Thank you,
Regards,
Always keep the Murphy Rules in mind!
|
|
|
|
|
Hi,
I want find total number of circles in one line and it's position from the scanned image using ocr with modi.
So, help me about that.
|
|
|
|
|
If its a line, then it cannot contain circles.
krinaljariwala wrote: So, help me about that.
This sounds like a demand, which usually gets no help. Maybe you should say "Can you please help me with that?"
Can you explain more about what you are trying to do?
|
|
|
|
|
The Hough Transform (http://en.wikipedia.org/wiki/Hough_transform[^]) is perfect for finding circles and lines in an image. It even works if the image is noisy, i.e. random errors, uneven lighting, or missing/overlapping pieces!
|
|
|
|
|
What c# code do I use to get the status of hyperthreading on the machine i.e. on or off ?
Thanks
|
|
|
|
|
You will probably get that with cpuid() and/or assembler. Asking in the C/C++ forum.
|
|
|
|
|
Check out the WMI Win32_Processor class.
From the Win32_Processor class docs:
"To determine if hyperthreading is enabled for the
processor, compare NumberOfLogicalProcessors and
NumberOfCores. If hyperthreading is enabled in the
BIOS for the processor, then NumberOfCores is less
than NumberOfLogicalProcessors. For example, a dual-
processor system that contains two processors enabled
for hyperthreading can run four threads or programs or
simultaneously. In this case, NumberOfCores is 2 and
NumberOfLogicalProcessors is 4."
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am reading a pdf file in my application using pdfbox. The reading works fine but I need to read specific portions instead of the whole text.
Any idea is welcome
a novice
|
|
|
|
|
Ofori Boadu wrote: I am reading a pdf file in my application using pdfbox
Well, cant't really help you as it totally depends on the implemtation of PDFBox. try to look at it documentation
|
|
|
|
|
Hi there,
Got a strange problem here...
Basically, our application sends out an email with a custom X-Header. On the dev box, the header comes out in mixed case (eg "X-EmailID"), but when we move the app to the live box, the header in the email is converted to lower case (e.g. "x-emailid")
I need to keep the capitalisation. Has anyone seen this before, and did you find a solution?
I've googled this but haven't found much, other than people saying they have seen the problem but no fix - there has to be some config that is different between the two boxes, surely!?!
Any help greatly appreciated
Baz
|
|
|
|
|
Try to use the System.Web.Mail classes, which make use of Microsoft's Collaboration Data Objects to send emails. Ignore compiler's warning messages for obsolete classes.
SkyWalker
|
|
|
|