I'm having a bit of a problem when I save an entry into the registry. It'll story any number less than 100, however if the number (aka the variable: trigger_key ) is equal to or greater than 100 (no larger than 255), it saves a random value.
Here is my code to retrieve the value
RegCreateKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\MacroKeys", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hk, &dwDisp);
_stprintf ( dwData, _T("%d"), trigger_key );
RegSetValueEx(hk, _T("trigger_key"), 0, REG_DWORD, (PBYTE)&dwData, sizeof(PDWORD));
RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\MacroKeys", 0, KEY_QUERY_VALUE, &hk);
RegQueryValueEx(hk, _T ( "trigger_key" ), NULL, NULL, (LPBYTE)val, &dwLength);
trigger_key = _ttoi ( val );
Any help will be appreciated.