-
how to edit the registry
I'm looking for someone who knows how to edit the registry values on the computer from your own program....
what i need to be able to do is have an install file that people can just run, it would probably only run in dos or something....but it would add the registry values to the registry so that all of my *.ost files would run with my OpenScript.exe program......
in other words, after installing it, you would be able to double click the *.ost files and they would run right through my interpreter, no matter where they are......
thanks in advance
-
You can use an INF File.
Or modify the registry using the Win32 API.
gg
-
>>> You can use an INF File.
You can, but you'd be better off not. This is old tech. Use the API functions.
-
Here's some code that you can modify to do what you need.
Code:
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
void AddRegistry()
{
HKEY hk, hklm;
DWORD iMyNumber;
char MyText[] = "Hello";
LONG rc;
rc = RegConnectRegistry(NULL, HKEY_LOCAL_MACHINE, &hklm);
rc = RegCreateKey(hklm, "SOFTWARE\\MYTEST", &hk);
RegCloseKey(hklm);
rc = RegSetValueEx(hk,"MyText", 0, REG_EXPAND_SZ, (LPBYTE) MyText, strlen(MyText) + 1);
iMyNumber = 50;
rc = RegSetValueEx(hk,"MyNumber1",0, REG_DWORD,(LPBYTE) &iMyNumber, sizeof(DWORD));
iMyNumber = 80;
rc = RegSetValueEx(hk,"MyNumber2",0, REG_DWORD,(LPBYTE) &iMyNumber, sizeof(DWORD));
RegCloseKey(hk);
return;
}
int main()
{
AddRegistry();
return 0;
}