system() codes

closed account (9wX36Up4)
in cmd you can change a reg_sz with writing
reg add HKCU\Control" "Panel\Colors /v Window /d 255" "255" "255 /f

but in c++ i wrote that one it worked
system("reg add HKCU\\Control\" \"Panel\\Colors /v ActiveBorder /d 180" "180" "180 /f");

and my question is
system("reg add HKU\\.DEFAULT\\Control\" \"Panel\\Colors /v ActiveTitle /d 153 180 209 /f");
why the last one is not working is the proglem .DEFAULT
Last edited on
My first thought is that one tries to modify "HKCU" which is the user that is currently logged in which you would have permissions over by default. You may not have permissions over the default user.

Which version of Windows is this?

Why aren't you using "RegOpenKeyEx()" and "RegCreateKeyEx()"?
closed account (9wX36Up4)
windows 7 7600

i don't think the problem is the permission

and i guess the problem is . for example:
1
2
3
4
5
6
7
8
9
10
#include<iostream>
#include<windows.h>

using namespace std;

int main(){
system("reg add HKCU\\Control\" \"Panel\\Colors /v ActiveBorder /d 180" "180" "180 /f");
system("reg add HKU\\.DEFAULT\\Control\" \"Panel\\Colors /v ActiveTitle /d 153 180 209 /f");
system("pause");
}

and the output is something like
proceed succeed
error:invalid syntax
push a button to continue
it might be wrong because i m not using english windows and i translated it sorry if it's wrong
Last edited on
This is my preferate registry class to work with the windows registry, using RegOpenKeyEx() and RegCreateKeyEx() directly can be very frustating sometimes:
http://code.google.com/p/cregistry/source/browse/trunk/?r=2
closed account (9wX36Up4)
thankx for help what a stupid i m
i didn't see ActiveTitle /d 153 180 209 /f"); mistake
Does the command work if you run it from a batch file?

EDIT: Alternativley, since it is a command prompt shell run on Windows 7, right click on the compiled executable and select "Run as Administrator" from the drop down box to confirm privilege elevation.
Last edited on
Topic archived. No new replies allowed.