I thought this topic would answer my question, unfortunately it didn't: http://forums.wxwidgets.org/viewtopic.php?t=1769
My ultimate goal is to retrieve the value "UserPreferencesMask" from the key "HKEY_CURRENT_USER\Control Panel\Desktop" in the Windows registry. Then modify one bit in it, and save it back. (I want to set the second bit to 0, more information there: http://technet.microsoft.com/en-us/libr ... 57204.aspx)
Now, I've always been self-taught, so I tried to do this all by myself, and I feel like I've almost succeeded. I exported the above key from regedit to see the output it would give, and it is: "hex:9e,28,05,80".
Once converted to binary, that gives 1001 1110 0010 1000 0000 0101 1000 0000 (you can see that the second bit is already set to 0, but I'm developing an application that will have to change that bit to 0 on computers where it is set to 1).
My main problem is with handling memory, which I've almost never done (except putting/retrieving some structs into/from binary files back in school). I can only suspect the idea is similar here.
How would I proceed to modify that second bit? (I'm ok with wxRegKey methods, so I know how to save it back, I need help for the "read/modifiy bits" part)
Here is what I have so far:
Code: Select all
wxRegKey *pRegKey; wxMemoryBuffer *myBuffer; myBuffer = new wxMemoryBuffer(); pRegKey = new wxRegKey(wxT("HKEY_CURRENT_USER\\Control Panel\\Desktop")); pRegKey->QueryValue(wxT("UserPreferencesMask"), *myBuffer); pRegKey->Close(); delete pRegKey; cout << myBuffer << endl;
Thanks in advance for helping me!