//读取注册表信息
void OnBnClickedQuery() {
HKEY hKey;
LPCTSTR data_Set = TEXT("SOFTWARE\\KeyID");
TCHAR lpszValue[16];
DWORD dwSize = sizeof(lpszValue);
DWORD dwType = REG_SZ;
RegOpenKeyEx(HKEY_CURRENT_USER, data_Set, NULL, KEY_READ, &hKey);
RegQueryValueEx(hKey, TEXT("ID"), NULL, &dwType, (LPBYTE)&lpszValue, &dwSize);
RegCloseKey(hKey);
OutputDebugStringW(lpszValue);
}
//写入注册表,在计算机\HKEY_USERS\S-1-5-21-86662488-2945971128-1481956805-1001\SOFTWARE\KeyID
void OnBnClickedChange() {
char deviceSN[32];
HKEY hKey;
HKEY hTempKey;
TCHAR lpszValue[16];
#ifdef UNICODE
MultiByteToWideChar(CP_ACP, 0, deviceSN, -1, lpszValue, 16);
#else
strcpy(lpszValue, deviceSN);
#endif
DWORD cbWriteData = sizeof(lpszValue);
char dwType = REG_SZ;
LPCTSTR data_Set = _T("Software");
if (ERROR_SUCCESS =