{"id":105572,"date":"2021-08-19T07:00:00","date_gmt":"2021-08-19T14:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=105572"},"modified":"2021-08-18T17:27:04","modified_gmt":"2021-08-19T00:27:04","slug":"20210819-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20210819-00\/?p=105572","title":{"rendered":"What is the deal with the SM_CXCURSOR system metric?"},"content":{"rendered":"<p>There is a system metric known as <code>SM_<wbr \/>CXCURSOR<\/code>. It ostensibly tells you the width of the cursor, but that doesn&#8217;t really hold up to scrutiny. First of all, there are multiple cursors in the system; which one does it give you the width of? And if you try it, you find that even if the cursors are all the same size, the metric doesn&#8217;t give you the right number. What&#8217;s going on?<\/p>\n<p>Rewind to 16-bit Windows.<\/p>\n<p>In 16-bit Windows, the standard cursors were provided by the display driver. All of those cursors were the same size, so a single metric was sufficient.<\/p>\n<p>Windows 95 added the ability to customize the standard cursors, and that&#8217;s when things started to get messy. With this new feature, you could customize your cursors to be a size different from the size the display driver would have given. The <code>SM_<wbr \/>CXCURSOR<\/code> metric still gave you the size of the driver-provided cursors, though, even if they weren&#8217;t the cursors that were in active use.<\/p>\n<p>In Windows NT, the story is different. The display drivers are no longer in the default cursor business. The default cursors come from the window manager, but most users probably choose a custom one from the Mouse control panel.<\/p>\n<p>Okay, so what does <code>SM_<wbr \/>CXCURSOR<\/code> mean in this new world where nobody is using cursors from the display driver?<\/p>\n<p>The <code>SM_<wbr \/>CXCURSOR<\/code> metric returns the width of the cursor if the system were using the defaults. Which it rarely does any more. You can use them as the &#8220;nominal&#8221; cursor size, but understand that the actual cursors may not be that size. So what size are they, really? We&#8217;ll look into that next time.<\/p>\n<p><b>Bonus chatter<\/b>: In case you were wondering, here are the nominal cursor sizes, as of this writing. These values are not contractual and can change at any time, but I&#8217;m providing them to satisfy your curiosity:<\/p>\n<table class=\"cp3\" style=\"border-collapse: collapse; text-align: center;\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\">\n<tbody>\n<tr>\n<th style=\"border: solid 1px black;\" colspan=\"5\">DPI (scale)<\/th>\n<th style=\"border: solid 1px black;\">Cursor size<\/th>\n<\/tr>\n<tr>\n<td style=\"border: solid 1px black; border-right: none;\">\u00a0<\/td>\n<td style=\"border: 1px black; border-style: solid none;\">\u00a0<\/td>\n<td style=\"border: 1px black; border-style: solid none;\"><var>x<\/var><\/td>\n<td style=\"border: 1px black; border-style: solid none;\">&lt;<\/td>\n<td style=\"border: solid 1px black; border-left: none;\">144dpi (150%)<\/td>\n<td style=\"border: solid 1px black;\">\u200732 \u00d7 \u200732 (100%)<\/td>\n<\/tr>\n<tr>\n<td style=\"border: solid 1px black; border-right: none;\">144dpi (150%)<\/td>\n<td style=\"border: 1px black; border-style: solid none;\">\u2264<\/td>\n<td style=\"border: 1px black; border-style: solid none;\"><var>x<\/var><\/td>\n<td style=\"border: 1px black; border-style: solid none;\">&lt;<\/td>\n<td style=\"border: solid 1px black; border-left: none;\">192dpi (200%)<\/td>\n<td style=\"border: solid 1px black;\">\u200748 \u00d7 \u200748 (150%)<\/td>\n<\/tr>\n<tr>\n<td style=\"border: solid 1px black; border-right: none;\">192dpi (200%)<\/td>\n<td style=\"border: 1px black; border-style: solid none;\">\u2264<\/td>\n<td style=\"border: 1px black; border-style: solid none;\"><var>x<\/var><\/td>\n<td style=\"border: 1px black; border-style: solid none;\">&lt;<\/td>\n<td style=\"border: solid 1px black; border-left: none;\">288dpi (300%)<\/td>\n<td style=\"border: solid 1px black;\">\u200764 \u00d7 \u200764 (200%)<\/td>\n<\/tr>\n<tr>\n<td style=\"border: solid 1px black; border-right: none;\">288dpi (300%)<\/td>\n<td style=\"border: 1px black; border-style: solid none;\">\u2264<\/td>\n<td style=\"border: 1px black; border-style: solid none;\"><var>x<\/var><\/td>\n<td style=\"border: 1px black; border-style: solid none;\">&lt;<\/td>\n<td style=\"border: solid 1px black; border-left: none;\">384dpi (400%)<\/td>\n<td style=\"border: solid 1px black;\">\u200796 \u00d7 \u200796 (300%)<\/td>\n<\/tr>\n<tr>\n<td style=\"border: solid 1px black; border-right: none;\">384dpi (400%)<\/td>\n<td style=\"border: 1px black; border-style: solid none;\">\u2264<\/td>\n<td style=\"border: 1px black; border-style: solid none;\"><var>x<\/var><\/td>\n<td style=\"border: 1px black; border-style: solid none;\">\u00a0<\/td>\n<td style=\"border: solid 1px black; border-left: none;\">\u00a0<\/td>\n<td style=\"border: solid 1px black;\">128 \u00d7 128 (400%)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>A metric from an earlier, simpler time.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-105572","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>A metric from an earlier, simpler time.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/105572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=105572"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/105572\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=105572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=105572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=105572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}