| Senith (21) | |||
|
I'm having an odd problem with this part of my code. I'm trying to read the system colors from the registry and if I try to read ActiveBorder, it returns the value from MenuBar, If I try to read ActiveText, it gets the value from MenuBar. and if I read Background and so on, it reads the correct values. For some reason when I try to read some of the Multie String values, it gets the value from another one with that key instead of the correct one. I'm using Windows 7 btw
If you change "ActiveBorder" to "InfoWindow" it will then return the correct value. This has me very confused. I've been fighting with this for the last couple of days Thank you | |||
|
Last edited on
|
|||
| bobdabilder (76) | |
I don't know what compiler you're using. try this: result = RegOpenKeyEx(HKEY_CURRENT_USER,L"Control Panel\\Colors",0,KEY_QUERY_VALUE,&hKey);then test for result. See what happens. your code returned 2 when I chopped it up. | |
|
|
|
| bobdabilder (76) | |||
also, I did this to output the value.
edit: the string isn't necessary, I was just funnin. | |||
|
Last edited on
|
|||
| kbw (5520) | |
| You're not passing in the type parameter. | |
|
|
|
| Senith (21) | |||||
|
Thank you bob, I'm using wxDevC++ and I tried the code and its still returning the wrong value. Every time I try to get the value for ActiveBorder, it gets the value from Menu instead. From AppWorkspace and down the list it gets the correct values. Its just having issues with the first 2 values and idk, it just keeps getting the value from the wrong key. I also tried the following:
and it outputs 0. I wasn't able to use the "L" as it gave the following error:
Thanks for your help Bob, I just don't know whats causing this. Its not like its doing it on all of them , like if I get the value of Menu, it return correct, and some other keys as well but when I try to read ActiveBorder, I get the value from Menu. If I try to read ActiveTitle I get the value from MenuBar. If I try to read Background, I get the correct value from Background, it only acts up with ActiveBorder and ActiveTitle | |||||
|
|
|||||
| bobdabilder (76) | |
|
kbw: the parameter type is optional in regqueryvalueex http://msdn.microsoft.com/en-us/library/windows/desktop/ms724911%28v=vs.85%29.aspx | |
|
|
|
| bobdabilder (76) | |
| Senith: the output of 0 for result is correct. that is no error. so reset result to 0 again and use it to check regqueryvalueex and make sure it's no error also. do a memset before each read to clear out your buffer. let me know if that helps. if not, post all of your code and we'll go back thru it. | |
|
|
|
| Senith (21) | |||
|
Here is the full code for the registry part. The rest of my code is just custom functions that I came up with that doesn't have anything to do with the registry. If you will still need it though let me know. Also I call it at WM_CREATE and if I try to read ActiveBorder, or ActiveTitle I get the wrong values. If its any other such as Menu or Background, its the correct value.
This was some code that I found online and I modified it some. I read though all the info for the functions and API's, I just don't know what can be causing it. Thanks everyone and thanks bob. | |||
|
Last edited on
|
|||
| kbw (5520) | |
| Without reading the type, you can't know how to interpret the buffer that comes back. | |
|
|
|
| bobdabilder (76) | |||
|
I've tried this on two different machines and it works fine. I'll try kbw's suggestion in a second. try this for now take out the L from my code
| |||
|
|
|||
| Senith (21) | |
|
I just tried your code bob and now its working. Thank you for your help and I have no idea why it was acting the way it was. Its all working now. Now its returning the correct values for ActiveBorder and ActiveTitle. I'm still stumped on while it was doing this. I'm using Windows 7 and wxDevc++, I don't know if any of that matters but it still bathers me. Everything is working now and if anything else comes up about this I'll let you all know. and again thank you bob and everyone else ^_^ | |
|
|
|
| bobdabilder (76) | |||
glad to hear it. this is my cleaned up code.
| |||
|
|
|||