Connect registry via C++
Page 1 of 1
Connect registry via C++
Since a long time I am searching out a program with which I may access registry files through a C++ program. Rather it was a quite typical job to do but finally I found out with this final result. So enjoy this.
#include <windows.h>
#include <iostream>
using namespace std;
int main () {
HKEY keyHandle;
char rgValue [1024];
LPCTSTR regPath = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0";
LPCTSTR regReq = "FeatureSet";
DWORD size1 = sizeof(rgValue);
DWORD Type;
if( RegOpenKeyEx(HKEY_LOCAL_MACHINE, regPath,0, KEY_QUERY_VALUE, &keyHandle) == ERROR_SUCCESS) {
RegQueryValueEx( keyHandle, regReq, NULL, &Type, (LPBYTE)rgValue,&size1);
}
RegCloseKey(keyHandle);
std::cout << "Returned: -->" << rgValue << "<-- (at least I think so) \n\n";
system("Pause");
}
#include <windows.h>
#include <iostream>
using namespace std;
int main () {
HKEY keyHandle;
char rgValue [1024];
LPCTSTR regPath = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0";
LPCTSTR regReq = "FeatureSet";
DWORD size1 = sizeof(rgValue);
DWORD Type;
if( RegOpenKeyEx(HKEY_LOCAL_MACHINE, regPath,0, KEY_QUERY_VALUE, &keyHandle) == ERROR_SUCCESS) {
RegQueryValueEx( keyHandle, regReq, NULL, &Type, (LPBYTE)rgValue,&size1);
}
RegCloseKey(keyHandle);
std::cout << "Returned: -->" << rgValue << "<-- (at least I think so) \n\n";
system("Pause");
}
andry- Moderator
- Posts : 467
Join date : 2010-05-07
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|