{"id":115,"date":"2017-05-23T22:40:11","date_gmt":"2017-05-23T14:40:11","guid":{"rendered":"http:\/\/kogasa.moe\/?p=115"},"modified":"2018-04-29T13:32:02","modified_gmt":"2018-04-29T05:32:02","slug":"win7%e5%9c%a8%e4%bb%bb%e5%8a%a1%e6%a0%8f%e4%b8%8a%e5%9b%ba%e5%ae%9a%e5%9b%be%e6%a0%87%e5%90%8e%e8%bf%90%e8%a1%8c%e6%97%b6%e4%bc%9a%e5%87%ba%e7%8e%b0%e4%b8%a4%e4%b8%aa%e5%9b%be%e6%a0%87%e7%9a%84","status":"publish","type":"post","link":"https:\/\/flandre-scarlet.moe\/blog\/115\/","title":{"rendered":"win7\u5728\u4efb\u52a1\u680f\u4e0a\u56fa\u5b9a\u56fe\u6807\u540e\u8fd0\u884c\u65f6\u4f1a\u51fa\u73b0\u4e24\u4e2a\u56fe\u6807\u7684\u95ee\u9898"},"content":{"rendered":"<p>\u6709\u4e9b\u5e94\u7528\u5728\u5f80\u4efb\u52a1\u680f\uff08win7\u53ca\u4ee5\u540e\uff09\u4e0a\u56fa\u5b9a\u56fe\u6807\u540e\uff0c\u5355\u51fb\u56fe\u6807\u8fd0\u884c\u5b9e\u4f8b\u65f6\u4f1a\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u56fe\u6807\uff0cwin7\u4e0b\u4f3c\u4e4e\u8fd8\u80fd\u518d\u6b21\u56fa\u5b9a\u65b0\u7684\u56fe\u6807\u3002<\/p>\n<p>\u9020\u6210\u4e24\u4e2a\u56fe\u6807\u7684\u539f\u56e0\u5728\u4e8e\u5e94\u7528\u4f7f\u7528\u4e86\u81ea\u5b9a\u4e49\u7684<a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/dd378459(v=vs.85).aspx\" target=\"_blank\" rel=\"noopener\">AppUserModelID<\/a>\u3002<br \/>\nwin7\u53ca\u4ee5\u540e\u7684\u4efb\u52a1\u680f\u901a\u8fc7AppUserModelID\u6765\u5173\u8054\u7a0b\u5e8f\u7684\u56fe\u6807\uff0c\u4e5f\u5c31\u662f\u8bf4\u76f8\u540cAppUserModelID\u7684\u8fdb\u7a0b\u4f1a\u5728\u4efb\u52a1\u680f\u4e0a\u5171\u7528\u4e00\u4e2a\u56fe\u6807\u3002\u6bd4\u5982\u8d44\u6e90\u7ba1\u7406\u5668\uff0c\u5f53\u4f60\u6253\u5f00\u591a\u4e2a\u8d44\u6e90\u7ba1\u7406\u5668\u7a97\u53e3\u65f6\uff0c\u4efb\u52a1\u680f\u4e0a\u59cb\u7ec8\u53ea\u6709\u4e00\u4e2a\u5bf9\u5e94\u7684\u56fe\u6807\uff0c\u9f20\u6807\u79fb\u81f3\u56fe\u6807\u4e0a\u65f6\u5c31\u4f1a\u663e\u793a\u51fa\u6240\u6709\u6253\u5f00\u7684\u7a97\u53e3\uff0c\u4e5f\u5c31\u662f\u6240\u6709\u7a97\u53e3\u88ab\u5206\u4e3a\u540c\u4e00\u7ec4\u4e86\u3002\u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u6839\u636e\u5b9e\u9645\u9700\u8981\u6765\u8bbe\u7f6e\u8fd9\u4e2aID\u76f8\u540c\u4e0e\u5426\u6765\u8fbe\u5230\u63a7\u5236\u5e94\u7528\u5728\u4efb\u52a1\u680f\u4e0a\u7684\u56fe\u6807\u663e\u793a\uff0c\u7279\u522b\u662f\u5bf9\u4e8e\u4e00\u4e9b\u591a\u8fdb\u7a0b\u3001\u591a\u663e\u793a\u7a97\u53e3\u7684\u5e94\u7528\u7528\u5904\u4f1a\u6bd4\u8f83\u5927\u3002<br \/>\n<!--more--><\/p>\n<p>\u5728\u6ca1\u6709\u8fd0\u884c\u5e94\u7528\u7684\u65f6\u5019\u8fdb\u884c\u56fa\u5b9a\uff0c\u7cfb\u7edf\u4f1a\u81ea\u52a8\u5206\u914d\u4e00\u4e2a\u5185\u90e8ID\uff0c\u800c\u5982\u679c\u5e94\u7528\u4f7f\u7528\u4e86\u81ea\u5b9a\u4e49\u7684ID\uff0c\u90a3\u4e48\u8fd0\u884c\u65f6\u4fbf\u4f1a\u5bfc\u81f4\u4efb\u52a1\u680f\u5c06\u4e24\u4e2a\u56fe\u6807\u533a\u5206\u5f00\u3002\u8fd9\u4e5f\u662f\u5728\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u91cd\u65b0\u56fa\u5b9a\u4e00\u6b21\u56fe\u6807\u53ef\u4ee5\u89e3\u51b3\u53cc\u56fe\u6807\u95ee\u9898\u7684\u539f\u56e0\uff0c\u56e0\u4e3a\u8fd9\u6837ID\u5c31\u7edf\u4e00\u4e86\uff1b\u53e6\u4e00\u65b9\u9762\uff0c\u5982\u679c\u4e00\u5f00\u59cb\u5c31\u6ca1\u6709\u6307\u5b9a\u8fc7ID\u7684\u8bdd\uff08\u4f7f\u7528\u7cfb\u7edf\u81ea\u52a8\u5206\u914d\u7684ID\uff09\uff0c\u4e5f\u4e0d\u4f1a\u51fa\u73b0\u8fd9\u4e2a\u95ee\u9898\u3002<br \/>\n\u5173\u4e8eAppUserModelID\u7684\u5f62\u5f0f\uff0c\u4e00\u822c\u662f\u5f62\u5982CompanyName.ProductName.SubProduct.VersionInformation\uff0c\u91c7\u7528\u9a7c\u5cf0\u5f0f\u5927\u5c0f\u5199\u7684\u5b57\u7b26\u4e32\uff0cSubProduct\u548cVersionInformation\u53ef\u4ee5\u7528\u6765\u63d0\u4f9b\u66f4\u8fdb\u4e00\u6b65\u7684\u7ec6\u5206\uff08\u6bd4\u5982\u4e0d\u540c\u5b50\u5e94\u7528\u4e4b\u95f4\u56fe\u6807\u5212\u5206\u4e3a\u4e0d\u540c\u7ec4\uff09\uff0c\u4f46\u5982\u679c\u6ca1\u6709\u8fd9\u4e2a\u9700\u8981\u7684\u8bdd\u7528\u5176\u4ed6\u5f62\u5f0f\u7684\u5b57\u7b26\u4e32\u4e5f\u4e0d\u4f1a\u6709\u95ee\u9898\u3002<\/p>\n<p>\u8bbe\u7f6e\u81ea\u5b9a\u4e49ID\u7684\u65b9\u5f0f\u6709\u4e24\u79cd\uff1a<\/p>\n<ol>\n<li>\u521b\u5efa\u7a97\u53e3\u540e\u901a\u8fc7\u8c03\u7528<a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/dd378430(v=vs.85).aspx\" target=\"_blank\" rel=\"noopener\">SHGetPropertyStoreForWindow<\/a>\u6765\u68c0\u7d22\u3001\u8bbe\u7f6eAppUserModelID\u3002\u5728\u5934\u6587\u4ef6propkey.h\u4e2d\u6709\u5bf9AppUserModelID\u7684<a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/dd391569(v=vs.85).aspx\" target=\"_blank\" rel=\"noopener\">\u5b9a\u4e49<\/a>\uff1a<\/li>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n\/\/  Name:     System.AppUserModel.ID -- PKEY_AppUserModel_ID\r\n\/\/  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)\r\n\/\/  FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 5\r\nDEFINE_PROPERTYKEY(PKEY_AppUserModel_ID, 0x9F4C2855, 0x9F79, 0x4B39, 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, 5);\r\n<\/pre>\n<p>\u4e3a\u6b64\u6211\u4eec\u53ea\u8981\u5728\u521b\u5efa\u7a97\u53e3\u540e\u8fdb\u884c\u5982\u4e0b\u8bbe\u7f6e\uff08\u4ee3\u7801\u662fMFC\u91ccApp::InitInstance()\u4e2d\u521b\u5efa\u51fa\u4e3b\u7a97\u53e3\u4e4b\u540e\uff09\uff1a<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n    \/\/ \u521b\u5efa\u4e3b MDI \u6846\u67b6\u7a97\u53e3\r\n    CMainFrame* pMainFrame = new CMainFrame;\r\n    if (!pMainFrame || !pMainFrame-&gt;LoadFrame(IDR_MAINFRAME))\r\n    {\r\n        delete pMainFrame;\r\n        return FALSE;\r\n    }\r\n    m_pMainWnd = pMainFrame;\r\n\r\n    \/\/ \u5305\u542b\u5934\u6587\u4ef6propkey.h\r\n    IPropertyStore *ps;\r\n    SHGetPropertyStoreForWindow(m_pMainWnd-&gt;m_hWnd, IID_IPropertyStore, (void**)&amp;ps);\r\n\r\n    PROPVARIANT pv = { 0 };\r\n    pv.vt = VT_BSTR;                    \/\/ propkey.h\u4e2d\u5b9a\u4e49\u7684AppUserModelID\u7c7b\u578b\r\n    pv.pwszVal = L&quot;MFCApplication1&quot;;    \/\/ \u7528\u6237\u5b9a\u4e49\u7684AppUserModelID\r\n    ps-&gt;SetValue(PKEY_AppUserModel_ID, pv);\r\n<\/pre>\n<li>\u901a\u8fc7\u8c03\u7528<a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/dd378422(v=vs.85).aspx\" target=\"_blank\" rel=\"noopener\">SetCurrentProcessExplicitAppUserModelID<\/a>\u8fdb\u884c\u8bbe\u7f6e\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0bAppUserModelID\u7684\u8bbe\u7f6e\u5fc5\u987b\u5728\u5e94\u7528\u663e\u793a\u4efb\u4f55UI\u754c\u9762\u3001\u4efb\u4f55\u5bf9Jump Lists\u7684\u64cd\u4f5c\u548cSHAllToRecentDocs\u88ab\u8c03\u7528\u4e4b\u524d\u5b8c\u6210\uff0c\u4e00\u822c\u5728\u5e94\u7528\u7a0b\u5e8f\u542f\u52a8\u7684\u65f6\u5019\u5c31\u7acb\u523b\u8bbe\u7f6e\uff0c\u6bd4\u5982MFC\u5c31\u662f\u5728\u5e94\u7528\u7a0b\u5e8f\u7c7b\u7684\u6784\u9020\u51fd\u6570\u4e2d\u8bbe\u7f6e\u7684\uff08\u6240\u4ee5MFC\u7684\u5e94\u7528\u9ed8\u8ba4\u90fd\u4f1a\u6709\u8fd9\u79cd\u53cc\u56fe\u6807\u7684\u95ee\u9898\uff09\u3002\u5b83\u7684\u53c2\u6570\u76f4\u63a5\u4f20\u5165\u5b57\u7b26\u4e32\u5373\u53ef\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u4e9b\u5e94\u7528\u5728\u5f80\u4efb\u52a1\u680f\uff08win7\u53ca\u4ee5\u540e\uff09\u4e0a\u56fa\u5b9a\u56fe\u6807\u540e\uff0c\u5355\u51fb\u56fe\u6807\u8fd0\u884c\u5b9e\u4f8b\u65f6\u4f1a\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u56fe\u6807\uff0cwin7\u4e0b\u4f3c\u4e4e\u8fd8\u80fd\u518d\u6b21&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/flandre-scarlet.moe\/blog\/115\/\">\u9605\u8bfb\u66f4\u591a<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-115","post","type-post","status-publish","format-standard","hentry","category-debug"],"_links":{"self":[{"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/posts\/115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/comments?post=115"}],"version-history":[{"count":0,"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/posts\/115\/revisions"}],"wp:attachment":[{"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/media?parent=115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/categories?post=115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/tags?post=115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}