{"id":27203,"date":"2007-04-18T10:00:00","date_gmt":"2007-04-18T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2007\/04\/18\/psychic-debugging-why-you-cant-control-page-navigation-when-using-psp_dlgindirect\/"},"modified":"2007-04-18T10:00:00","modified_gmt":"2007-04-18T10:00:00","slug":"psychic-debugging-why-you-cant-control-page-navigation-when-using-psp_dlgindirect","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20070418-00\/?p=27203","title":{"rendered":"Psychic debugging: Why you can&#039;t control page navigation when using PSP_DLGINDIRECT"},"content":{"rendered":"<p>Here&#8217;s a problem that floated past a few years ago.<\/p>\n<blockquote class=\"q\"><p> We switched our wizard from using dialog resource IDs to using <code>PSP_DLGINDIRECT<\/code> because [reasons deleted since they aren&#8217;t important]. But once we did that, the Next button doesn&#8217;t work! Anybody have any ideas what&#8217;s going on? <\/p><\/blockquote>\n<p> I made things a little easier by deleting the information that isn&#8217;t relevant to the problem. See if you can solve it before reading further.\n Here&#8217;s my reply:<\/p>\n<blockquote class=\"q\"><p> My psychic powers tell me that your wizard navigation code is still trying to navigate by ID even though you aren&#8217;t using IDs any more. <\/p><\/blockquote>\n<p> The <code>PSN_WIZNEXT<\/code> and <code>PSN_WIZBACK<\/code> notifications allow you to control navigation by returning the dialog identifier of the page you want to go to. If you change from dialog identifiers to indirect dialogs, you have to remember to update your page-switching logic as well.\n But how do you specify pages when you aren&#8217;t using dialog resource IDs?\n Let&#8217;s take a step back and look at the way dialogs are specified. There are three ways to do this:<\/p>\n<ul>\n<li>By dialog resource ID: <code>psp.pszTemplate = MAKEINTRESOURCE(n)<\/code> <\/li>\n<li>By dialog resource name: <code>psp.pszTemplate = TEXT(\"name\")<\/code> <\/li>\n<li>By dialog resource indirect: <code>psp.pResource = lpTemplate<\/code>.     If you use this method, you also have to set the     <code>PSP_DLGINDIRECT<\/code> flag. <\/li>\n<\/ul>\n<p> If you look at the property sheet page structure, you&#8217;ll also notice that the <code>pszTemplate<\/code> and <code>pResource<\/code> members are actually <code>union<\/code>ed together; they are just alternate names for the same thing.\n If you specified your page via dialog resource ID, you can return that dialog resource ID; but what if you used a dialog resource name or an indirect dialog? Well, since the dialog resource ID, resource name, and indirect dialog are all stored in the same place, you just pass whatever you passed in the <code>PROPSHEETPAGE.pszTemplate \/ pResource<\/code>  originally. All the property sheet manager does is compare the value you pass in with the value you specified in the <code>PROPSHEETPAGE<\/code>. (As of this writing, the documentation doesn&#8217;t make this clear; I&#8217;ve submitted a doc change request to fix it.)<\/p>\n<p> This technique works with <code>PSN_WIZNEXT<\/code>, <code>PSN_WIZBACK<\/code>, and <code>PSN_SETACTIVE<\/code>. It should work in principle with <code>PSM_SETCURSELID<\/code> and <code>PSM_IDTOINDEX<\/code>, except that there was a bug on 64-bit Windows&nbsp;XP (fixed in Windows Vista) that prevented it from working: The value you pass in was accidentally truncated to a 32-bit value. Oops. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a problem that floated past a few years ago. We switched our wizard from using dialog resource IDs to using PSP_DLGINDIRECT because [reasons deleted since they aren&#8217;t important]. But once we did that, the Next button doesn&#8217;t work! Anybody have any ideas what&#8217;s going on? I made things a little easier by deleting the [&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-27203","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Here&#8217;s a problem that floated past a few years ago. We switched our wizard from using dialog resource IDs to using PSP_DLGINDIRECT because [reasons deleted since they aren&#8217;t important]. But once we did that, the Next button doesn&#8217;t work! Anybody have any ideas what&#8217;s going on? I made things a little easier by deleting the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/27203","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=27203"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/27203\/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=27203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=27203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=27203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}