I'd like to manipulate some video decoder settings with my C#.NET app.
The author of this decoder just dumps his floats to the reg as DWORD like this in C++
key.SetDWORDValue(_T("Brightness"), *(DWORD*)&m_bright);
therefore typecasting them to unsigned long.
The resulting key looks like:
Brightness=1065353216
his own config has a slider like this:
m_procamp_slider[0].SetRange(0, 2*128);
m_procamp_slider[0].SetTic(128);
m_procamp_slider[0].SetPos((int)(m_procamp[0] + (m_procamp[0] >= 0 0.5f : -0.5f)) + 128);
How do I get this value out of the registry to set a System.Windows.Forms.TrackBar accordingly in my app
And how to I store the value back on change
I tried a lot of things until now including bytearrays with manual bit math but nothing works like expected :-/
I can store values in correct Uint32 casted floats if I do something like that:
UInt32 iTmpShit = (UInt32)(tbBrightness.Value-128);
float fTmpShit = Convert.ToSingle(iTmpShit);
subkey.SetValue("Brightness", BitConverter.ToUInt32(BitConverter.GetBytes(fTmpShit), 0), RegistryValueKind.DWord);
but due to the unsigned Int negative values doesn't work of course :-/

Need help getting DWord Values from Registry - BitConverter?
nateastle
regValue = (Int32)subkey.GetValue("Saturation");
byte[] foo = new byte[4];
for (int i = 0; i < 4; i++) foo
Log.Write("DEBUG: Saturation - reg obj. value: {0}", BitConverter.ToInt32(foo, 0).ToString(), true);
This seems to work to put the values correctly in my array but how do I get a Value-Range from 0-256 out of this float