I'm a beginner to C++, I use CodeBlocks which I think is related to Ming so please make your answers pointing to C++ but not Visual C++. Thanks! And also, please ecplain things in detail ...
Well, after a long search on the net I found the code that looks through registry, gets information and prints it. What I want to do is to modify that program to do the same except not to print it, but to store gained information into an int. Then, add some extra text to the int and then finally use the system() function to execute that path. The program I've got so far:
#include <windows.h>
#include <iostream>
using namespace std;
int main()
{
HKEY hKey = 0;
char buf[255] = {0};
DWORD dwType = 0;
DWORD dwBufSize = sizeof(buf);
const char* subkey = "Software\\Unreal Technology\\Installed Apps\\Unreal Gold";
if( RegOpenKey(HKEY_LOCAL_MACHINE,subkey,&hKey) == ERROR_SUCCESS)
{
dwType = REG_SZ;
if( RegQueryValueEx(hKey,"Folder",0, &dwType, (BYTE*)buf, &dwBufSize) == ERROR_SUCCESS)
{
cout << "key value is '" << buf << "'\n";
}
}
cin.get();
}
How do I change this program to do the following: 1) Instead of printing the key value, store the information in an int. 2) Add at the end of this information the text: "System\Unreal.exe" so instead of being: "F:\Tolvuleikir\Full\FPS\Unreal Anthology\UnrealGold\" (which BTW is the value of the key), it would be "F:\Tolvuleikir\Full\FPS\Unreal Anthology\UnrealGold\System\Unreal.exe" && change the format to the C++ friendly executable format, "F:\\Tolvuleikir\\Full\\FPS\"\\Unreal Anthology\"\\UnrealGold\\System\\Unreal.exe" so I would then be able to do: system("Unreal") and it would know that I wanted to execute the path contained by the int "Unreal".
This might sound a bit confusing but I hope you understand me. Does anybody know how to do this? Any ideas very much appriciated even if they are not total answers!!
Thanks a lot!