{"id":3067,"date":"2020-04-12T17:24:48","date_gmt":"2020-04-12T09:24:48","guid":{"rendered":"https:\/\/www.aoisnow.net\/blog\/?p=3067"},"modified":"2020-04-12T17:24:48","modified_gmt":"2020-04-12T09:24:48","slug":"tont-36513-%e4%b8%ba%e4%bb%80%e4%b9%88-ds_shellfont-ds_fixedsys-ds_setfont%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.aoisnow.net\/blog\/archives\/3067","title":{"rendered":"TONT 36513 \u4e3a\u4ec0\u4e48 DS_SHELLFONT = DS_FIXEDSYS | DS_SETFONT\uff1f"},"content":{"rendered":"<p>\u539f\u6587\u94fe\u63a5\uff1a<a href=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/20050207-00\/?p=36513\" target=\"_blank\" rel=\"noopener\">https:\/\/devblogs.microsoft.com\/oldnewthing\/20050207-00\/?p=36513<\/a><\/p>\n<p>You may have noticed that the numerical value of the DS_SHELLFONT flag is equal to DS_FIXEDSYS | DS_SETFONT.<\/p>\n<p>\u4f60\u53ef\u80fd\u66fe\u6ce8\u610f\u5230 DS_SHELLFONT \u8fd9\u4e2a flag \u7684\u6570\u5b57\u503c\u662f\u4e0e DS_FIXEDSYS | DS_SETFONT \u76f8\u540c\u7684\u3002<\/p>\n<blockquote><p>#define DS_SETFONT 0x40L \/* \u7528\u4e8e\u5bf9\u8bdd\u6846\u63a7\u4ef6\u7684\u7528\u6237\u6307\u5b9a\u5b57\u4f53 *\/<\/p>\n<p>#define DS_FIXEDSYS 0x0008L<\/p>\n<p>#define DS_SHELLFONT (DS_SETFONT | DS_FIXEDSYS)<\/p><\/blockquote>\n<p>Surely that isn\u2019t a coincidence.<\/p>\n<p>\u8fd9\u5f53\u7136\u4e0d\u662f\u5de7\u5408\u3002<\/p>\n<p>The value of the DS_SHELLFONT flag was chosen so that older operating systems (Windows 95, 98, NT 4) would accept the flag while nevertheless ignoring it.<\/p>\n<p>DS_SHELLFONT \u8fd9\u4e2a flag \u7684\u503c\u8fd9\u6837\u8bbe\u8ba1\uff0c\u662f\u4e3a\u4e86\u8ba9\u65e7\u7248\u64cd\u4f5c\u7cfb\u7edf\uff08Windows 95\u300198\u3001NT 4\uff09\u53ef\u4ee5\u63a5\u53d7\u8fd9\u4e2a\u503c\u7684\u540c\u65f6\u5ffd\u7565\u5b83\u3002<\/p>\n<p>This allowed people to write a single program that got the \u201cWindows 2000\u201d look when running on Windows 2000 and got the \u201cclassic\u201d look when running on older systems. (If you make people have to write two versions of their program, one that runs on all systems and one that runs only on the newer system and looks slightly cooler, they will usually not bother writing the second one.)<\/p>\n<p>\u8fd9\u6837\u7684\u8bbe\u8ba1\uff0c\u4f7f\u5f97\u4eba\u4eec\u53ef\u4ee5\u5728\u7f16\u5199\u7a0b\u5e8f\u65f6\uff0c\u4e00\u6b21\u6027\u505a\u5230\u7a0b\u5e8f\u5728 Windows 2000 \u4e0b\u8fd0\u884c\u65f6\u83b7\u5f97\u300eWindows 2000 \u6837\u5f0f\u300f\u7684\u540c\u65f6\uff0c\u5728\u65e7\u7248\u7cfb\u7edf\u4e0a\u8fd0\u884c\u65f6\u83b7\u5f97\u300e\u7ecf\u5178\u6837\u5f0f\u300f\u3002\uff08\u5982\u679c\u4f60\u975e\u8981\u4eba\u4eec\u7f16\u5199\u4e24\u4e2a\u7248\u672c\u7684\u7a0b\u5e8f\uff0c\u4e00\u4e2a\u53ef\u4ee5\u5728\u6240\u6709\u7248\u672c\u7684\u7cfb\u7edf\u4e0a\u8fd0\u884c\uff0c\u4f46\u53e6\u4e00\u4e2a\u53ea\u662f\u5728\u65b0\u7248\u7cfb\u7edf\u4e0a\u8fd0\u884c\u65f6\u770b\u4e0a\u53bb\u6f02\u4eae\u4e00\u4e9b\u7684\u8bdd\uff0c\u4f30\u8ba1\u4eba\u4eec\u6839\u672c\u5c31\u4e0d\u4f1a\u8003\u8651\u53bb\u5199\u540e\u4e00\u4e2a\u7248\u672c\u3002\uff09<\/p>\n<p>The DS_FIXEDSYS flag met these conditions. Older systems accepted the flag since it was indeed a valid flag, but they also ignored it because the DS_SETFONT flag takes precedence.<\/p>\n<p>DS_FIXEDSYS \u8fd9\u4e2a flag \u5c31\u53ef\u4ee5\u540c\u65f6\u9002\u5e94\u8fd9\u4e24\u79cd\u60c5\u51b5\u3002\u65e7\u7248\u7cfb\u7edf\u53ef\u4ee5\u63a5\u53d7\u8fd9\u4e2a\u503c\uff0c\u56e0\u4e3a\u5b83\u7684\u786e\u662f\u4e2a\u6709\u6548\u7684 flag\uff0c\u4f46\u540c\u65f6\u4e5f\u4f1a\u5ffd\u7565\u5b83\uff0c\u56e0\u4e3a DS_SETFONT \u8fd9\u4e2a flag \u4f1a\u88ab\u4f18\u5148\u4f7f\u7528\u3002<\/p>\n<p>This is one of those backwards-compatibility exercises: How do you design something so that it is possible to write one program that gets the new features on new systems while at the same time degrading gracefully on old systems?<\/p>\n<p>\u8fd9\u5c31\u662f\u5411\u4e0b\u517c\u5bb9\u63aa\u65bd\u7684\u5176\u4e2d\u4e4b\u4e00\uff1a\u5982\u4f55\u8bbe\u8ba1\u4e00\u79cd\u673a\u5236\uff0c\u4f7f\u5f97\u53ea\u9700\u64b0\u5199\u4e00\u4e2a\u7248\u672c\u7684\u7a0b\u5e8f\uff0c\u4fbf\u53ef\u4ee5\u5728\u65b0\u7cfb\u7edf\u4e0a\u83b7\u5f97\u65b0\u529f\u80fd\uff0c\u540c\u65f6\u53c8\u5728\u65e7\u7cfb\u7edf\u4e0a\u53ef\u4ee5\u4f18\u96c5\u5730\u964d\u7ea7\u5462\uff1f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u6587\u94fe\u63a5\uff1ahttps:\/\/devblogs.microsoft.com\/oldnewthing\/2005020 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-3067","post","type-post","status-publish","format-standard","hentry","category-tont_history"],"_links":{"self":[{"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/posts\/3067","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/comments?post=3067"}],"version-history":[{"count":0,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/posts\/3067\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/media?parent=3067"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/categories?post=3067"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/tags?post=3067"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}