{"id":5783,"date":"2012-12-20T07:00:00","date_gmt":"2012-12-20T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2012\/12\/20\/why-do-i-sometimes-get-classic-buttons-and-sometimes-themed-buttons-depending-on-the-host-process\/"},"modified":"2012-12-20T07:00:00","modified_gmt":"2012-12-20T07:00:00","slug":"why-do-i-sometimes-get-classic-buttons-and-sometimes-themed-buttons-depending-on-the-host-process","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20121220-00\/?p=5783","title":{"rendered":"Why do I sometimes get classic buttons and sometimes themed buttons depending on the host process?"},"content":{"rendered":"<p>A customer reported that their printer configuration property sheet page looked different depending on the host process. In some processes, the printer configuration dialog had the classic look of Windows&nbsp;2000, but in other processes it has the themed look of Windows&nbsp;XP and later versions.<\/p>\n<blockquote class=\"q\"><p> The printer driver calls the <code>Create&shy;Property&shy;Sheet&shy;PageW<\/code> to create the property sheet page that contains the push-button, radio-button, and other controls. We&#8217;ve confirmed that we call the function with the same parameters each time, but the results are different depending on which program is doing the printing. We&#8217;ve confirmed that both applications are using version 6.0 of the common controls library. Can you provide pointers for investigating why we are getting the old-school look sometimes? <\/p><\/blockquote>\n<p> It&#8217;s clear that the problem is that the property sheet page is being created with a different activation context depending on the host process. If the activation context is a v6 context, then you get the themed buttons; if the activation context is a v5 context, then you get the classic buttons. The fact that version 6.0 of the common controls library is loaded by the process is not relevant; what&#8217;s relevant is which version is active at the time the dialog is created, since that&#8217;s the time the class names are resolved.\n If the problem were with a regular dialog box, then you can explicitly activate the v6 context before calling <code>Dialog&shy;Box<\/code>, or you can use <a href=\"http:\/\/msdn.microsoft.com\/library\/bb773175#mmc\"> isolation awareness<\/a> to have the activation code generated for you.\n However, the case here is a property sheet page. Since property sheet pages are created on demand (when the user selects the page), you don&#8217;t have direct control over the code that calls <code>Dialog&shy;Box<\/code> in order to activate your v6 manifest. Instead, use the <code>hAct&shy;Ctx<\/code> member of the <code>PROP&shy;SHEET&shy;PAGE<\/code> structure and set the <code>PSP_USE&shy;FUSION&shy;CONTEXT<\/code> flag in the <code>dwFlags<\/code>.<\/p>\n<p> <b>Trivia<\/b>: <i>Fusion<\/i> was the code name for the feature which includes things like <a href=\"http:\/\/msdn.microsoft.com\/library\/dd408052\"> isolated applications<\/a>, <a href=\"http:\/\/msdn.microsoft.com\/library\/aa374191\"> application manifests<\/a> and <a href=\"http:\/\/msdn.microsoft.com\/library\/ms682600\"> redirection files<\/a>. And because they were apparently a bunch of nerds (<i>quelle surprise<\/i>!) they named the initial version <i>Hydrogen<\/i>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>A customer reported that their printer configuration property sheet page looked different depending on the host process. In some processes, the printer configuration dialog had the classic look of Windows&nbsp;2000, but in other processes it has the themed look of Windows&nbsp;XP and later versions. The printer driver calls the Create&shy;Property&shy;Sheet&shy;PageW to create the property sheet [&hellip;]<\/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-5783","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>A customer reported that their printer configuration property sheet page looked different depending on the host process. In some processes, the printer configuration dialog had the classic look of Windows&nbsp;2000, but in other processes it has the themed look of Windows&nbsp;XP and later versions. The printer driver calls the Create&shy;Property&shy;Sheet&shy;PageW to create the property sheet [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/5783","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=5783"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/5783\/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=5783"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=5783"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=5783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}