{"id":1112,"date":"2022-08-10T14:12:35","date_gmt":"2022-08-10T14:12:35","guid":{"rendered":"https:\/\/262235.xyz\/?p=1112"},"modified":"2022-08-10T14:12:35","modified_gmt":"2022-08-10T14:12:35","slug":"1112","status":"publish","type":"post","link":"https:\/\/lyvba.com\/index.php\/2022\/08\/10\/1112\/","title":{"rendered":"C++ \u4f7f\u7528 Winapi \u5220\u9664 Windows\u6ce8\u518c\u8868\u952e\u503c"},"content":{"rendered":"<h2>CodeBlocks \u4f7f\u7528 VC2010 \u7f16\u8bd1\u5668\uff0c\u9700\u8981\u6307\u5b9a <code>AdvAPI32.lib<\/code>\u5e93\u7f16\u8bd1\u5b8c\u6210<\/h2>\n<hr \/>\n<h3>\u76f4\u63a5\u5220\u9664\u6ce8\u518c\u8868\u4e2d\u67d0\u4e2a\u76ee\u5f55\uff0c\u8e29\u5751\u4e24\u6b21 \u6ce8\u610f <code>\\<\/code>  \u7b26\u53f7<\/h3>\n<pre><code>#include &lt;stdio.h&gt;\n#include &lt;windows.h&gt;\nint main()\n{\n    HKEY hKey = HKEY_CURRENT_USER;\n    const char* SubKey = \"Software\\VB and VBA Program Settings\\sRGB\";\n    int ret = RegDeleteTreeA(hKey, SubKey);\n    return ret;\n}\n\n\/\/  https:\/\/docs.microsoft.com\/zh-cn\/windows\/win32\/api\/winreg\/nf-winreg-regdeletekeyvaluea\n\n\/\/LSTATUS RegDeleteKeyA(\n\/\/  HKEY   hKey,\n\/\/  LPCSTR lpSubKey\n\/\/);\n\n\/\/LSTATUS RegDeleteTreeA(\n\/\/  HKEY   hKey,\n\/\/  LPCSTR lpSubKey\n\/\/);\n\n\/\/LSTATUS RegDeleteKeyValueA(\n\/\/  HKEY   hKey,\n\/\/  LPCSTR lpSubKey,\n\/\/  LPCSTR lpValueName\n\/\/);\n\/\/  #define HKEY_CLASSES_ROOT ((HKEY) (ULONG_PTR)((LONG)0x80000000))\n\/\/  #define HKEY_CURRENT_USER ((HKEY) (ULONG_PTR)((LONG)0x80000001))\n\/\/  #define HKEY_LOCAL_MACHINE ((HKEY) (ULONG_PTR)((LONG)0x80000002))\n\/\/  #define HKEY_USERS ((HKEY) (ULONG_PTR)((LONG)0x80000003))\n<\/code><\/pre>\n<h2>\u5220\u9664\u67d0\u4e9b\u8f6f\u4ef6\u6ce8\u518c\u4fe1\u606f<\/h2>\n<pre><code>#include &lt;stdio.h&gt;\n#include &lt;windows.h&gt;\nint main()\n{\n    HKEY hKey = HKEY_CURRENT_USER;\n    const char* SubKey = \"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\";\n    const char* ValueName = \"REG_KR\";\n    int ret = RegDeleteKeyValueA(hKey, SubKey, ValueName);\n    return ret;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>CodeBlocks \u4f7f\u7528 VC2010 \u7f16\u8bd1\u5668\uff0c\u9700\u8981\u6307\u5b9a AdvAPI32.lib\u5e93\u7f16\u8bd1\u5b8c\u6210 \u76f4\u63a5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[31],"class_list":["post-1112","post","type-post","status-publish","format-standard","hentry","category-learn","tag-cpp"],"_links":{"self":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1112","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/comments?post=1112"}],"version-history":[{"count":0,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1112\/revisions"}],"wp:attachment":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/media?parent=1112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/categories?post=1112"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/tags?post=1112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}