| 关键词: nbsp HKEY return NULL MessageBox ERROR ret vValue GetRarKey vKey |
#include <windows.h>const char *RarKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\WinRAR.exe";const char *vKey = "Path";char vValue[MAX_PATH]={0};BOOL GetRarKey(void){ HKEY hKey; DWORD nSize=MAX_PATH; LONG ret; ret = RegOpenKeyEx( HKEY_LOCAL_MACHINE, RarKey, 0, KEY_ALL_ACCESS, &hKey );if (ret != ERROR_SUCCESS){ MessageBox(NULL,"failed in openning Key!","ERROR",MB_OK); return false;} ret=RegQueryValueEx(hKey, vKey, NULL, NULL, (LPBYTE)vValue, &nSize);RegCloseKey(hKey);if (ret!=ERROR_SUCCESS){ MessageBox(NULL,"failed in querying key!","ERROR",MB_OK); return false;}MessageBox(NULL,vValue,vKey,MB_OK);return true; }int main(void){ GetRarKey(); return 1;} |
|
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系
[邮箱地址] 删除
|