拿来主义也不是很好用啊 搜了网上源码千百万 方才得到一个能运行的
程序代码:
#include <shlobj.h> #include <windows.h> #include <stdio.h> int main() { LONG result; HKEY hKey = NULL; TCHAR REG_KEY_W[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\HideDesktopIcons\\ClassicStartMenu"; result = RegOpenKeyEx(HKEY_CURRENT_USER, REG_KEY_W, 0, KEY_QUERY_VALUE|KEY_SET_VALUE, &hKey); TCHAR ValueName[MAX_PATH]=L""; //存储得到的键值名 BYTE data[MAX_PATH]; DWORD index = 0; DWORD valuelen = MAX_PATH; //枚举到的键值的长度 DWORD len2 = MAX_PATH; while (1) { result = RegEnumValue(hKey, index++, ValueName, &valuelen, 0, 0, data, &len2 ); if ( result == ERROR_NO_MORE_ITEMS ) break; wprintf(L"%ls\n",ValueName); } SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSH, NULL, NULL); return 0; }
[此贴子已经被作者于2017-7-6 14:09编辑过]