Here's a code I use (ignored error checking) to read two registry values, combine them and write them to a third one.

unsigned long type=REG_SZ, size=1024;
char iLike[1024]="";
char Apples[1024]="";
char iLikeApples[1024]="";
LONG rV;
HKEY hKey = NULL;

// reading the first value
rV = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE\\FARM\\ValueName1", 0, KEY_ALL_ACCESS, hKey);
rV = RegQueryValueEx(hKey, "Value1", NULL, type, (LPBYTE)iLike, size);
RegCloseKey(hKey);

// reading the second value
rV = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE\\FARM\\ValueName2", 0, KEY_ALL_ACCESS, hKey);
rV = RegQueryValueEx(hKey, "Value2", NULL, type, (LPBYTE)Apples, size);
RegCloseKey(hKey);

// combining values
[code?]

// writing the third value
rV = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE\\FARM\\ValueName3", 0, KEY_ALL_ACCESS, hKey);
rV = RegSetValueEx(hKey, "Value3", 0, REG_SZ, [parameter1?], [parameter2?]);
RegCloseKey(hKey);

Please tell me what I should put in the place of [code?], [parameter1?] and [parameter2?]
please do not advice me to use this or use that, if you want to help me just complete the code above.

Thank you VERY much for you help

Recommended Answers

All 6 Replies

People are not here to write your programs for you or do your homework. Hence we say "do this" or "do that" instead of giving out actual code.

The first thing you need to learn is how to use google and read MSDN. google for the function and you will find out for yourself what those parameters are. You have a brain just as good (maybe even better) than mine -- so learn to use it for something other than a hat rack.

Hey, take it easy pal, I didn't ask you to do my homework for me, neither did I ask you to give me a whole code, I just asked for a tiny missing part of my code I already written. I already searched MSDN and googled the net, nothing seems to want to work so I at last gave up and thought I better ask someone who is better than me in C++, and FYI I have only 1 month learning C++.

Could you please give me [code?], [parameter1?] and [parameter2?]

Thank you

For [code?] on line 19: why don't you just strcat the two strings together? Since you have not posted the contents of each of those strings and what you want the result to be, how in the hell do you expect me or anyone else to tell you what you have to do to combine them???

I thought the values are obvious

Value1="I like"

Value2="Apples"

But you know what? using words like "what the hell" is not a productive way in any discussion, so thank you I don't need your help anymore.. bye

How to combine then is also obvious -- just use strcat() to combin them.

>>using words like "what the hell" is not a productive way in any discussion,
This is an adult forum for adults -- so act like one and don't get that offended.

Thank you but I asked you above that I don't need your help anymore, will you be kind enough to stop replying on my thread, thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.