PDA

View Full Version : Processor based direction



synistics
02-17-2004, 08:20 PM
Total newbie to all of this, so diving into the deep end.

I need to be able to grab the processor speed from the system so that I can tell viewers that they are below a threshold CPU and may find issues with the video/audio sync.

result = Registry.GetValueType(HKEY_LOCAL_MACHINE, "HARDWARE\DESCRIPTION\System\CentralProcessor\0\~MH z ", "Mhz");
DecimalValue = tonumber(result, 16)
Dialog.Message("Your processor","CPU"..DecimalValue.."Mhz",MB_OK, MB_ICONINFORMATION);


if DecimalValue < 4294967294 then

Dialog.Message("Notice","Your processor blah blah blah, and a lot more blah", MB_OK, MB_ICONINFORMATION);
end

I tried the set up from another thread in here and it just always returned me a value of 1
http://www.indigorose.com/forums/showthread.php?s=&threadid=5588&highlight=processor


It is going into the business community, focused at smalled business, which on times will be CPU challenged.

Help will be greatly appreciated.

TJ_Tigger
02-17-2004, 09:39 PM
It looks like you use the Registry.GetValueType and not Registry.GetValue action. Type "1" is Reg_sz.

synistics
02-17-2004, 10:11 PM
Tried your variations, but let's go back to your original thread, when I plug in your coding it always gives me a value of one.

This particula one that I pasted in always returns a constant number whether I stick it in a 2 gig or an old 166, so I know that is not working

TJ_Tigger
02-17-2004, 10:22 PM
Here try this.

processorspeed_hex = Registry.GetValue(HKEY_LOCAL_MACHINE, "\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\ \0\\", "~MHz", true);
Dialog.Message("Processor Speed", "The speed of your processor is "..processorspeed_hex, MB_OK, MB_ICONNONE, MB_DEFBUTTON1);

synistics
02-17-2004, 10:28 PM
Plugged it in no value

OS is XP

CPU AMD 2.0


just comes back blank

Stefan_M
02-18-2004, 05:30 AM
result = Registry.GetValue(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", "~MHZ", true);


Stefan

TJ_Tigger
02-18-2004, 07:56 AM
Originally posted by synistics
Plugged it in no value

OS is XP

CPU AMD 2.0


just comes back blank

I don't know if it helps, but I should have posted my code like this


processorspeed_hex = Registry.GetValue(HKEY_LOCAL_MACHINE, "\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\ \0\\", "~MHz", true);
Dialog.Message("Processor Speed", "The speed of your processor is "..processorspeed_hex.." MHz", MB_OK, MB_ICONNONE, MB_DEFBUTTON1);

or the project like Stefan_M did. This works on my Windows 2K machine, but I am not near an XP machine to test the app.
Have you checked your registry to ensure that the path is correct and the data exist as typed into the code above?

synistics
02-18-2004, 09:04 AM
Well three tries, and by 4am I had this worked out.

processor = Registry.GetValue(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0 \\","~Mhz", true);
Dialog.Message("Processor Speed","CPU is a ".. processor.." processor" , MB_OK, MB_ICONNONE, MB_DEFBUTTON1);
DecimalValue = tonumber(processor, 16)
if (DecimalValue)< 4294947296 then
Dialog.Message("Notice","Your processor may cause some this presentation ..........'No Sound'", MB_OK, MB_ICONINFORMATION);
end

When taken from machine to machine it works to a point.98 machines of coure are not giving me everything, I guess my stumble point was the if then on the processor speed. Using the straigh value from 'processor' it gave me argument of string versus number. So using your decimal value I played until I just came up with a number that would return me a response that would pop the message up.

There has to be a more dynamic way to drive the message rather than having a fixed value there.

Intrigued
02-18-2004, 12:38 PM
Thank you for asking this question!

Another piece of Registry/APMS information that will come in handy from time to time.