|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Application Programming | |
reading/writing to the registry
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | |||||||||||||
|
PC Gamer
![]() |
hey guys,
im just starting out with programming so please bear with me ![]() what i want to be able to do is have a program that read a value in the registry this value will be the CPU temperature as reported by Everest. HKEY_CURRENT_USER\Software\Lavalys\EVEREST\SensorV alues\Value.TCPU Heres is the part i were i have no idea on how to do. i want this value to basically be converted into another number depending on the temprature range e.g < 40*C = 1 41-55 = 2 56-60 = 3 61-65 = 4 66-70 = 5 71-75 = 6 >76*C = 7 Basically a Microcontroler that i have programed will interpret these numbers and drive up to 24 RGB LEDs e.g 1=purple 2=blue 3=green 4=yellow 5=orange 6=red 7= red w/ white flash for .2seconds every second this will be my first step, afterwards i would be good to be able to have a choice to use the GPU temperatures (with a diferent range of temperature of course), or manual control what would be the best programming langage to do this with, and how would i go about converting the numbers.
Last edited by Du-z : 04-27-09 at 09:11 PM |
|||||||||||||
|
|
|
|
|
#2 (permalink) |
|
Case Modder
![]() |
Reading a Registry value and doing the conversion is trivial/easy. However, there's probably a whole lot of other "stuff" the application has to do (like communicate with the MC, polling/monitoring the Registry key for changes to its value, etc.) that help to determine the ease/appropriateness of the chosen language to write the application in. For starters, C#, C++ or Java would all probably work.
__________________
Rich Custom Wooden Case Builder
|
|
|
|
|
|
#3 (permalink) | |||||||||||||
|
PC Gamer
![]() |
thanks for the reply
rather than this program comunicating with the MC, the MC will comunitcate with the registry i.e it look at the registry read value then determine what pin need to have power aplied to it the MC will also have a Polling rate of 1-2 seconds. and it would need to monitor the regitry for changes every second or two also it would be good to beable to turn this off and have a manual colour control. the programming languge for this MC is a hybrid between C and C++
Last edited by Du-z : 04-28-09 at 05:10 AM |
|||||||||||||
|
|
|
|
|
#4 (permalink) | |
|
Case Modder
![]() |
Quote:
__________________
Rich Custom Wooden Case Builder
|
|
|
|
|
|
|
#5 (permalink) | |||||||||||||
|
PC Gamer
![]() |
sorry mate but i have no idea on how to do this, i'm a super newbie at this (read 1 day)
ive only ever done HTML and a bit of PHP
|
|||||||||||||
|
|
|
|
|
#6 (permalink) |
|
Case Modder
![]() |
This should help you get started.
Code:
#include <windows.h>
bool ReadEVERESTSensorValue(char* name, LPBYTE buffer, DWORD bufferChars)
{
HKEY key;
// TODO: Verify Registry key path.
LONG result = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Lavalys\\EVEREST\\SensorValues", &key);
if (result != ERROR_SUCCESS)
return false;
DWORD type;
DWORD charsRead = bufferChars;
result = RegQueryValueExA(key, name, 0, &type, buffer, &charsRead);
if (result != ERROR_SUCCESS) {
RegCloseKey(key);
return false;
}
RegCloseKey(key);
return true;
}
DWORD ConvertTemperatureToLEDNumber(DWORD temp)
{
// Simple, brute-force implementation...
if (temp <= 40) return 1;
if (temp >= 41 && temp <= 55) return 2;
if (temp >= 56 && temp <= 60) return 3;
if (temp >= 61 && temp <= 65) return 4;
if (temp >= 66 && temp <= 70) return 5;
if (temp >= 71 && temp <= 75) return 6;
return 7;
}
int main()
{
// Assuming the value is stored as a DWORD...
DWORD value;
bool success = ReadEVERESTSensorValue("TCPU", (LPBYTE)&value, sizeof(value));
if (success)
DWORD led = ConvertTemperatureToLEDNumber(value);
return 0;
}
__________________
Rich Custom Wooden Case Builder
|
|
|
|
|
|
#7 (permalink) | |||||||||||||
|
PC Gamer
![]() |
you little ripper, thanks mate.
Edit: the value the Everest puts out is a String Value not a DWORD, or to be more specific a REG_SZ
Last edited by Du-z : 04-29-09 at 06:24 AM |
|||||||||||||
|
|
|
|
|
#8 (permalink) | |
|
Case Modder
![]() |
Quote:
Code:
int main()
{
char value[16] = {0};
bool success = ReadEVERESTSensorValue("TCPU", (LPBYTE)value, sizeof(value));
if (success)
DWORD led = ConvertTemperatureToLEDNumber(atoi(value));
return 0;
}
__________________
Rich Custom Wooden Case Builder
|
|
|
|
|
|
|
#9 (permalink) | |||||||||||||
|
PC Gamer
![]() |
thanks mate, i can't see it in the code but is there a output into the registry?
|
|||||||||||||
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|