diff --git a/PInvoke/ComCtl32/CommCtrl.PropSheet.cs b/PInvoke/ComCtl32/CommCtrl.PropSheet.cs index 9ad50de7..56654619 100644 --- a/PInvoke/ComCtl32/CommCtrl.PropSheet.cs +++ b/PInvoke/ComCtl32/CommCtrl.PropSheet.cs @@ -6,15 +6,25 @@ namespace Vanara.PInvoke; public static partial class ComCtl32 { - /// A page sent the PSM_REBOOTSYSTEM message to the property sheet. The computer must be restarted for the user's changes to take effect. - public static readonly IntPtr ID_PSREBOOTSYSTEM = (IntPtr)3; - - /// A page sent the PSM_RESTARTWINDOWS message to the property sheet. Windows must be restarted for the user's changes to take effect. - public static readonly IntPtr ID_PSRESTARTWINDOWS = (IntPtr)2; + /// + /// Display the elevated icon on the buttons specified in lParam. The elevated icon (or UAC shield icon) indicates that the elevation + /// prompt will be used to prompt the user for approval or credentials. For more information, see Designing UAC Applications for Windows Vista. + /// + public const int PSWIZBF_ELEVATIONREQUIRED = 0x00000001; /// - /// Specifies an application-defined callback function that a property sheet extension uses to add a page to a property sheet. + /// A page sent the PSM_REBOOTSYSTEM message to the property sheet. The computer must be restarted for the user's changes to take effect. /// + public static readonly IntPtr ID_PSREBOOTSYSTEM = (IntPtr)3; + + /// + /// A page sent the PSM_RESTARTWINDOWS message to the property sheet. Windows must be restarted for the user's changes to take effect. + /// + public static readonly IntPtr ID_PSRESTARTWINDOWS = (IntPtr)2; + + private const int PSN_FIRST = -200; + + /// Specifies an application-defined callback function that a property sheet extension uses to add a page to a property sheet. /// /// Type: HPROPSHEETPAGE /// Handle to a property sheet page. @@ -59,9 +69,9 @@ public static partial class ComCtl32 /// /// PSCB_BUTTONPRESSED /// - /// Version 6.0 and later.Indicates the user pressed a button in the property sheet dialog box.To enable this, specify - /// PSH_USECALLBACK in PROPSHEETHEADER.dwFlags and specify the name of this callback function in PROPSHEETHEADER.pfnCallback. The - /// lParam value is one of the following. Note that only PSBTN_CANCEL is valid when you are using the Aero wizard style(PSH_AEROWIZARD). + /// Version 6.0 and later.Indicates the user pressed a button in the property sheet dialog box.To enable this, specify PSH_USECALLBACK in + /// PROPSHEETHEADER.dwFlags and specify the name of this callback function in PROPSHEETHEADER.pfnCallback. The lParam value is one of the + /// following. Note that only PSBTN_CANCEL is valid when you are using the Aero wizard style(PSH_AEROWIZARD). /// /// /// Button pressed @@ -85,8 +95,8 @@ public static partial class ComCtl32 /// /// /// - /// Note that Comctl32.dll versions 6 and later are not redistributable.To use these versions of Comctl32.dll, specify the - /// particular version in a manifest. For more information on manifests, see Enabling Visual Styles. + /// Note that Comctl32.dll versions 6 and later are not redistributable.To use these versions of Comctl32.dll, specify the particular + /// version in a manifest. For more information on manifests, see Enabling Visual Styles. /// /// /// @@ -97,8 +107,8 @@ public static partial class ComCtl32 /// /// PSCB_PRECREATE /// - /// Indicates that the property sheet is about to be created. The hwndDlg parameter is NULL, and the lParam parameter is the address - /// of a dialog template in memory.This template is in the form of a DLGTEMPLATE or DLGTEMPLATEEX structure followed by one or more + /// Indicates that the property sheet is about to be created. The hwndDlg parameter is NULL, and the lParam parameter is the address of a + /// dialog template in memory.This template is in the form of a DLGTEMPLATE or DLGTEMPLATEEX structure followed by one or more /// DLGITEMTEMPLATE structures.This message is not applicable if you are using the Aero wizard style(PSH_AEROWIZARD). /// /// @@ -108,9 +118,9 @@ public static partial class ComCtl32 /// Additional information about the message. The meaning of this value depends on the uMsg parameter. /// If uMsg is PSCB_INITIALIZED or PSCB_BUTTONPRESSED, the value of lParam is zero. /// - /// If uMsg is PSCB_PRECREATE, then lParam will be a pointer to either a DLGTEMPLATE or DLGTEMPLATEEX structure describing the - /// property sheet dialog box. Test the signature of the structure to determine the type. If signature is equal to 0xFFFF then the - /// structure is an extended dialog template, otherwise the structure is a standard dialog template. + /// If uMsg is PSCB_PRECREATE, then lParam will be a pointer to either a DLGTEMPLATE or DLGTEMPLATEEX structure describing the property + /// sheet dialog box. Test the signature of the structure to determine the type. If signature is equal to 0xFFFF then the structure is an + /// extended dialog template, otherwise the structure is a standard dialog template. /// /// /// Returns zero. @@ -124,8 +134,8 @@ public static partial class ComCtl32 { /// /// Version 6.0 and later.Indicates the user pressed a button in the property sheet dialog box.To enable this, specify - /// PSH_USECALLBACK in PROPSHEETHEADER.dwFlags and specify the name of this callback function in PROPSHEETHEADER.pfnCallback. - /// The lParam value is one of the following. Note that only PSBTN_CANCEL is valid when you are using the Aero wizard style(PSH_AEROWIZARD). + /// PSH_USECALLBACK in PROPSHEETHEADER.dwFlags and specify the name of this callback function in PROPSHEETHEADER.pfnCallback. The + /// lParam value is one of the following. Note that only PSBTN_CANCEL is valid when you are using the Aero wizard style(PSH_AEROWIZARD). /// /// /// Button pressed @@ -155,9 +165,9 @@ public static partial class ComCtl32 PSCB_INITIALIZED = 1, /// - /// Indicates that the property sheet is about to be created. The hwndDlg parameter is NULL, and the lParam parameter is the - /// address of a dialog template in memory. This template is in the form of a DLGTEMPLATE or DLGTEMPLATEEX structure followed by - /// one or more DLGITEMTEMPLATE structures. This message is not applicable if you are using the Aero wizard style (PSH_AEROWIZARD). + /// Indicates that the property sheet is about to be created. The hwndDlg parameter is NULL, and the lParam parameter is the address + /// of a dialog template in memory. This template is in the form of a DLGTEMPLATE or DLGTEMPLATEEX structure followed by one or more + /// DLGITEMTEMPLATE structures. This message is not applicable if you are using the Aero wizard style (PSH_AEROWIZARD). /// PSCB_PRECREATE = 2 } @@ -167,15 +177,12 @@ public static partial class ComCtl32 [Flags] public enum PropSheetFlags : uint { - /// - /// Uses the default meaning for all structure members. This flag is not supported when using the Aero-style wizard (PSH_AEROWIZARD). - /// + /// Uses the default meaning for all structure members. This flag is not supported when using the Aero-style wizard (PSH_AEROWIZARD). PSP_DEFAULT = 0x0, /// - /// Creates the page from the dialog box template in memory pointed to by the pResource member. The PropertySheet function - /// assumes that the template that is in memory is not write-protected. A read-only template will cause an exception in some - /// versions of Windows. + /// Creates the page from the dialog box template in memory pointed to by the pResource member. The PropertySheet function assumes + /// that the template that is in memory is not write-protected. A read-only template will cause an exception in some versions of Windows. /// PSP_DLGINDIRECT = 0x1, @@ -185,23 +192,22 @@ public static partial class ComCtl32 PSP_HASHELP = 0x20, /// - /// Version 5.80 and later. Causes the wizard property sheet to hide the header area when the page is selected. If a watermark - /// has been provided, it will be painted on the left side of the page. This flag should be set for welcome and completion - /// pages, and omitted for interior pages. This flag is not supported when using the Aero-style wizard (PSH_AEROWIZARD). + /// Version 5.80 and later. Causes the wizard property sheet to hide the header area when the page is selected. If a watermark has + /// been provided, it will be painted on the left side of the page. This flag should be set for welcome and completion pages, and + /// omitted for interior pages. This flag is not supported when using the Aero-style wizard (PSH_AEROWIZARD). /// PSP_HIDEHEADER = 0x800, /// - /// Version 4.71 or later. Causes the page to be created when the property sheet is created. If this flag is not specified, the - /// page will not be created until it is selected the first time. This flag is not supported when using the Aero-style wizard (PSH_AEROWIZARD). + /// Version 4.71 or later. Causes the page to be created when the property sheet is created. If this flag is not specified, the page + /// will not be created until it is selected the first time. This flag is not supported when using the Aero-style wizard (PSH_AEROWIZARD). /// PSP_PREMATURE = 0x400, /// - /// Reverses the direction in which pszTitle is displayed. Normal windows display all text, including pszTitle, left-to-right - /// (LTR). For languages such as Hebrew or Arabic that read right-to-left (RTL), a window can be mirrored and all text will be - /// displayed RTL. If PSP_RTLREADING is set, pszTitle will instead read RTL in a normal parent window, and LTR in a mirrored - /// parent window. + /// Reverses the direction in which pszTitle is displayed. Normal windows display all text, including pszTitle, left-to-right (LTR). + /// For languages such as Hebrew or Arabic that read right-to-left (RTL), a window can be mirrored and all text will be displayed + /// RTL. If PSP_RTLREADING is set, pszTitle will instead read RTL in a normal parent window, and LTR in a mirrored parent window. /// PSP_RTLREADING = 0x10, @@ -211,23 +217,23 @@ public static partial class ComCtl32 PSP_USECALLBACK = 0x80, /// - /// Version 6.0 and later. Use an activation context. To use an activation context, you must set this flag and assign the - /// activation context handle to hActCtx. See the Remarks. + /// Version 6.0 and later. Use an activation context. To use an activation context, you must set this flag and assign the activation + /// context handle to hActCtx. See the Remarks. /// PSP_USEFUSIONCONTEXT = 0x4000, /// - /// Version 5.80 or later. Displays the string pointed to by the pszHeaderSubTitle member as the subtitle of the header area of - /// a Wizard97 page. To use this flag, you must also set the PSH_WIZARD97 flag in the dwFlags member of the associated - /// PROPSHEETHEADER structure. The PSP_USEHEADERSUBTITLE flag is ignored if PSP_HIDEHEADER is set. In Aero-style wizards, the - /// title appears near the top of the client area. + /// Version 5.80 or later. Displays the string pointed to by the pszHeaderSubTitle member as the subtitle of the header area of a + /// Wizard97 page. To use this flag, you must also set the PSH_WIZARD97 flag in the dwFlags member of the associated PROPSHEETHEADER + /// structure. The PSP_USEHEADERSUBTITLE flag is ignored if PSP_HIDEHEADER is set. In Aero-style wizards, the title appears near the + /// top of the client area. /// PSP_USEHEADERSUBTITLE = 0x2000, /// /// Version 5.80 or later. Displays the string pointed to by the pszHeaderTitle member as the title in the header of a Wizard97 - /// interior page. You must also set the PSH_WIZARD97 flag in the dwFlags member of the associated PROPSHEETHEADER structure. - /// The PSP_USEHEADERTITLE flag is ignored if PSP_HIDEHEADER is set. This flag is not supported when using the Aero-style wizard (PSH_AEROWIZARD). + /// interior page. You must also set the PSH_WIZARD97 flag in the dwFlags member of the associated PROPSHEETHEADER structure. The + /// PSP_USEHEADERTITLE flag is ignored if PSP_HIDEHEADER is set. This flag is not supported when using the Aero-style wizard (PSH_AEROWIZARD). /// PSP_USEHEADERTITLE = 0x1000, @@ -243,14 +249,13 @@ public static partial class ComCtl32 PSP_USEICONID = 0x4, /// - /// Maintains the reference count specified by the pcRefParent member for the lifetime of the property sheet page created from - /// this structure. + /// Maintains the reference count specified by the pcRefParent member for the lifetime of the property sheet page created from this structure. /// PSP_USEREFPARENT = 0x40, /// - /// Uses the pszTitle member as the title of the property sheet dialog box instead of the title stored in the dialog box - /// template. This flag is not supported when using the Aero-style wizard (PSH_AEROWIZARD). + /// Uses the pszTitle member as the title of the property sheet dialog box instead of the title stored in the dialog box template. + /// This flag is not supported when using the Aero-style wizard (PSH_AEROWIZARD). /// PSP_USETITLE = 0x8, } @@ -261,42 +266,42 @@ public static partial class ComCtl32 public enum PropSheetHeaderFlags : uint { /// - /// Uses the default meaning for all structure members, and creates a normal property sheet. This flag has a value of zero and - /// is not combined with other flags. + /// Uses the default meaning for all structure members, and creates a normal property sheet. This flag has a value of zero and is not + /// combined with other flags. /// PSH_DEFAULT = 0x00000000, /// - /// Version 6.00 and Windows Vista.. Creates a wizard property sheet that uses the newer Aero style. The PSH_WIZARD flag must - /// also be set. The single-threaded apartment (STA) model must be used. + /// Version 6.00 and Windows Vista.. Creates a wizard property sheet that uses the newer Aero style. The PSH_WIZARD flag must also be + /// set. The single-threaded apartment (STA) model must be used. /// PSH_AEROWIZARD = 0x00004000, /// /// Permits property sheet pages to display a Help button. You must also set the PSP_HASHELP flag in the page's PROPSHEETPAGE /// structure when the page is created. If any of the initial property sheet pages enable a Help button, PSH_HASHELP will be set - /// automatically. If none of the initial pages enable a Help button, you must explicitly set PSH_HASHELP if you want to have - /// Help buttons on any pages that might be added later. This flag is not supported in conjunction with PSH_AEROWIZARD. + /// automatically. If none of the initial pages enable a Help button, you must explicitly set PSH_HASHELP if you want to have Help + /// buttons on any pages that might be added later. This flag is not supported in conjunction with PSH_AEROWIZARD. /// PSH_HASHELP = 0x00000200, /// - /// Version 5.80 and later. Indicates that a header bitmap will be used with a Wizard97 wizard. You must also set the - /// PSH_WIZARD97 flag. The header bitmap is obtained from the pszbmHeader member, unless the PSH_USEHBMHEADER flag is also set. - /// In that case, the header bitmap is obtained from the hbmHeader member. This flag is not supported in conjunction with PSH_AEROWIZARD. + /// Version 5.80 and later. Indicates that a header bitmap will be used with a Wizard97 wizard. You must also set the PSH_WIZARD97 + /// flag. The header bitmap is obtained from the pszbmHeader member, unless the PSH_USEHBMHEADER flag is also set. In that case, the + /// header bitmap is obtained from the hbmHeader member. This flag is not supported in conjunction with PSH_AEROWIZARD. /// PSH_HEADER = 0x00080000, /// - /// Version 6.00 and Windows Vista..The pszbmHeader member specifies a bitmap that is displayed in the header area. Must be used - /// in combination with PSH_AEROWIZARD. + /// Version 6.00 and Windows Vista..The pszbmHeader member specifies a bitmap that is displayed in the header area. Must be used in + /// combination with PSH_AEROWIZARD. /// PSH_HEADERBITMAP = 0x08000000, /// - /// Causes the PropertySheet function to create the property sheet as a modeless dialog box instead of as a modal dialog box. - /// When this flag is set, PropertySheet returns immediately after the dialog box is created, and the return value from - /// PropertySheet is the window handle to the property sheet dialog box. This flag is not supported in conjunction with PSH_AEROWIZARD. + /// Causes the PropertySheet function to create the property sheet as a modeless dialog box instead of as a modal dialog box. When + /// this flag is set, PropertySheet returns immediately after the dialog box is created, and the return value from PropertySheet is + /// the window handle to the property sheet dialog box. This flag is not supported in conjunction with PSH_AEROWIZARD. /// PSH_MODELESS = 0x00000400, @@ -304,15 +309,15 @@ public static partial class ComCtl32 PSH_NOAPPLYNOW = 0x00000080, /// - /// Version 5.80 and later. Removes the context-sensitive Help button ("?"), which is usually present on the caption bar of - /// property sheets. This flag is not valid for wizards. See About Property Sheets for a discussion of how to remove the caption - /// bar Help button for earlier versions of the common controls. This flag is not supported in conjunction with PSH_AEROWIZARD. + /// Version 5.80 and later. Removes the context-sensitive Help button ("?"), which is usually present on the caption bar of property + /// sheets. This flag is not valid for wizards. See About Property Sheets for a discussion of how to remove the caption bar Help + /// button for earlier versions of the common controls. This flag is not supported in conjunction with PSH_AEROWIZARD. /// PSH_NOCONTEXTHELP = 0x02000000, /// - /// Version 6.00 and Windows Vista.. Specifies that no margin is inserted between the page and the frame. Must be used in - /// combination with PSH_AEROWIZARD. + /// Version 6.00 and Windows Vista.. Specifies that no margin is inserted between the page and the frame. Must be used in combination + /// with PSH_AEROWIZARD. /// PSH_NOMARGIN = 0x10000000, @@ -320,47 +325,45 @@ public static partial class ComCtl32 PSH_PROPSHEETPAGE = 0x00000008, /// - /// Displays a title in the title bar of the property sheet. The title takes the appropriate form for the Windows version. In - /// more recent versions of Windows, the title is the string specified by the pszCaption followed by the string "Properties". In - /// older versions of Windows, the title is the string "Properties for", followed by the string specified by the pszCaption - /// member. This flag is not supported for wizards. + /// Displays a title in the title bar of the property sheet. The title takes the appropriate form for the Windows version. In more + /// recent versions of Windows, the title is the string specified by the pszCaption followed by the string "Properties". In older + /// versions of Windows, the title is the string "Properties for", followed by the string specified by the pszCaption member. This + /// flag is not supported for wizards. /// PSH_PROPTITLE = 0x00000001, /// - /// Allows the wizard to be resized by the user. Maximize and minimize buttons appear in the wizard's frame and the frame is - /// sizable. To use this flag, you must also set PSH_AEROWIZARD. + /// Allows the wizard to be resized by the user. Maximize and minimize buttons appear in the wizard's frame and the frame is sizable. + /// To use this flag, you must also set PSH_AEROWIZARD. /// PSH_RESIZABLE = 0x04000000, /// - /// Displays the title of the property sheet (pszCaption) using right-to-left (RTL) reading order for Hebrew or Arabic - /// languages. If this flag is not specified, the title is displayed in left-to-right (LTR) reading order. + /// Displays the title of the property sheet (pszCaption) using right-to-left (RTL) reading order for Hebrew or Arabic languages. If + /// this flag is not specified, the title is displayed in left-to-right (LTR) reading order. /// PSH_RTLREADING = 0x00000800, /// - /// Stretches the watermark in Internet Explorer 4.0-compatible Wizard97-style wizards. This flag is not supported in - /// conjunction with PSH_AEROWIZARD. This style flag is only included to provide backward compatibility for certain - /// applications. Its use is not recommended, and it is only supported by common controls versions 4.0 and 4.01. With common - /// controls version 5.80 and later, this flag is ignored. + /// Stretches the watermark in Internet Explorer 4.0-compatible Wizard97-style wizards. This flag is not supported in conjunction + /// with PSH_AEROWIZARD. This style flag is only included to provide backward compatibility for certain applications. Its use + /// is not recommended, and it is only supported by common controls versions 4.0 and 4.01. With common controls version 5.80 and + /// later, this flag is ignored. /// PSH_STRETCHWATERMARK = 0x00040000, - /// - /// Calls the function specified by the pfnCallback member when initializing the property sheet defined by this structure. - /// + /// Calls the function specified by the pfnCallback member when initializing the property sheet defined by this structure. PSH_USECALLBACK = 0x00000100, /// - /// Version 5.80 or later. Obtains the header bitmap from the hbmHeader member instead of the pszbmHeader member. You must also - /// set either the PSH_AEROWIZARD flag or the PSH_WIZARD97 flag together with the PSH_HEADER flag. + /// Version 5.80 or later. Obtains the header bitmap from the hbmHeader member instead of the pszbmHeader member. You must also set + /// either the PSH_AEROWIZARD flag or the PSH_WIZARD97 flag together with the PSH_HEADER flag. /// PSH_USEHBMHEADER = 0x00100000, /// - /// Version 5.80 or later. Obtains the watermark bitmap from the hbmWatermark member instead of the pszbmWatermark member. You - /// must also set PSH_WIZARD97 and PSH_WATERMARK. This flag is not supported in conjunction with PSH_AEROWIZARD. + /// Version 5.80 or later. Obtains the watermark bitmap from the hbmWatermark member instead of the pszbmWatermark member. You must + /// also set PSH_WIZARD97 and PSH_WATERMARK. This flag is not supported in conjunction with PSH_AEROWIZARD. /// PSH_USEHBMWATERMARK = 0x00010000, @@ -368,34 +371,31 @@ public static partial class ComCtl32 PSH_USEHICON = 0x00000002, /// - /// Version 5.80 or later. Uses the HPALETTE structure pointed to by the hplWatermark member instead of the default palette to - /// draw the watermark bitmap and/or header bitmap for a Wizard97 wizard. You must also set PSH_WIZARD97, and PSH_WATERMARK or - /// PSH_HEADER. This flag is not supported in conjunction with PSH_AEROWIZARD. + /// Version 5.80 or later. Uses the HPALETTE structure pointed to by the hplWatermark member instead of the default palette to draw + /// the watermark bitmap and/or header bitmap for a Wizard97 wizard. You must also set PSH_WIZARD97, and PSH_WATERMARK or PSH_HEADER. + /// This flag is not supported in conjunction with PSH_AEROWIZARD. /// PSH_USEHPLWATERMARK = 0x00020000, /// - /// Uses pszIcon as the name of the icon resource to load and use as the small icon in the title bar of the property sheet - /// dialog box. + /// Uses pszIcon as the name of the icon resource to load and use as the small icon in the title bar of the property sheet dialog box. /// PSH_USEICONID = 0x00000004, /// - /// Version 5.80 or later. Specifies that the language for the property sheet will be taken from the first page's resource. That - /// page must be specified by resource identifier. + /// Version 5.80 or later. Specifies that the language for the property sheet will be taken from the first page's resource. That page + /// must be specified by resource identifier. /// PSH_USEPAGELANG = 0x00200000, - /// - /// Uses the pStartPage member instead of the nStartPage member when displaying the initial page of the property sheet. - /// + /// Uses the pStartPage member instead of the nStartPage member when displaying the initial page of the property sheet. PSH_USEPSTARTPAGE = 0x00000040, /// /// Version 5.80 or later. Specifies that a watermark bitmap will be used with a Wizard97 wizard on pages that have the - /// PSP_HIDEHEADER style. You must also set the PSH_WIZARD97 flag. The watermark bitmap is obtained from the pszbmWatermark - /// member, unless PSH_USEHBMWATERMARK is set. In that case, the header bitmap is obtained from the hbmWatermark member. This - /// flag is not supported in conjunction with PSH_AEROWIZARD. + /// PSP_HIDEHEADER style. You must also set the PSH_WIZARD97 flag. The watermark bitmap is obtained from the pszbmWatermark member, + /// unless PSH_USEHBMWATERMARK is set. In that case, the header bitmap is obtained from the hbmWatermark member. This flag is not + /// supported in conjunction with PSH_AEROWIZARD. /// PSH_WATERMARK = 0x00008000, @@ -403,14 +403,14 @@ public static partial class ComCtl32 PSH_WIZARD = 0x00000020, /// - /// Version 5.80 or later. Creates a Wizard97-style property sheet, which supports bitmaps in the header of interior pages and - /// on the left side of exterior pages. This flag is not supported in conjunction with PSH_AEROWIZARD. + /// Version 5.80 or later. Creates a Wizard97-style property sheet, which supports bitmaps in the header of interior pages and on the + /// left side of exterior pages. This flag is not supported in conjunction with PSH_AEROWIZARD. /// PSH_WIZARD97 = 0x00002000, /// - /// Adds a context-sensitive Help button ("?"), which is usually absent from the caption bar of a wizard. This flag is not valid - /// for regular property sheets. This flag is not supported in conjunction with PSH_AEROWIZARD. + /// Adds a context-sensitive Help button ("?"), which is usually absent from the caption bar of a wizard. This flag is not valid for + /// regular property sheets. This flag is not supported in conjunction with PSH_AEROWIZARD. /// PSH_WIZARDCONTEXTHELP = 0x00001000, @@ -418,14 +418,1729 @@ public static partial class ComCtl32 PSH_WIZARDHASFINISH = 0x00000010, /// - /// Version 5.80 or later. Uses the Wizard-lite style. This style is similar in appearance to PSH_WIZARD97, but it is - /// implemented much like PSH_WIZARD. There are few restrictions on how the pages are formatted. For instance, there are no - /// enforced borders, and the PSH_WIZARD_LITE style does not paint the watermark and header bitmaps for you the way Wizard97 - /// does. This flag is not supported in conjunction with PSH_AEROWIZARD. + /// Version 5.80 or later. Uses the Wizard-lite style. This style is similar in appearance to PSH_WIZARD97, but it is implemented + /// much like PSH_WIZARD. There are few restrictions on how the pages are formatted. For instance, there are no enforced borders, and + /// the PSH_WIZARD_LITE style does not paint the watermark and header bitmaps for you the way Wizard97 does. This flag is not + /// supported in conjunction with PSH_AEROWIZARD. /// PSH_WIZARD_LITE = 0x00400000, } + /// Window messages for property sheets. + [PInvokeData("prsht.h")] + public enum PropSheetMessage : uint + { + /// + /// + /// Shows or hides buttons in a wizard. You can send this message explicitly or by using the PropSheet_ShowWizButtons macro. + /// + /// Parameters + /// wParam + /// + /// One or more of the following values that specify which property sheet buttons are to be shown. If a button value is included in + /// both this parameter and lParam, it is shown. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// PSWIZB_BACK + /// The Back button. + /// + /// + /// PSWIZB_CANCEL + /// The Cancel button. + /// + /// + /// PSWIZB_DISABLEDFINISH + /// The Finish button. + /// + /// + /// PSWIZB_FINISH + /// The Finish button. + /// + /// + /// PSWIZB_NEXT + /// The Next button. + /// + /// + /// PSWIZB_SHOW + /// Set only this flag (defined as zero) to hide all buttons specified in lParam. + /// + /// + /// PSWIZB_RESTORE + /// Not implemented. + /// + /// + /// lParam + /// + /// One or more of the same values used in wParam, specifying which buttons are affected by this call. If a button value appears in + /// this parameter but not in wParam, the button is hidden. + /// + /// Returns + /// No return value. + /// + /// + /// + /// Wizards display either three or four buttons below each page. This message is used to specify which buttons are visible. Wizards + /// normally display Back, Cancel, and either a Next or Finish button. The Cancel button is always visible. + /// + /// + /// Typically, set PSWIZB_FINISH or PSWIZB_DISABLEDFINISH to replace the Next button with a Finish + /// button. To display Next and Finish buttons simultaneously, set the PSH_WIZARDHASFINISH flag in the + /// dwFlags member of the PROPSHEETHEADER structure when you create the wizard. Every page will then display all four + /// buttons: Back, Next, Cancel, and Finish. + /// + /// + /// If you use the PropSheet_ShowWizButtons macro to send this message, it will be posted. At any other time, you can use + /// SendMessage to send PSM_SHOWWIZBUTTONS. + /// + /// + /// If your notification handler uses PostMessage to send a PSM_SHOWWIZBUTTONS message, do nothing that will affect + /// window focus until after the handler returns. For example, if you call MessageBox immediately after using + /// PostMessage to send PSM_SHOWWIZBUTTONS, the message box will receive focus. Since posted messages are not delivered + /// until they reach the head of the message queue, the PSM_SHOWWIZBUTTONS message will not be delivered until after the + /// wizard has lost focus to the message box. As a result, the property sheet will not be able to properly set the focus for the buttons. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-showwizbuttons + PSM_SHOWWIZBUTTONS = WM_USER + 138, + + /// + /// + /// Simulates the selection of a property sheet button. You can send this message explicitly or by using the + /// PropSheet_PressButton macro. + /// + /// Parameters + /// wParam + /// Index of the button to select. This parameter can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// PSBTN_APPLYNOW + /// Selects the Apply button. This value is not valid when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + /// PSBTN_BACK + /// Selects the Back button. + /// + /// + /// PSBTN_CANCEL + /// Selects the Cancel button. + /// + /// + /// PSBTN_FINISH + /// Selects the Finish button. + /// + /// + /// PSBTN_HELP + /// Selects the Help button. This value is not valid when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + /// PSBTN_NEXT + /// Selects the Next button. + /// + /// + /// PSBTN_OK + /// Selects the OK button. This value is not valid when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + /// lParam + /// Must be zero. + /// Returns + /// No return value. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-pressbutton + PSM_PRESSBUTTON = WM_USER + 113, + + /// + /// + /// Activates the specified page in a property sheet. You can send this message explicitly or by using the PropSheet_SetCurSel macro. + /// + /// Parameters + /// wParam + /// + /// The zero-based index of the page. An application can specify the index or the handle or both. If both are specified, lParam takes precedence. + /// + /// lParam + /// + /// The handle to the page to activate. An application can specify the index or the handle or both. If both are specified, lParam + /// takes precedence. + /// + /// Returns + /// Returns TRUE if successful, or FALSE otherwise. + /// + /// + /// The window that is losing the activation receives the PSN_KILLACTIVE notification code, and the window that is gaining the + /// activation receives the PSN_SETACTIVE notification code. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-setcursel + PSM_SETCURSEL = WM_USER + 101, + + /// + /// + /// Removes a page from a property sheet. You can send this message explicitly or by using the PropSheet_RemovePage macro. + /// + /// Parameters + /// wParam + /// Zero-based index of the page to be removed. + /// lParam + /// The HPROPSHEETPAGE handle of the page to be removed. + /// Returns + /// No return value. + /// + /// + /// An application can specify the index or the handle, or both. If both are specified, lParam takes precedence. + /// Sending PSM_REMOVEPAGE destroys the property sheet page that is being removed. + /// + /// A number of messages and one function call occur while the property sheet is manipulating the list of pages. While this action is + /// taking place, attempting to modify the list of pages will have unpredictable results. Accordingly, you should not use the + /// PSM_REMOVEPAGE message in your implementation of PropSheetPageProc or while handling the following notifications and + /// Windows messages. + /// + /// + /// + /// PSN_APPLY + /// + /// + /// PSN_KILLACTIVE + /// + /// + /// PSN_RESET + /// + /// + /// PSN_SETACTIVE + /// + /// + /// WM_DESTROY + /// + /// + /// WM_INITDIALOG + /// + /// + /// + /// If you need to modify a property sheet page while you are handling one of these messages or while PropSheetPageProc is in + /// operation, post yourself a private Windows message. Your application will not receive that message until after the property sheet + /// manager has finished its tasks. Then you can modify the list of pages. + /// + /// The following notifications are also affected by property sheet modification. + /// + /// + /// PSN_WIZBACK + /// + /// + /// PSN_WIZNEXT + /// + /// + /// + /// You can add or remove pages in response to these notifications, provided that you return (via DWL_MSGRESULT) a nonzero value to + /// specify the desired new page. Note, however, that if you remove a page that is located before the current page (that has a + /// smaller index than the current page), PSN_KILLACTIVE might be sent to the wrong page. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-removepage + PSM_REMOVEPAGE = WM_USER + 102, + + /// + /// + /// Adds a new page to the end of an existing property sheet. You can send this message explicitly or by using the + /// PropSheet_AddPage macro. + /// + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// Handle to the page to add. The page must have been created by a previous call to the CreatePropertySheetPage function. + /// Returns + /// Returns TRUE if successful, or FALSE otherwise. + /// + /// + /// + /// The new page should be no larger than the largest page currently in the property sheet because the property sheet is not resized + /// to fit the new page. + /// + /// + /// A number of messages and one function call occur while the property sheet is manipulating the list of pages. While this action is + /// taking place, attempting to modify the list of pages will have unpredictable results. Accordingly, you should not use the + /// PSM_ADDPAGE message in your implementation of PropSheetPageProc or while handling the following notifications and Windows messages. + /// + /// + /// + /// PSN_APPLY + /// + /// + /// PSN_KILLACTIVE + /// + /// + /// PSN_RESET + /// + /// + /// PSN_SETACTIVE + /// + /// + /// WM_DESTROY + /// + /// + /// WM_INITDIALOG + /// + /// + /// + /// If you need to modify a property sheet page while you are handling one of these messages or while PropSheetPageProc is in + /// operation, post yourself a private Windows message. Your application will not receive that message until after the property sheet + /// manager has finished its tasks. Then you can modify the list of pages. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-addpage + PSM_ADDPAGE = WM_USER + 103, + + /// + /// + /// Informs a property sheet that information in a page has changed. You can send this message explicitly or by using the + /// PropSheet_Changed macro. + /// + /// Parameters + /// wParam + /// Handle to the page that has changed. + /// lParam + /// Must be zero. + /// Returns + /// No return value. + /// + /// + /// The property sheet will enable the Apply button. + /// + /// Note + /// This message is not supported when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-changed + PSM_CHANGED = WM_USER + 104, + + /// + /// Indicates that Windows needs to be restarted for the changes to take effect. + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// Must be zero. + /// Returns + /// No return value. + /// + /// + /// + /// An application should send this message only in response to the PSN_APPLY or PSN_KILLACTIVE notification code. You can send the + /// PSM_RESTARTWINDOWS message explicitly or by using the PropSheet_RestartWindows macro. + /// + /// + /// This message causes the PropertySheet function to return the ID_PSRESTARTWINDOWS value, but only if the user clicks the + /// OK button to close the property sheet. It is the application's responsibility to restart Windows, which can be done by + /// using the ExitWindowsEx function. + /// + /// + /// Note + /// This message is not supported when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-restartwindows + PSM_RESTARTWINDOWS = WM_USER + 105, + + /// + /// + /// Indicates the system needs to be restarted for the changes to take effect. You can send the PSM_REBOOTSYSTEM message + /// explicitly or by using the PropSheet_RebootSystem macro. + /// + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// Must be zero. + /// Returns + /// No return value. + /// + /// + /// An application should send this message only in response to the PSN_APPLY or PSN_KILLACTIVE notification message. + /// + /// This message causes the PropertySheet function to return the ID_PSREBOOTSYSTEM value, but only if the user clicks the + /// OK button to close the property sheet. It is the application's responsibility to reboot the system, which can be done by + /// using the ExitWindowsEx function. + /// + /// This message supersedes all PSM_RESTARTWINDOWS messages that precede or follow it. + /// + /// Note + /// This message is not supported when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-rebootsystem + PSM_REBOOTSYSTEM = WM_USER + 106, + + /// + /// + /// Sent by an application when it has performed changes since the most recent PSN_APPLY notification that cannot be canceled. You + /// can send this message explicitly or by using the PropSheet_CancelToClose macro. + /// + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// Must be zero. + /// Returns + /// No return value. + /// + /// + /// PSM_CANCELTOCLOSE disables the Cancel button and changes the text of the OK button to "Close". + /// + /// Most property sheets wait to perform irreversible changes until a PSN_APPLY notification is received. However, in some + /// circumstances, a property sheet may make irreversible changes outside the standard PSN_APPLY/PSN_RESET sequence. One example is a + /// property sheet that contains an Edit button that is used to display a subdialog box for editing a property. When the user + /// clicks OK to submit the change, the property sheet page has several options. + /// + /// + /// + /// + /// It can record the changes, but wait until it receives a PSN_APPLY notification to apply them. This is the preferred approach. + /// + /// + /// + /// + /// It can apply the changes immediately after exiting the subdialog box, but remember the original settings. Those settings can be + /// used to restore the original state if a PSN_RESET notification is received. + /// + /// + /// + /// + /// It can apply the changes immediately and not attempt to restore the original settings when it receives a PSN_RESET notification. + /// This approach is not recommended, but may be necessary if the changes are too far-reaching for the other two options to be practical. + /// + /// + /// + /// + /// For the third option, applications should send a PSM_CANCELTOCLOSE message to the property sheet. It indicates to the user + /// that the changes made with the subdialog box cannot be reversed by clicking the Cancel button. + /// + /// + /// Note + /// This message is not supported when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-canceltoclose + PSM_CANCELTOCLOSE = WM_USER + 107, + + /// + /// + /// Sent to a property sheet, which then forwards the message to each of its pages. You can send this message explicitly or by using + /// the PropSheet_QuerySiblings macro. + /// + /// Parameters + /// wParam + /// First application-defined parameter. + /// lParam + /// Second application-defined parameter. + /// Returns + /// Returns the nonzero value from a page in the property sheet, or zero if no page returns a nonzero value. + /// + /// If a page returns a nonzero value, the property sheet does not send the message to subsequent pages. + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-querysiblings + PSM_QUERYSIBLINGS = WM_USER + 108, + + /// + /// + /// Informs a property sheet that information in a page has reverted to the previously saved state. You can send this message + /// explicitly or by using the PropSheet_UnChanged macro. + /// + /// Parameters + /// wParam + /// Handle to the page that has reverted to the previously saved state. + /// lParam + /// Must be zero. + /// Returns + /// No return value. + /// + /// + /// The property sheet disables the Apply button if no other pages have registered changes with the property sheet. + /// + /// Note + /// This message is not supported when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-unchanged + PSM_UNCHANGED = WM_USER + 109, + + /// + /// + /// Simulates the selection of the Apply button, indicating that one or more pages have changed and the changes need to be + /// validated and recorded. + /// + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// Must be zero. + /// Returns + /// Returns TRUE if all pages successfully applied the changes, or FALSE otherwise. + /// + /// + /// + /// The property sheet sends the PSN_KILLACTIVE notification code to the current page. If the current page returns FALSE, the + /// property sheet sends the PSN_APPLY notification code to all active pages. You can send the PSM_APPLY message explicitly or by + /// using the PropSheet_Apply macro. + /// + /// + /// Note + /// This message is not supported when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-apply + PSM_APPLY = WM_USER + 110, + + /// + /// Sets the title of a property sheet. You can send this message explicitly or by using the PropSheet_SetTitle macro. + /// Parameters + /// wParam + /// + /// Flag that indicates whether to include the prefix "Properties for" or the suffix "Properties" (depending on the version) with the + /// specified title string. If this value is PSH_PROPTITLE, the prefix or suffix is included. + /// + /// lParam + /// + /// Pointer to a buffer that contains the title string. If the HIWORD of this parameter is NULL, the property sheet + /// loads the string resource specified in the LOWORD. + /// + /// Returns + /// No return value. + /// + /// + /// In an Aero Wizard, this message can be used to change the title of an interior page dynamically; for example, when handling the + /// PSN_SETACTIVE notification. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-settitle + PSM_SETTITLEA = WM_USER + 111, + + /// + /// Sets the title of a property sheet. You can send this message explicitly or by using the PropSheet_SetTitle macro. + /// Parameters + /// wParam + /// + /// Flag that indicates whether to include the prefix "Properties for" or the suffix "Properties" (depending on the version) with the + /// specified title string. If this value is PSH_PROPTITLE, the prefix or suffix is included. + /// + /// lParam + /// + /// Pointer to a buffer that contains the title string. If the HIWORD of this parameter is NULL, the property sheet + /// loads the string resource specified in the LOWORD. + /// + /// Returns + /// No return value. + /// + /// + /// In an Aero Wizard, this message can be used to change the title of an interior page dynamically; for example, when handling the + /// PSN_SETACTIVE notification. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-settitle + PSM_SETTITLEW = WM_USER + 120, + + /// + /// + /// Enables or disables the Back, Next, and Finish buttons in a wizard. You can also use the + /// PropSheet_SetWizButtons macro to post the message. + /// + /// Parameters + /// wParam + /// + /// Set this parameter to PSWIZBF_ELEVATIONREQUIRED to display the elevated icon on the buttons specified in lParam. The elevated + /// icon (or UAC shield icon) indicates that the elevation prompt will be used to prompt the user for approval or credentials. For + /// more information, see Designing UAC Applications for Windows Vista. + /// + /// + /// Note + /// Displaying the UAC shield icon is only supported in AeroWizards (PSH_AEROWIZARD). + /// + /// lParam + /// Value that specifies which property sheet buttons are enabled. You can combine one or more of the following flags. + /// + /// + /// Value + /// Meaning + /// + /// + /// PSWIZB_BACK + /// Enables the Back button. If this flag is not set, the Back button is displayed as disabled. + /// + /// + /// PSWIZB_DISABLEDFINISH + /// Displays a disabled Finish button. + /// + /// + /// PSWIZB_FINISH + /// Displays an enabled Finish button. + /// + /// + /// PSWIZB_NEXT + /// Enables the Next button. If this flag is not set, the Next button is displayed as disabled. + /// + /// + /// Returns + /// No return value. + /// + /// + /// + /// If your notification handler uses PostMessage to send a PSM_SETWIZBUTTONS message, do nothing that will affect + /// window focus until after the handler returns. For example, if you call MessageBox immediately after using + /// PostMessage to send PSM_SETWIZBUTTONS, the message box will receive focus. Since posted messages are not delivered + /// until they reach the head of the message queue, the PSM_SETWIZBUTTONS message will not be delivered until after the wizard + /// has lost focus to the message box. As a result, the property sheet will not be able to properly set the focus for the buttons. + /// + /// + /// If you send the PSM_SETWIZBUTTONS message during your handling of the PSN_SETACTIVE notification, use the PostMessage + /// function rather than the SendMessage function. Otherwise, the system will not update the buttons properly. If you use the + /// PropSheet_SetWizButtons macro to send this message, it will be posted. At any other time, you can use SendMessage + /// to send PSM_SETWIZBUTTONS. + /// + /// + /// Wizards display either three or four buttons below each page. This message is used to specify which buttons are enabled. Wizards + /// normally display Back, Cancel, and either a Next or Finish button. You typically enable only the + /// Next button for the welcome page, Next and Back for interior pages, and Back and Finish for + /// the completion page. The Cancel button is always enabled. Normally, setting PSWIZB_FINISH or PSWIZB_DISABLEDFINISH + /// replaces the Next button with a Finish button. To display Next and Finish buttons simultaneously, set + /// the PSH_WIZARDHASFINISH flag in the dwFlags member of the wizard's PROPSHEETHEADER structure when you create the + /// wizard. Every page will then display all four buttons. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-setwizbuttons + PSM_SETWIZBUTTONS = WM_USER + 112, + + /// + /// + /// Activates the given page in a property sheet based on the resource identifier of the page. You can send this message explicitly + /// or by using the PropSheet_SetCurSelByID macro. + /// + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// Resource identifier of the page to activate. + /// Returns + /// Returns TRUE if successful, or FALSE otherwise. + /// + /// + /// The window that is losing the activation receives the PSN_KILLACTIVE notification code, and the window that is gaining the + /// activation receives the PSN_SETACTIVE notification code. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-setcurselid + PSM_SETCURSELID = WM_USER + 114, + + /// + /// + /// Sets the text of the Finish button in a wizard, shows and enables the button, and hides the Next and Back + /// buttons. You can send this message explicitly or by using the PropSheet_SetFinishText macro. + /// + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// Pointer to the new text for the Finish button. + /// Returns + /// No return value. + /// + /// + /// By default, the Finish button does not have a keyboard accelerator. You can create a keyboard accelerator with this + /// message by including an ampersand (&) in the text string that you assign to lParam. For example, "&Finish" defines F as + /// the accelerator key. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-setfinishtext + PSM_SETFINISHTEXTA = WM_USER + 115, + + /// + /// + /// Sets the text of the Finish button in a wizard, shows and enables the button, and hides the Next and Back + /// buttons. You can send this message explicitly or by using the PropSheet_SetFinishText macro. + /// + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// Pointer to the new text for the Finish button. + /// Returns + /// No return value. + /// + /// + /// By default, the Finish button does not have a keyboard accelerator. You can create a keyboard accelerator with this + /// message by including an ampersand (&) in the text string that you assign to lParam. For example, "&Finish" defines F as + /// the accelerator key. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-setfinishtext + PSM_SETFINISHTEXTW = WM_USER + 121, + + /// + /// + /// Retrieves the handle to the tab control of a property sheet. You can send this message explicitly or by using the + /// PropSheet_GetTabControl macro. + /// + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// Must be zero. + /// Returns + /// Returns the handle to the tab control. + /// + /// + /// Note + /// This message is not supported when using the Aero wizard style ( PSH_AEROWIZARD). + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-gettabcontrol + PSM_GETTABCONTROL = WM_USER + 116, + + /// + /// + /// Passes a message to a property sheet dialog box and indicates whether the dialog box processed the message. You can send this + /// message explicitly or by using the PropSheet_IsDialogMessage macro. + /// + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// Pointer to an MSG structure that contains the message to be checked. + /// Returns + /// Returns TRUE if the message has been processed, or FALSE if the message has not been processed. + /// + /// + /// + /// Your message loop should use the PSM_ISDIALOGMESSAGE message with modeless property sheets to pass messages to the + /// property sheet dialog box. On systems that support Unicode, use the Unicode versions of the GetMessage and + /// PeekMessage functions ( GetMessageW and PeekMessageW) to retrieve messages. + /// + /// + /// If the return value indicates that the message was processed, it must not be passed to the TranslateMessage or + /// DispatchMessage function. + /// + /// + /// Note + /// This message is not supported when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-isdialogmessage + PSM_ISDIALOGMESSAGE = WM_USER + 117, + + /// + /// + /// Retrieves a handle to the window of the current page of a property sheet. You can send this message explicitly or by using the + /// PropSheet_GetCurrentPageHwnd macro. + /// + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// Must be zero. + /// Returns + /// Returns a handle to the window of the current property sheet page. + /// + /// + /// + /// Use the PSM_GETCURRENTPAGEHWND message with modeless property sheets to determine when to destroy the dialog box. When the + /// user clicks the OK or Cancel button, PSM_GETCURRENTPAGEHWND returns NULL, and you can then use the + /// DestroyWindow function to destroy the dialog box. + /// + /// + /// Note + /// This message is not supported when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-getcurrentpagehwnd + PSM_GETCURRENTPAGEHWND = WM_USER + 118, + + /// + /// + /// Inserts a new page into an existing property sheet. The page can be inserted either at a specified index or after a specified + /// page. You can send this message explicitly or by using the PropSheet_InsertPage macro. + /// + /// Parameters + /// wParam + /// + /// Where the page is to be inserted. Set this parameter to NULL to make the new page the first page. To specify where the new + /// page is to be inserted, you can either pass an index or an existing page's HPROPSHEETPAGE handle. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// index + /// + /// If the wParam parameter is less than MAXUSHORT (the largest unsigned short integer), the wParam specifies the + /// zero-based index for the new page. For example, to make the inserted page the third page on the property sheet, set wParam + /// to 2. To make it the first page, set wParam to 0. If wParam has a value greater than the number of pages and less + /// than MAXUSHORT, the page will be appended. + /// + /// + /// + /// hpageInsertAfter + /// + /// If you set the wParam parameter to an existing page's HPROPSHEETPAGE handle, the new page will be inserted after it. + /// + /// + /// + /// lParam + /// Handle to the page to be inserted. The page must first be created by a call to the CreatePropertySheetPage function. + /// Returns + /// Returns a nonzero value if the page was successfully inserted, or zero otherwise. + /// + /// + /// The pages after the insertion point are shifted to the right to accommodate the new page. + /// + /// The property sheet is not resized to fit the new page. Do not make the new page larger than the property sheet's largest page. + /// + /// + /// A number of messages and one function call occur while the property sheet is manipulating the list of pages. While this action is + /// taking place, attempting to modify the list of pages will have unpredictable results. Accordingly, you should not use the + /// PSM_INSERTPAGE message in your implementation of PropSheetPageProc or while handling the following notifications and Windows messages. + /// + /// + /// + /// PSN_APPLY + /// + /// + /// PSN_KILLACTIVE + /// + /// + /// PSN_RESET + /// + /// + /// PSN_SETACTIVE + /// + /// + /// WM_DESTROY + /// + /// + /// WM_INITDIALOG + /// + /// + /// + /// If you need to modify a property sheet page while you are handling one of these messages or while PropSheetPageProc is in + /// operation, post yourself a private Windows message. Your application will not receive that message until after the property sheet + /// manager has finished its tasks. Then you can modify the list of pages. + /// + /// The following notifications are also affected by property sheet modification. + /// + /// + /// PSN_WIZBACK + /// + /// + /// PSN_WIZNEXT + /// + /// + /// + /// You can add or remove pages in response to these notifications, provided that you return (via DWL_MSGRESULT) a nonzero value to + /// specify the desired new page. Note, however, that if you insert a page that is located before the current page (that has a + /// smaller index than the current page), PSN_KILLACTIVE might be sent to the wrong page. + /// + /// + /// Note + /// This message is not supported when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-insertpage + PSM_INSERTPAGE = WM_USER + 119, + + /// + /// + /// Sets the title text for the header of a wizard's interior page. You can send this message explicitly or use the + /// PropSheet_SetHeaderTitle macro. + /// + /// Parameters + /// wParam + /// Zero-based index of the wizard's page. + /// lParam + /// New header subtitle. + /// Returns + /// No return value. + /// + /// If you specify the current page, it will immediately be repainted to display the new title. + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-setheadertitle + PSM_SETHEADERTITLEA = WM_USER + 125, + + /// + /// + /// Sets the title text for the header of a wizard's interior page. You can send this message explicitly or use the + /// PropSheet_SetHeaderTitle macro. + /// + /// Parameters + /// wParam + /// Zero-based index of the wizard's page. + /// lParam + /// New header subtitle. + /// Returns + /// No return value. + /// + /// If you specify the current page, it will immediately be repainted to display the new title. + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-setheadertitle + PSM_SETHEADERTITLEW = WM_USER + 126, + + /// + /// + /// Sets the subtitle text for the header of a wizard's interior page. You can send this message explicitly or use the + /// PropSheet_SetHeaderSubTitle macro. + /// + /// Parameters + /// wParam + /// Zero-based index of the wizard's page. + /// lParam + /// New header subtitle. + /// Returns + /// No return value. + /// + /// + /// If you specify the current page, it will immediately be repainted to display the new subtitle. + /// + /// Note + /// This message is not supported when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-setheadersubtitle + PSM_SETHEADERSUBTITLEA = WM_USER + 127, + + /// + /// + /// Sets the subtitle text for the header of a wizard's interior page. You can send this message explicitly or use the + /// PropSheet_SetHeaderSubTitle macro. + /// + /// Parameters + /// wParam + /// Zero-based index of the wizard's page. + /// lParam + /// New header subtitle. + /// Returns + /// No return value. + /// + /// + /// If you specify the current page, it will immediately be repainted to display the new subtitle. + /// + /// Note + /// This message is not supported when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-setheadersubtitle + PSM_SETHEADERSUBTITLEW = WM_USER + 128, + + /// + /// + /// Takes the window handle of the property sheet page and returns its zero-based index. You can send this message explicitly or use + /// the PropSheet_HwndToIndex macro. + /// + /// Parameters + /// wParam + /// Handle to the page's window. + /// lParam + /// Must be zero. + /// Returns + /// Returns the zero-based index of the property sheet page specified by wParam if successful. Otherwise, it returns -1. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-hwndtoindex + PSM_HWNDTOINDEX = WM_USER + 129, + + /// + /// + /// Takes the index of a property sheet page and returns its window handle. You can send this message explicitly or use the + /// PropSheet_IndexToHwnd macro. + /// + /// Parameters + /// wParam + /// Zero-based index of the page. + /// lParam + /// Must be zero. + /// Returns + /// Returns the handle to the window of the property sheet page specified by wParam if successful. Otherwise, it returns zero. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-indextohwnd + PSM_INDEXTOHWND = WM_USER + 130, + + /// + /// + /// Takes the HPROPSHEETPAGE handle of the property sheet page and returns its zero-based index. You can send this message explicitly + /// or use the PropSheet_PageToIndex macro. + /// + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// HPROPSHEETPAGE handle to the property sheet page. + /// Returns + /// Returns the zero-based index of the property sheet page specified by lParam if successful. Otherwise, it returns -1. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-pagetoindex + PSM_PAGETOINDEX = WM_USER + 131, + + /// + /// + /// Takes the index of a property sheet page and returns its HPROPSHEETPAGE handle. You can send this message explicitly or use the + /// PropSheet_IndexToPage macro. + /// + /// Parameters + /// wParam + /// Zero-based index of the page. + /// lParam + /// Must be zero. + /// Returns + /// Returns the HPROPSHEETPAGE handle of the property sheet page specified by wParam if successful. Otherwise, it returns zero. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-indextopage + PSM_INDEXTOPAGE = WM_USER + 132, + + /// + /// + /// Takes the resource ID of a property sheet page and returns its zero-based index. You can send this message explicitly or use the + /// PropSheet_IdToIndex macro. + /// + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// Resource ID of the page. + /// Returns + /// Returns the zero-based index of the property sheet page specified by lParam if successful. Otherwise, it returns -1. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-idtoindex + PSM_IDTOINDEX = WM_USER + 133, + + /// + /// + /// Takes the index of a property sheet page and returns its resource ID. You can send this message explicitly or use the + /// PropSheet_IndexToId macro. + /// + /// Parameters + /// wParam + /// Zero-based index of the page. + /// lParam + /// Must be zero. + /// Returns + /// Returns the resource ID of the property sheet page specified by wParam if successful. Otherwise, it returns zero. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-indextoid + PSM_INDEXTOID = WM_USER + 134, + + /// + /// + /// Used by modeless property sheets to retrieve the information returned to modal property sheets by PropertySheet. You can + /// send this message explicitly or use the PropSheet_GetResult macro. + /// + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// Must be zero. + /// Returns + /// Returns a positive value if successful, or -1 otherwise. The following return values have a special meaning. + /// + /// + /// Return code + /// Description + /// + /// + /// ID_PSREBOOTSYSTEM + /// + /// A page sent a PSM_REBOOTSYSTEM message to the property sheet. The computer must be restarted for the user's changes to + /// take effect. + /// + /// + /// + /// ID_PSRESTARTWINDOWS + /// + /// A page sent a PSM_RESTARTWINDOWS message to the property sheet. Windows must be restarted for the user's changes to take effect. + /// + /// + /// + /// + /// + /// To retrieve extended error information, call GetLastError. + /// The return value for this message is identical to what PropertySheet returns for a modal property sheet. + /// + /// Version 5.80. The PropertySheet return value carries different information for modal and modeless property sheets. In some + /// cases, modeless property sheets may need the information they would have received from PropertySheet if they had been + /// modal. In particular, they may need to know whether ID_PSREBOOTSYSTEM or ID_PSRESTARTWINDOWS would have been returned. + /// + /// + /// For a modeless property sheet, your message loop should use PSM_ISDIALOGMESSAGE to pass messages to the property sheet + /// dialog box, and PSM_GETCURRENTPAGEHWND to determine when to destroy the dialog box. When the user clicks the OK or + /// Cancel button, PSM_GETCURRENTPAGEHWND returns NULL. You can then retrieve the value that a modal property + /// sheet would have received from PropertySheet by sending a PSM_GETRESULT message. + /// + /// + /// Note + /// This message is not supported when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-getresult + PSM_GETRESULT = WM_USER + 135, + + /// + /// + /// Recalculates the page size of a standard or wizard property sheet after pages have been added or removed. You can send this + /// message explicitly or use the PropSheet_RecalcPageSizes macro. + /// + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// Must be zero. + /// Returns + /// Returns TRUE if successful, or FALSE otherwise. + /// + /// + /// + /// When a property sheet is created, it is sized to fit its initial collection of pages. In order to maintain compatibility with + /// previous versions of the common controls, property sheets and wizards do not automatically resize themselves when pages are + /// subsequently added or removed. With common controls version 5.80, applications should send a PSM_RECALCPAGESIZES message + /// after adding or removing pages with PSM_ADDPAGE, PSM_INSERTPAGE, PSM_REMOVEPAGE, or their equivalent macros. + /// It ensures that the property sheet is properly sized for its current collection of pages. If this message is not sent, some + /// property sheet pages may be truncated or too large. + /// + /// + /// Note + /// This message is not supported when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-recalcpagesizes + PSM_RECALCPAGESIZES = WM_USER + 136, + + /// + /// + /// Sets the text of the Next button in a wizard. You can send this message explicitly or by using the + /// PropSheet_SetNextText macro. + /// + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// Pointer to a buffer that contains the text. + /// Returns + /// No meaningful return value. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-setnexttext + PSM_SETNEXTTEXT = WM_USER + 137, + + /// + /// + /// Enables or disables any of the standard buttons in an Aero wizard. You can send this message explicitly or use the + /// PropSheet_EnableWizButtons macro. + /// + /// Parameters + /// wParam + /// + /// One or more of the following values that specify which property sheet buttons are to be enabled. If a button value is included in + /// both this parameter and lParam, it is enabled. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// PSWIZB_BACK + /// The Back button. + /// + /// + /// PSWIZB_CANCEL + /// The Cancel button. + /// + /// + /// PSWIZB_DISABLEDFINISH + /// The Finish button. + /// + /// + /// PSWIZB_FINISH + /// The Finish button. + /// + /// + /// PSWIZB_NEXT + /// The Next button. + /// + /// + /// lParam + /// + /// One or more of the same values used in wParam, specifying which buttons are affected by this call. If a button value appears in + /// this parameter but not in wParam, it indicates that the button should be disabled. + /// + /// Returns + /// No return value. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-enablewizbuttons + PSM_ENABLEWIZBUTTONS = WM_USER + 139, + + /// + /// + /// Sets the text on a button in an Aero wizard. You can send this message explicitly or by using the PropSheet_SetButtonText macro. + /// + /// Parameters + /// wParam + /// One of the following values specifying the button whose text is set. + /// + /// + /// Value + /// Meaning + /// + /// + /// PSWIZB_BACK + /// The Back button. + /// + /// + /// PSWIZB_CANCEL + /// The Cancel button. + /// + /// + /// PSWIZB_DISABLEDFINISH + /// The Finish button. + /// + /// + /// PSWIZB_FINISH + /// The Finish button. + /// + /// + /// PSWIZB_NEXT + /// The Next button. + /// + /// + /// lParam + /// The text to set. + /// Returns + /// No return value. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psm-setbuttontext + PSM_SETBUTTONTEXT = WM_USER + 140, + } + + /// Notifications for property sheets. + [PInvokeData("prsht.h")] + public enum PropSheetNotification + { + /// + /// Notifies a page that it is about to be activated. This notification code is sent in the form of a WM_NOTIFY message. + /// Parameters + /// lParam + /// + /// Pointer to a PSHNOTIFY structure that contains information about the notification code. This structure contains an + /// NMHDR structure as its first member, hdr. The hwndFrom member of this NMHDR structure contains the + /// handle to the property sheet. The lParam member of the PSHNOTIFY structure does not contain any information. + /// + /// Returns + /// + /// Returns zero to accept the activation, or -1 to activate the next or the previous page (depending on whether the user clicked the + /// Next or Back button). To set the activation to a particular page, return the resource identifier of the page. + /// + /// + /// + /// + /// The PSN_SETACTIVE notification code is sent before the page is visible. An application can use this notification code to + /// initialize data in the page. + /// + /// + /// Note + /// + /// The property sheet is in the process of manipulating the list of pages when the PSN_SETACTIVE notification code is sent. Do not + /// attempt to add, remove, or insert pages while handling this notification code. Doing so will have unpredictable results. + /// + /// + /// + /// To set the return value, the dialog box procedure for the page must use the SetWindowLong function with the DWL_MSGRESULT + /// value, and the dialog box procedure must return TRUE. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psn-setactive + PSN_SETACTIVE = PSN_FIRST - 0, + + /// + /// + /// Notifies a page that it is about to lose activation either because another page is being activated or the user has clicked the OK + /// button. This notification code is sent in the form of a WM_NOTIFY message. + /// + /// Parameters + /// lParam + /// + /// Pointer to a PSHNOTIFY structure that contains information about the notification code. This structure contains an + /// NMHDR structure as its first member, hdr. The hwndFrom member of this NMHDR structure contains the + /// handle to the property sheet. The lParam member of the PSHNOTIFY structure does not contain any information. + /// + /// Returns + /// Returns TRUE to prevent the page from losing the activation, or FALSE to allow it. + /// + /// + /// An application handles this notification code to validate the information the user has entered. + /// + /// Note + /// + /// The property sheet is in the process of manipulating the list of pages when the PSN_KILLACTIVE notification code is sent. Do not + /// attempt to add, remove, or insert pages while handling this notification code. Doing so will have unpredictable results. + /// + /// + /// + /// To set a return value, the dialog box procedure for the page must call the SetWindowLong function with a DWL_MSGRESULT + /// value set to the return value. The dialog box procedure must return TRUE. + /// + /// + /// If the dialog box procedure sets DWL_MSGRESULT to TRUE, it should display a message box to explain the problem to the user. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psn-killactive + PSN_KILLACTIVE = PSN_FIRST - 1, + + /// + /// + /// Sent to every page in the property sheet to indicate that the user has clicked the OK, Close, or Apply button and wants all + /// changes to take effect. This notification code is sent in the form of a WM_NOTIFY message. + /// + /// Parameters + /// lParam + /// + /// Pointer to a PSHNOTIFY structure that contains information about the notification code, including the ID of the page. + /// + /// Returns + /// + /// Set PSNRET_NOERROR to indicate that the changes made to this page are valid and have been applied. If all pages set + /// PSNRET_NOERROR, the property sheet can be destroyed. To indicate that the changes made to this page are invalid and to prevent + /// the property sheet from being destroyed, set one of the following return values: + /// + /// + /// + /// PSNRET_INVALID. The property sheet will not be destroyed, and focus will be returned to this page. + /// + /// + /// + /// PSNRET_INVALID_NOCHANGEPAGE. The property sheet will not be destroyed, and focus will be returned to the page that had focus when + /// the button was pressed. + /// + /// + /// + /// + /// To set the return value, the dialog box procedure for the page must call the SetWindowLong function with the DWL_MSGRESULT + /// value, and the dialog box procedure must return TRUE. + /// + /// + /// + /// + /// When the user clicks the OK, Apply, or Close button, the property sheet sends a PSN_KILLACTIVE notification to the active page, + /// giving it an opportunity to validate the user's changes. If the changes are valid, the property sheet sends a PSN_APPLY + /// notification code to each page, directing it to apply the new properties to the corresponding item. + /// + /// + /// Note + /// + /// The property sheet is in the process of manipulating the list of pages when the PSN_APPLY notification code is sent. Do not + /// attempt to add, remove, or insert pages while handling this notification. Doing so will have unpredictable results. + /// + /// + /// + /// The lParam member of the PSHNOTIFY structure pointed to by lParam is set to TRUE if the user clicks the OK + /// button. It is also set to TRUE if the PSM_CANCELTOCLOSE message has been sent and the user clicks the Close button. + /// It is set to FALSE if the user clicks the Apply button. + /// + /// + /// The PSHNOTIFY structure contains an NMHDR structure as its first member, hdr. The hwndFrom member of + /// this NMHDR structure contains the handle to the property sheet. + /// + /// Do not call the EndDialog function when processing this notification code. + /// + /// A modal property sheet is destroyed if the user clicks the OK button and every page returns the PSNRET_NOERROR value in response + /// to PSN_APPLY. If any page returns PSNRET_INVALID or PSNRET_INVALID_NOCHANGEPAGE, the Apply process is canceled + /// immediately. Pages after the cancelling page will not receive a PSN_APPLY notification code. + /// + /// + /// To receive this notification code, a page must set the DWL_MSGRESULT value to FALSE in response to the PSN_KILLACTIVE + /// notification code. + /// + /// + /// Note + /// This notification code is not supported when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psn-apply + PSN_APPLY = PSN_FIRST - 2, + + /// + /// + /// Notifies a page that the property sheet is about to be destroyed. This notification code is sent in the form of a + /// WM_NOTIFY message. + /// + /// Parameters + /// lParam + /// Pointer to a PSHNOTIFY structure that contains information about the notification code. + /// Returns + /// No return value. + /// + /// + /// + /// All changes made since the last PSN_APPLY notification code are canceled, except in the case of PSH_AEROWIZARD, which does + /// not support that notification code. + /// + /// + /// The lParam member of the PSHNOTIFY structure pointed to by lParam will be set to TRUE if the user clicked + /// the X button in the upper-right corner of the property sheet. It will be FALSE if the user clicked the + /// Cancel button. The PSHNOTIFY structure contains an NMHDR structure as its first member, hdr. The + /// hwndFrom member of this NMHDR structure contains the handle to the property sheet. + /// + /// An application can use this notification code as an opportunity to perform cleanup operations. + /// + /// Note + /// + /// The property sheet is in the process of manipulating the list of pages when the PSN_RESET notification code is sent. Do not + /// attempt to add, remove, or insert pages while handling this notification code. Doing so will have unpredictable results. + /// + /// + /// Do not call the EndDialog function when processing this notification code. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psn-reset + PSN_RESET = PSN_FIRST - 3, + + /// + /// + /// Notifies a page that the user has clicked the Help button. This notification code is sent in the form of a WM_NOTIFY message. + /// + /// Parameters + /// lParam + /// + /// Pointer to a PSHNOTIFY structure that contains information about the notification code. This structure contains an + /// NMHDR structure as its first member, hdr. The hwndFrom member of this NMHDR structure contains the + /// handle to the property sheet. The lParam member of the PSHNOTIFY structure does not contain any information. + /// + /// Returns + /// No return value. + /// + /// + /// An application should display Help information for the page. + /// + /// Note + /// This notification code is not supported when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psn-help + PSN_HELP = PSN_FIRST - 5, + + /// + /// + /// Notifies a page that the user has clicked the Back button in a wizard. This notification code is sent in the form of a + /// WM_NOTIFY message. + /// + /// Parameters + /// lParam + /// + /// Pointer to a PSHNOTIFY structure that contains information about the notification code. This structure contains an + /// NMHDR structure as its first member, hdr. The hwndFrom member of this NMHDR structure contains the + /// handle to the property sheet. The lParam member of the PSHNOTIFY structure does not contain any information. + /// + /// Returns + /// + /// Returns 0 to allow the wizard to go to the previous page. Returns -1 to prevent the wizard from changing pages. To display a + /// particular page, return its dialog resource identifier. If the dialog was specified with the PSP_DLGINDIRECT flag, this + /// notification returns the pointer to the dialog template. + /// + /// + /// + /// + /// To set the return value, the dialog box procedure for the page must call the SetWindowLong function with the + /// DWL_MSGRESULT value and return TRUE. For example: + /// + /// + /// Note + /// + /// The property sheet is in the process of manipulating the list of pages when the PSN_WIZBACK notification code is sent. You can + /// add, insert, or remove pages in response to these notification codes, but special care must be taken if you insert or remove + /// pages before the current page. + /// + /// + /// + /// If you insert or remove pages before the current page, you must return (through DWL_MSGRESULT) a nonzero value to specify + /// the desired new page. Note, however, that if you insert or remove a page that is located before the current page (that has a + /// smaller index than the current page), PSN_KILLACTIVE might be sent to the wrong page. + /// + /// + /// For this reason, it is recommended that wizards that add and remove pages dynamically in response to PSN_WIZNEXT and PSN_WIZBACK + /// do so only to pages at the end of the list. If you want your wizard to remove pages accurately, keep the dynamic pages at the end + /// of the list and jump back to permanent pages before deleting them. + /// + /// + /// For example, suppose a wizard consists of an introductory page, a series of dynamic pages, and a completion page, and you want to + /// delete the dynamic pages when the user reaches the completion page. + /// + /// + /// + /// + /// The wizard would begin with two pages, "Introduction" and "Completion." The user begins on the "Introduction" page. + /// + /// + /// + /// + /// When the user navigates away from "Introduction," the wizard adds the dynamic pages and places the user at the first dynamic page + /// by returning (through DWL_MSGRESULT) the dialog identifier of the page "Dynamic 1." In this example, there are three + /// dynamic pages. + /// + /// + /// + /// + /// After the user navigates through the dynamic pages to "Dynamic 3" and then navigates to the next page, the application should + /// place the user at the page "Completion." Again, this is done by returning (through DWL_MSGRESULT) the dialog identifier of + /// the page "Completion." + /// + /// + /// + /// The application can then remove the three dynamic pages (numbered three through five) safely. + /// + /// + /// + /// Note that this technique is necessary only if your wizard removes pages dynamically. If your wizard only adds pages dynamically, + /// this process is not necessary. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psn-wizback + PSN_WIZBACK = PSN_FIRST - 6, + + /// + /// + /// Notifies a page that the user has clicked the Next button in a wizard. This notification code is sent in the form of a + /// WM_NOTIFY message. + /// + /// Parameters + /// lParam + /// + /// Pointer to a PSHNOTIFY structure that contains information about the notification code. This structure contains an + /// NMHDR structure as its first member, hdr. The hwndFrom member of this NMHDR structure contains the + /// handle to the property sheet. The lParam member of the PSHNOTIFY structure does not contain any information. + /// + /// Returns + /// + /// Return 0 to allow the wizard to go to the next page. Return -1 to prevent the wizard from changing pages. To display a particular + /// page, return its dialog resource identifier. If the dialog was specified with the PSP_DLGINDIRECT flag, this notification + /// returns the pointer to the dialog template. + /// + /// + /// + /// + /// To set the return value, the dialog box procedure for the page must call the SetWindowLong function with the + /// DWL_MSGRESULT value and return TRUE. For example: + /// + /// + /// Note + /// + /// The property sheet is in the process of manipulating the list of pages when the PSN_WIZNEXT notification code is sent. You can + /// add, insert, or remove pages in response to these notification codes, but special care must be taken if you insert or remove + /// pages before the current page. + /// + /// + /// + /// If you insert or remove pages before the current page, you must return (through DWL_MSGRESULT) a nonzero value to specify + /// the desired new page. Note, however, that if you insert or remove a page that is located before the current page (that has a + /// smaller index than the current page), PSN_KILLACTIVE might be sent to the wrong page. + /// + /// + /// For this reason, it is recommended that wizards that add and remove pages dynamically in response to PSN_WIZNEXT and PSN_WIZBACK + /// do so only to pages at the end of the list. If you want your wizard to remove pages accurately, keep the dynamic pages at the end + /// of the list and jump back to permanent pages before deleting them. + /// + /// + /// For example, suppose a wizard consists of an introductory page, a series of dynamic pages, and a completion page, and you want to + /// delete the dynamic pages when the user reaches the completion page. + /// + /// + /// + /// + /// The wizard would begin with two pages, "Introduction" and "Completion." The user begins on the "Introduction" page. + /// + /// + /// + /// + /// When the user navigates away from "Introduction," the wizard adds the dynamic pages and places the user at the first dynamic page + /// by returning (through DWL_MSGRESULT) the dialog identifier of the page "Dynamic 1." In this example, there are three + /// dynamic pages. + /// + /// + /// + /// + /// After the user navigates through the dynamic pages to "Dynamic 3" and then navigates to the next page, the application should + /// place the user at the page "Completion." Again, this is done by returning (through DWL_MSGRESULT) the dialog identifier of + /// the page "Completion." + /// + /// + /// + /// The application can then remove the three dynamic pages (numbered three through five) safely. + /// + /// + /// + /// Note that this technique is necessary only if your wizard removes pages dynamically. If your wizard only adds pages dynamically, + /// this process is not necessary. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psn-wiznext + PSN_WIZNEXT = PSN_FIRST - 7, + + /// + /// + /// Notifies a page that the user has clicked the Finish button in a wizard. This notification code is sent in the form of a + /// WM_NOTIFY message. + /// + /// Parameters + /// lParam + /// + /// Pointer to a PSHNOTIFY structure that contains information about the notification code. This structure contains an + /// NMHDR structure as its first member, hdr. The hwndFrom member of this NMHDR structure contains the + /// handle to the property sheet. The lParam member of the PSHNOTIFY structure does not contain any information. + /// + /// Returns + /// + /// + /// Returns TRUE to prevent the wizard from finishing. + /// + /// + /// + /// Version 5.80. and later. Returns a window handle to prevent the wizard from finishing. The wizard will set the focus to that + /// window. The window must be owned by the wizard page. + /// + /// + /// + /// Returns FALSE to allow the wizard to finish. + /// + /// + /// + /// + /// + /// To set the return value, the dialog box procedure for the page must use the SetWindowLong function with the DWL_MSGRESULT + /// value, and the dialog box procedure must return TRUE. + /// + /// + /// Version 5.80. If your application returns TRUE to prevent a wizard from finishing, it has no control over which window on + /// the page receives focus. Applications that need to stop a wizard from finishing should normally do so by returning the handle of + /// the window on the wizard page that is to receive focus. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psn-wizfinish + PSN_WIZFINISH = PSN_FIRST - 8, + + /// + /// + /// Indicates that the user has canceled the property sheet. This notification code is sent in the form of a WM_NOTIFY message. + /// + /// Parameters + /// lParam + /// + /// Pointer to a PSHNOTIFY structure that contains information about the notification code. This structure contains an + /// NMHDR structure as its first member, hdr. The hwndFrom member of this NMHDR structure contains the + /// handle to the property sheet. The lParam member of the PSHNOTIFY structure does not contain any information. + /// + /// Returns + /// Returns TRUE to prevent the cancel operation, or FALSE to allow it. + /// + /// + /// + /// This notification code is typically sent when a user clicks the Cancel button. It is also sent when a user clicks the + /// X button in the property sheet's upper right hand corner or presses the ESCAPE key. A property sheet page can handle this + /// notification code to ask the user to verify the cancel operation. + /// + /// + /// To set a return value, the dialog box procedure for the page must call the SetWindowLong function with DWL_MSGRESULT set + /// to the return value. The dialog box procedure must return TRUE. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psn-querycancel + PSN_QUERYCANCEL = PSN_FIRST - 9, + + /// + /// + /// Sent by a property sheet to request a drop target object when the cursor passes over one of the tab control's buttons. This + /// notification code is sent in the form of a WM_NOTIFY message. + /// + /// Parameters + /// lParam + /// + /// Pointer to an NMOBJECTNOTIFY structure that, on entry, contains information about the notification code. If this + /// notification code is processed, you must insert object information into this structure. + /// + /// Returns + /// The application processing this notification code must return zero. + /// + /// + /// + /// To provide an object, an application must set values in some members of the NMOBJECTNOTIFY structure at lParam. The + /// pObject member must be set to a valid object pointer, and the hResult member must be set to a success flag. To + /// comply with Component Object Model (COM) standards, always increment the object's reference count when providing an object pointer. + /// + /// + /// If an application does not provide an object, it must set pObject to NULL and hResult to a failure flag. + /// + /// + /// Note + /// This notification code is not supported when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psn-getobject + PSN_GETOBJECT = PSN_FIRST - 10, + + /// + /// + /// Notifies a property sheet that a keyboard message has been received. It provides the page an opportunity to do private keyboard + /// accelerator translation. This notification code is sent in the form of a WM_NOTIFY message. + /// + /// Parameters + /// lParam + /// + /// A pointer to a PSHNOTIFY structure that contains information about the notification code. This structure contains an + /// NMHDR structure as its first member, hdr. The hwndFrom member of the NMHDR structure contains the + /// handle to the property sheet. The lParam member of the PSHNOTIFY structure is a pointer to the message's + /// MSG. It can be cast to an LPMSG type, to get access to the parameters of the message to be translated. + /// + /// Returns + /// + /// Returns PSNRET_MESSAGEHANDLED to indicate that no further processing is necessary. Returns PSNRET_NOERROR to request normal processing. + /// + /// + /// + /// To set the return value, the dialog box procedure for the page must use the SetWindowLong function with the DWL_MSGRESULT + /// value. The dialog box procedure must return TRUE. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psn-translateaccelerator + PSN_TRANSLATEACCELERATOR = PSN_FIRST - 12, + + /// + /// + /// Sent by a property sheet to provide a property sheet page an opportunity to specify which dialog box control should receive the + /// initial focus. This notification code is sent in the form of a WM_NOTIFY message. + /// + /// Parameters + /// lParam + /// + /// Pointer to a PSHNOTIFY structure. Cast the lParam member of this structure to an HWND type, to retrieve the + /// handle of the control that will be given focus by default. The structure contains an NMHDR structure as its first member, + /// hdr. The hwndFrom member of this NMHDR structure contains the handle to the property sheet. + /// + /// Returns + /// + /// To specify which control should receive focus, return the control's handle. Otherwise, return zero and focus will go to the + /// default control. To set the return value, the dialog box procedure must call the SetWindowLong function with a + /// DWL_MSGRESULT value and return TRUE. + /// + /// + /// + /// + /// An application must not call the SetFocus function while handling this notification code. Return the handle of the control + /// that should receive focus, and the property sheet manager will handle the focus change. + /// + /// + /// The PSN_QUERYINITIALFOCUS notification code is not sent if the property sheet manager determines that no control on the page + /// should receive focus. + /// + /// + /// This code fragment implements a simple handler for PSN_QUERYINITIALFOCUS. It requests that initial focus be given to the Location + /// control ( IDC_LOCATION). + /// + /// + /// Note + /// This notification code is not supported when using the Aero wizard style ( PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/psn-queryinitialfocus + PSN_QUERYINITIALFOCUS = PSN_FIRST - 13, + } + /// Action flag. [PInvokeData("Commctrl.h", MSDNShortId = "bb760813")] public enum PropSheetPageCallbackAction @@ -440,6 +2155,59 @@ public static partial class ComCtl32 PSPCB_CREATE = 0x2, } + /// Index of the button to select. + [PInvokeData("prsht.h")] + public enum PSBTN + { + /// Selects the Back button. + PSBTN_BACK = 0, + + /// Selects the Next button. + PSBTN_NEXT = 1, + + /// Selects the Finish button. + PSBTN_FINISH = 2, + + /// Selects the OK button. This value is not valid when using the Aero wizard style ( PSH_AEROWIZARD). + PSBTN_OK = 3, + + /// Selects the Apply button. This value is not valid when using the Aero wizard style ( PSH_AEROWIZARD). + PSBTN_APPLYNOW = 4, + + /// Selects the Cancel button. + PSBTN_CANCEL = 5, + + /// Selects the Help button. This value is not valid when using the Aero wizard style ( PSH_AEROWIZARD). + PSBTN_HELP = 6, + } + + /// Values that specify which property sheet buttons are to be shown. + [PInvokeData("prsht.h")] + [Flags] + public enum PSWIZB : uint + { + /// The Back button. + PSWIZB_BACK = 0x00000001, + + /// The Next button. + PSWIZB_NEXT = 0x00000002, + + /// Set only this flag (defined as zero) to hide all buttons specified in dwButton. + PSWIZB_SHOW = 0x00000001, + + /// Not implemented. + PSWIZB_RESTORE = 0x00000002, + + /// The Finish button. + PSWIZB_FINISH = 0x00000004, + + /// A disabled Finish button. + PSWIZB_DISABLEDFINISH = 0x00000008, + + /// The Cancel button. + PSWIZB_CANCEL = 0x00000010, + } + /// Creates a new page for a property sheet. /// /// Type: LPCPROPSHEETPAGE @@ -525,14 +2293,1040 @@ public static partial class ComCtl32 [return: MarshalAs(UnmanagedType.SysInt)] public static extern IntPtr PropertySheet(ref PROPSHEETHEADER lppsph); + /// Adds a new page to the end of an existing property sheet. You can use this macro or send the PSM_ADDPAGE message explicitly. + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// + /// Type: HPROPSHEETPAGE + /// Handle to the page to add. The page must have been created by a previous call to the CreatePropertySheetPage function. + /// + /// None + /// + /// + /// The new page should be no larger than the largest page currently in the property sheet because the property sheet is not resized to + /// fit the new page. + /// + /// + /// A number of messages and one function call occur while the property sheet is manipulating the list of pages. While this action is + /// taking place, attempting to modify the list of pages will have unpredictable results. Accordingly, you should not use the + /// PropSheet_AddPage macro in your implementation of PropSheetPageProc or while handling the following notifications and + /// Microsoft Windows messages: + /// + /// + /// + /// PSN_APPLY + /// + /// + /// PSN_KILLACTIVE + /// + /// + /// PSN_RESET + /// + /// + /// PSN_SETACTIVE + /// + /// + /// WM_DESTROY + /// + /// + /// WM_INITDIALOG + /// + /// + /// + /// If you need to modify a property sheet page while you are handling one of these messages or while PropSheetPageProc is in operation, + /// post yourself a private Windows message. Your application will not receive that message until after the property sheet manager has + /// finished its tasks. Then you can modify the list of pages. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_addpage void PropSheet_AddPage( hDlg, hpage ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_AddPage")] + public static bool PropSheet_AddPage(HWND hDlg, HPROPSHEETPAGE hpage) => + SendMessage(hDlg, PropSheetMessage.PSM_ADDPAGE, 0, (IntPtr)hpage) != IntPtr.Zero; + + /// + /// Simulates the selection of the Apply button, indicating that one or more pages have changed and the changes need to be + /// validated and recorded. You can use this macro or send the PSM_APPLY message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// None + /// + /// + /// The property sheet sends the PSN_KILLACTIVE notification code to the current page. If the current page returns FALSE, the + /// property sheet sends the PSN_APPLY notification code to all active pages. + /// + /// Note  This macro is not supported when using the Aero wizard style (PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_apply void PropSheet_Apply( hDlg ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_Apply")] + public static bool PropSheet_Apply(HWND hDlg) => + SendMessage(hDlg, PropSheetMessage.PSM_APPLY) != IntPtr.Zero; + + /// + /// Used when changes made since the most recent PSN_APPLY notification cannot be canceled. You can also send a PSM_CANCELTOCLOSE message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// None + /// + /// + /// PSM_CANCELTOCLOSE disables the Cancel button and changes the text of the OK button to "Close". You can use this macro + /// or send the PSM_CANCELTOCLOSE message explicitly. + /// + /// + /// Most property sheets wait to perform irreversible changes until a PSN_APPLY notification is received. However, in some circumstances, + /// a property sheet may make irreversible changes outside the standard PSN_APPLY/PSN_RESET sequence. One example is a property sheet + /// that contains an Edit button that is used to display a subdialog box for editing a property. When the user clicks OK to + /// submit the change, the property sheet page has several options: + /// + /// + /// + /// + /// It can record the changes but wait until it receives a PSN_APPLY notification to apply them. This is the preferred approach. + /// + /// + /// + /// + /// It can apply the changes immediately after exiting the subdialog box, but remember the original settings. Those settings can be used + /// to restore the original state if a PSN_RESET notification is received. + /// + /// + /// + /// + /// It can apply the changes immediately and not attempt to restore the original settings when it receives a PSN_RESET notification. This + /// approach is not recommended, but may be necessary if the changes are too far-reaching for the other two options to be practical. + /// + /// + /// + /// + /// For the third option, applications should send a PSM_CANCELTOCLOSE message to the property sheet. It indicates to the user that the + /// changes made with the subdialog box cannot be reversed by clicking the Cancel button. + /// + /// Note  This macro is not supported when using the Aero wizard style (PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_canceltoclose void PropSheet_CancelToClose( hDlg ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_CancelToClose")] + public static void PropSheet_CancelToClose(HWND hDlg) => + PostMessage(hDlg, PropSheetMessage.PSM_CANCELTOCLOSE); + + /// + /// Informs a property sheet that information in a page has changed. You can use this macro or send the PSM_CHANGED message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// + /// Type: HWND + /// Handle to the page that has changed. + /// + /// None + /// + /// The property sheet enables the Apply button. + /// Note  This macro is not supported when using the Aero wizard style (PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_changed void PropSheet_Changed( hDlg, hwnd ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_Changed")] + public static void PropSheet_Changed(HWND hDlg, HPROPSHEETPAGE hwnd) => + SendMessage(hDlg, PropSheetMessage.PSM_CHANGED, (IntPtr)hwnd); + + /// Enables or disables buttons in an Aero wizard. You can use this macro or send the PSM_ENABLEWIZBUTTONS message explicitly. + /// + /// Type: HWND + /// Handle to the wizard. + /// + /// + /// Type: DWORD + /// + /// One or more of the following values that specify which property sheet buttons are to be enabled. If a button value is included in + /// both this parameter and dwMask, it is enabled. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// PSWIZB_BACK + /// 0x0001. The Back button. + /// + /// + /// PSWIZB_NEXT + /// 0x0002. The Next button. + /// + /// + /// PSWIZB_FINISH + /// 0x0004. The Finish button. + /// + /// + /// PSWIZB_CANCEL + /// 0x0010. The Cancel button. + /// + /// + /// + /// + /// Type: DWORD + /// + /// One or more of the same values used in dwState, specifying which buttons are affected by this call. If a button value appears + /// in this parameter but not in dwState, the button is disabled. + /// + /// + /// None + /// The following example code enables the Back button and disables the Next button. + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_enablewizbuttons void PropSheet_EnableWizButtons( hDlg, + // dwState, dwMask ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_EnableWizButtons")] + public static void PropSheet_EnableWizButtons(HWND hDlg, PSWIZB dwState, PSWIZB dwMask) => + PostMessage(hDlg, PropSheetMessage.PSM_ENABLEWIZBUTTONS, (IntPtr)Convert.ToInt32(dwState), (IntPtr)Convert.ToInt32(dwMask)); + + /// + /// Retrieves a handle to the window of the current page of a property sheet. You can use this macro or send the PSM_GETCURRENTPAGEHWND + /// message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// None + /// + /// + /// Use the PropSheet_GetCurrentPageHwnd macro with modeless property sheets to determine when to destroy the dialog box. When the + /// user clicks the OK or Cancel button, PropSheet_GetCurrentPageHwnd returns NULL, and you can then use the + /// DestroyWindow function to destroy the dialog box. + /// + /// Note  This macro is not supported when using the Aero wizard style (PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_getcurrentpagehwnd void PropSheet_GetCurrentPageHwnd( + // hDlg ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_GetCurrentPageHwnd")] + public static HPROPSHEETPAGE PropSheet_GetCurrentPageHwnd(HWND hDlg) => + (HPROPSHEETPAGE)SendMessage(hDlg, PropSheetMessage.PSM_GETCURRENTPAGEHWND); + + /// + /// Used by modeless property sheets to retrieve the information returned to modal property sheets by PropertySheet. You can use this + /// macro or sent the PSM_GETRESULT message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet's dialog box. + /// + /// None + /// + /// To retrieve extended error information, call GetLastError. + /// The return value is identical to what PropertySheet would have returned had this been a modal property sheet. + /// + /// Version 5.80. The PropertySheet return value carries different information for modal and modeless property sheets. In some cases, + /// modeless property sheets may need the information they would have received from PropertySheet if they had been modal. In + /// particular, they may need to know whether ID_PSREBOOTSYSTEM or ID_PSRESTARTWINDOWS would have been returned. + /// + /// + /// For a modeless property sheet, your message loop should use PSM_ISDIALOGMESSAGE to pass messages to the property sheet dialog box, + /// and PSM_GETCURRENTPAGEHWND to determine when to destroy the dialog box. When the user clicks the OK or Cancel button, + /// PSM_GETCURRENTPAGEHWND returns NULL. You can then retrieve the value that a modal property sheet would have received + /// from PropertySheet by sending a PSM_GETRESULT message. + /// + /// Note  This macro is not supported when using the Aero wizard style (PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_getresult void PropSheet_GetResult( hDlg ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_GetResult")] + public static int PropSheet_GetResult(HWND hDlg) => + SendMessage(hDlg, PropSheetMessage.PSM_GETRESULT).ToInt32(); + + /// + /// Retrieves the handle to the tab control of a property sheet. You can use this macro or send the PSM_GETTABCONTROL message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// None + /// + /// Note  This macro is not supported when using the Aero wizard style (PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_gettabcontrol void PropSheet_GetTabControl( hDlg ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_GetTabControl")] + public static HWND PropSheet_GetTabControl(HWND hDlg) => + (HWND)SendMessage(hDlg, PropSheetMessage.PSM_GETTABCONTROL); + + /// + /// Takes a window handle of the property sheet page and returns its zero-based index. You can use this macro or send the PSM_HWNDTOINDEX + /// message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet's window. + /// + /// + /// Type: HWND + /// Handle to the page's window. + /// + /// None + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_hwndtoindex void PropSheet_HwndToIndex( hDlg, hwnd ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_HwndToIndex")] + public static int PropSheet_HwndToIndex(HWND hDlg, HPROPSHEETPAGE hwnd) => + SendMessage(hDlg, PropSheetMessage.PSM_HWNDTOINDEX, (IntPtr)hwnd).ToInt32(); + + /// + /// Takes the resource identifier (ID) of a property sheet page and returns its zero-based index. You can use this macro or send the + /// PSM_IDTOINDEX message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet window. + /// + /// + /// Type: int + /// Resource ID of the page. + /// + /// None + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_idtoindex void PropSheet_IdToIndex( hDlg, id ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_IdToIndex")] + public static int PropSheet_IdToIndex(HWND hDlg, int id) => + SendMessage(hDlg, PropSheetMessage.PSM_IDTOINDEX, default, (IntPtr)id).ToInt32(); + + /// + /// Takes the index of a property sheet page and returns its window handle. You can use this macro or send the PSM_INDEXTOHWND message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet page's window. + /// + /// + /// Type: int + /// Zero-based index of the page. + /// + /// None + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_indextohwnd void PropSheet_IndexToHwnd( hDlg, i ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_IndexToHwnd")] + public static HPROPSHEETPAGE PropSheet_IndexToHwnd(HWND hDlg, int i) => + (HPROPSHEETPAGE)SendMessage(hDlg, PropSheetMessage.PSM_INDEXTOHWND, (IntPtr)i); + + /// + /// Takes the index of a property sheet page and returns its resource identifier (ID). You can use this macro or send the PSM_INDEXTOID + /// message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// + /// Type: int + /// Zero-based index of the page. + /// + /// None + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_indextoid void PropSheet_IndexToId( hDlg, i ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_IndexToId")] + public static int PropSheet_IndexToId(HWND hDlg, int i) => + SendMessage(hDlg, PropSheetMessage.PSM_INDEXTOID, (IntPtr)i).ToInt32(); + + /// + /// Takes the index of a property sheet page and returns its HPROPSHEETPAGE handle. You can use this macro or send the PSM_INDEXTOPAGE + /// message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet window. + /// + /// + /// Type: int + /// Zero-based index of the page. + /// + /// None + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_indextopage void PropSheet_IndexToPage( hDlg, i ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_IndexToPage")] + public static HPROPSHEETPAGE PropSheet_IndexToPage(HWND hDlg, int i) => + (HPROPSHEETPAGE)SendMessage(hDlg, PropSheetMessage.PSM_INDEXTOPAGE, (IntPtr)i); + + /// + /// Inserts a new page into an existing property sheet. The page can be inserted either at a specified index or after a specified page. + /// You can use this macro or send the PSM_INSERTPAGE message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// + /// Type: HWND + /// + /// Where the page is to be inserted. Set wParam to NULL to make the new page the first page. To specify where the new page + /// is to be inserted, you can either pass an index or an existing page's HPROPSHEETPAGE handle. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// index + /// + /// If wParam is less than MAXUSHORT (the largest unsigned short integer), it specifies the zero-based index for the new page. For + /// example, to make the inserted page the third page on the property sheet, set index to 2. To make it the first page, set + /// index to 0. If index has a value greater than the number of pages and less than MAXUSHORT, the page will be appended. + /// + /// + /// + /// hpageInsertAfter + /// If you set wParam to an existing page's HPROPSHEETPAGE handle, the new page will be inserted after it. + /// + /// + /// + /// + /// Type: HWND + /// Handle to the page to be inserted. The page must first be created by a call to the CreatePropertySheetPage function. + /// + /// None + /// + /// The pages after the insertion point are shifted to the right to accommodate the new page. + /// The property sheet is not resized to fit the new page. Do not make the new page larger than the property sheet's largest page. + /// + /// A number of messages and one function call occur while the property sheet is manipulating the list of pages. While this action is + /// taking place, attempting to modify the list of pages will have unpredictable results. Accordingly, you should not use the + /// PropSheet_InsertPage macro in your implementation of PropSheetPageProc or while handling the following notifications and + /// Windows messages. + /// + /// + /// + /// PSN_APPLY + /// + /// + /// PSN_KILLACTIVE + /// + /// + /// PSN_RESET + /// + /// + /// PSN_SETACTIVE + /// + /// + /// WM_DESTROY + /// + /// + /// WM_INITDIALOG + /// + /// + /// + /// If you need to modify a property sheet page while you are handling one of these messages or while PropSheetPageProc is in operation, + /// post yourself a private Windows message. Your application will not receive that message until after the property sheet manager has + /// finished its tasks. Then you can modify the list of pages. + /// + /// The following notifications are also affected by property sheet modification. + /// + /// + /// PSN_WIZBACK + /// + /// + /// PSN_WIZNEXT + /// + /// + /// + /// You can add or remove pages in response to these notifications, provided that you return (via DWL_MSGRESULT) a nonzero value to + /// specify the desired new page. Note, however, that if you insert a page that is located before the current page (that has a smaller + /// index than the current page), PSN_KILLACTIVE might be sent to the wrong page. + /// + /// Note  This macro is not supported when using the Aero wizard style (PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_insertpage void PropSheet_InsertPage( hDlg, index, hpage ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_InsertPage")] + public static bool PropSheet_InsertPage(HWND hDlg, IntPtr index, HPROPSHEETPAGE hpage) => + SendMessage(hDlg, PropSheetMessage.PSM_INSERTPAGE, index, (IntPtr)hpage) != IntPtr.Zero; + + /// + /// Passes a message to a property sheet dialog box and indicates whether the dialog box processed the message. You can use this macro or + /// send the PSM_ISDIALOGMESSAGE message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// + /// Type: LPMSG + /// Pointer to an MSG structure that contains the message to be checked. + /// + /// None + /// + /// + /// Your message loop should use the PropSheet_IsDialogMessage macro with modeless property sheets to pass messages to the + /// property sheet dialog box. On systems that support Unicode, use the Unicode versions of the GetMessage and PeekMessage functions ( + /// GetMessageW and PeekMessageW) to retrieve messages. + /// + /// + /// If the return value indicates that the message was processed, it must not be passed to the TranslateMessage or DispatchMessage function. + /// + /// Note  This macro is not supported when using the Aero wizard style (PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_isdialogmessage void PropSheet_IsDialogMessage( hDlg, + // pMsg ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_IsDialogMessage")] + public static bool PropSheet_IsDialogMessage(HWND hDlg, MSG pMsg) => + SendMessage(hDlg, PropSheetMessage.PSM_ISDIALOGMESSAGE, default, ref pMsg) != IntPtr.Zero; + + /// + /// Takes the HPROPSHEETPAGE handle of a property sheet page and returns its zero-based index. You can use this macro or send the + /// PSM_PAGETOINDEX message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// + /// Type: HPROPSHEETPAGE + /// HPROPSHEETPAGE handle to the property sheet page. + /// + /// None + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_pagetoindex void PropSheet_PageToIndex( hDlg, hpage ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_PageToIndex")] + public static int PropSheet_PageToIndex(HWND hDlg, HPROPSHEETPAGE hpage) => + SendMessage(hDlg, PropSheetMessage.PSM_PAGETOINDEX, default, (IntPtr)hpage).ToInt32(); + + /// Simulates the selection of a property sheet button. You can use this macro or send the PSM_PRESSBUTTON message explicitly. + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// + /// Type: int + /// Index of the button to select. This parameter can be one of the following values: + /// + /// + /// Value + /// Meaning + /// + /// + /// PSBTN_APPLYNOW + /// Selects the Apply button. + /// + /// + /// PSBTN_BACK + /// Selects the Back button. + /// + /// + /// PSBTN_CANCEL + /// Selects the Cancel button. + /// + /// + /// PSBTN_FINISH + /// Selects the Finish button. + /// + /// + /// PSBTN_HELP + /// Selects the Help button. + /// + /// + /// PSBTN_NEXT + /// Selects the Next button. + /// + /// + /// PSBTN_OK + /// Selects the OK button. + /// + /// + /// + /// None + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_pressbutton void PropSheet_PressButton( hDlg, iButton ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_PressButton")] + public static void PropSheet_PressButton(HWND hDlg, PSBTN iButton) => + PostMessage(hDlg, PropSheetMessage.PSM_PRESSBUTTON, (IntPtr)iButton, default); + + /// + /// Causes a property sheet to send the PSM_QUERYSIBLINGS message to each of its pages. You can use this macro or send the + /// PSM_QUERYSIBLINGS message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// + /// Type: WPARAM + /// First application-defined parameter. + /// + /// + /// Type: LPARAM + /// Second application-defined parameter. + /// + /// None + /// If a page returns a nonzero value, the property sheet does not send the message to subsequent pages. + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_querysiblings void PropSheet_QuerySiblings( hDlg, wParam, + // lParam ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_QuerySiblings")] + public static int PropSheet_QuerySiblings(HWND hDlg, IntPtr wParam, IntPtr lParam) => + SendMessage(hDlg, PropSheetMessage.PSM_QUERYSIBLINGS, wParam, lParam).ToInt32(); + + /// + /// Indicates the system needs to be restarted for the changes to take effect. You can use this macro or send the PSM_REBOOTSYSTEM + /// message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// None + /// + /// An application should send the PSM_REBOOTSYSTEM message only in response to the PSN_APPLY or PSN_KILLACTIVE notification code. + /// + /// This macro causes the PropertySheet function to return the ID_PSREBOOTSYSTEM value, but only if the user clicks the OK button + /// to close the property sheet. It is the application's responsibility to reboot the system, which can be done by using the + /// ExitWindowsEx function. + /// + /// This macro supersedes all PropSheet_RebootSystem macros that precede or follow it. + /// Note  This macro is not supported when using the Aero wizard style (PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_rebootsystem void PropSheet_RebootSystem( hDlg ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_RebootSystem")] + public static void PropSheet_RebootSystem(HWND hDlg) => + SendMessage(hDlg, PropSheetMessage.PSM_REBOOTSYSTEM); + + /// + /// Recalculates the page size of a standard or wizard property sheet after pages have been added or removed. You can use this macro or + /// send the PSM_RECALCPAGESIZES message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet's dialog box. + /// + /// None + /// + /// + /// When a property sheet is created, it is sized to fit its initial collection of pages. To maintain compatibility with previous + /// versions of the common controls, property sheets and wizards do not automatically resize themselves when pages are subsequently added + /// or removed. With common controls version 5.80 and later, applications should use the PropSheet_RecalcPageSizes macro after + /// adding or removing pages with PropSheet_AddPage, PropSheet_InsertPage, PropSheet_RemovePage, or their equivalent messages. It ensures + /// that the property sheet is properly sized for its current collection of pages. If this macro or the equivalent message is not used, + /// some property sheet pages may be truncated or too large. + /// + /// Note  This macro is not supported when using the Aero wizard style (PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_recalcpagesizes void PropSheet_RecalcPageSizes( hDlg ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_RecalcPageSizes")] + public static bool PropSheet_RecalcPageSizes(HWND hDlg) => + SendMessage(hDlg, PropSheetMessage.PSM_RECALCPAGESIZES) != IntPtr.Zero; + + /// Removes a page from a property sheet. You can use this macro or send the PSM_REMOVEPAGE message explicitly. + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// + /// Type: int + /// Zero-based index of the page to be removed. + /// + /// + /// Type: HPROPSHEETPAGE + /// Handle to the page to be removed. + /// + /// None + /// + /// + /// An application can specify the page to be removed by assigning a value to either index or hpage. If values are assigned + /// to both index and hpage, hpage takes precedence. + /// + /// + /// A number of messages and one function call occur while the property sheet is manipulating the list of pages. While this action is + /// taking place, attempting to modify the list of pages will have unpredictable results. Accordingly, you should not use the + /// PropSheet_RemovePage macro in your implementation of PropSheetPageProc or while handling the following notifications and + /// Windows messages. + /// + /// + /// + /// PSN_APPLY + /// + /// + /// PSN_KILLACTIVE + /// + /// + /// PSN_RESET + /// + /// + /// PSN_SETACTIVE + /// + /// + /// WM_DESTROY + /// + /// + /// WM_INITDIALOG + /// + /// + /// + /// If you need to modify a property sheet page while you are handling one of these messages or while PropSheetPageProc is in operation, + /// post yourself a private Windows message. Your application will not receive that message until after the property sheet manager has + /// finished its tasks. Then you can modify the list of pages. + /// + /// The following notifications are also affected by property sheet modification. + /// + /// + /// PSN_WIZBACK + /// + /// + /// PSN_WIZNEXT + /// + /// + /// + /// You can add or remove pages in response to these notifications, provided that you return (via DWL_MSGRESULT) a nonzero value to + /// specify the desired new page. Note, however, that if you remove a page that is located before the current page (that has a smaller + /// index than the current page), PSN_KILLACTIVE might be sent to the wrong page. + /// + /// Note  This macro is not supported when using the Aero wizard style (PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_removepage void PropSheet_RemovePage( hDlg, index, hpage ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_RemovePage")] + public static void PropSheet_RemovePage(HWND hDlg, int index, HPROPSHEETPAGE hpage) => + SendMessage(hDlg, PropSheetMessage.PSM_REMOVEPAGE, index, (IntPtr)hpage); + + /// + /// Sends a PSM_RESTARTWINDOWS message indicating that Windows needs to be restarted for changes to take effect. You can use this macro + /// or send the PSM_RESTARTWINDOWS message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// None + /// + /// + /// An application should send the PSM_RESTARTWINDOWS message only in response to the PSN_APPLY or PSN_KILLACTIVE notification code. + /// + /// + /// The PSM_RESTARTWINDOWS message causes the PropertySheet function to return the ID_PSRESTARTWINDOWS value, but only if the user clicks + /// the OK button to close the property sheet. It is the application's responsibility to restart Windows, which can be done by + /// using the ExitWindowsEx function. + /// + /// Note  This macro is not supported when using the Aero wizard style (PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_restartwindows void PropSheet_RestartWindows( hDlg ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_RestartWindows")] + public static void PropSheet_RestartWindows(HWND hDlg) => + SendMessage(hDlg, PropSheetMessage.PSM_RESTARTWINDOWS); + + /// Activates the specified page in a property sheet. You can use this macro or send the PSM_SETCURSEL message explicitly. + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// + /// Type: HPROPSHEETPAGE + /// + /// Handle to the page to activate. An application can specify the index or the handle, or both. If both are specified, hpage + /// takes precedence. + /// + /// + /// + /// Type: UINT + /// + /// Zero-based index of the page. An application can specify the index or the handle, or both. If both are specified, hpage takes precedence. + /// + /// + /// None + /// + /// The window that is losing the activation receives the PSN_KILLACTIVE notification code, and the window that is gaining the activation + /// receives the PSN_SETACTIVE notification code. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_setcursel void PropSheet_SetCurSel( hDlg, hpage, index ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_SetCurSel")] + public static bool PropSheet_SetCurSel(HWND hDlg, HPROPSHEETPAGE hpage, uint index) => + SendMessage(hDlg, PropSheetMessage.PSM_SETCURSEL, (IntPtr)index, (IntPtr)hpage) != IntPtr.Zero; + + /// + /// Activates the specified page in a property sheet based on the resource identifier of the page. You can use this macro or send the + /// PSM_SETCURSELID message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// + /// Type: int + /// Resource identifier of the page to activate. + /// + /// None + /// + /// The window that is losing the activation receives the PSN_KILLACTIVE notification code, and the window that is gaining the activation + /// receives the PSN_SETACTIVE notification code. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_setcurselbyid void PropSheet_SetCurSelByID( hDlg, id ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_SetCurSelByID")] + public static bool PropSheet_SetCurSelByID(HWND hDlg, int id) => + SendMessage(hDlg, PropSheetMessage.PSM_SETCURSELID, default, (IntPtr)id) != IntPtr.Zero; + + /// + /// Sets the text of the Finish button in a wizard, shows and enables the button, and hides the Next and Back buttons. You can use this + /// macro or send the PSM_SETFINISHTEXT message explicitly. + /// + /// + /// Type: HWND + /// Window handle (HWND) of the wizard property sheet. + /// + /// + /// Type: LPTSTR + /// Pointer to the new text for the Finish button. + /// + /// None + /// + /// By default, the Finish button does not have a keyboard accelerator. You can create a keyboard accelerator with this macro by + /// including an ampersand (&) in the text string that you assign to lpszText. For example, "&Finish" defines F as the + /// accelerator key. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_setfinishtext void PropSheet_SetFinishText( hDlg, + // lpszText ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_SetFinishText")] + public static void PropSheet_SetFinishText(HWND hDlg, string lpszText) => + SendMessage(hDlg, Marshal.SystemDefaultCharSize == 1 ? PropSheetMessage.PSM_SETFINISHTEXTA : PropSheetMessage.PSM_SETFINISHTEXTW, default, lpszText); + + /// + /// Sets the subtitle text for the header of a wizard's interior page. You can use this macro or send the PSM_SETHEADERSUBTITLE message explicitly. + /// + /// + /// Type: HWND + /// Handle to the wizard's window. + /// + /// + /// Type: int + /// Zero-based index of the page. + /// + /// + /// Type: LPCSTR + /// New header subtitle. + /// + /// None + /// + /// If you specify the current page, it will immediately be repainted to display the new subtitle. + /// Note  This macro is not supported when using the Aero wizard style (PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_setheadersubtitle void PropSheet_SetHeaderSubTitle( hDlg, + // index, lpszText ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_SetHeaderSubTitle")] + public static void PropSheet_SetHeaderSubTitle(HWND hDlg, int index, string lpszText) => + SendMessage(hDlg, Marshal.SystemDefaultCharSize == 1 ? PropSheetMessage.PSM_SETHEADERSUBTITLEA : PropSheetMessage.PSM_SETHEADERSUBTITLEW, (IntPtr)index, lpszText); + + /// + /// Sets the title text for the header of a wizard's interior page. You can use this macro or send the PSM_SETHEADERTITLE message explicitly. + /// + /// + /// Type: HWND + /// Handle to the wizard's window. + /// + /// + /// Type: int + /// Zero-based index of the page. + /// + /// + /// Type: LPCTSTR + /// New header title. + /// + /// None + /// If you specify the current page, it will immediately be repainted to display the new title. + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_setheadertitle void PropSheet_SetHeaderTitle( hDlg, + // index, lpszText ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_SetHeaderTitle")] + public static void PropSheet_SetHeaderTitle(HWND hDlg, int index, string lpszText) => + SendMessage(hDlg, Marshal.SystemDefaultCharSize == 1 ? PropSheetMessage.PSM_SETHEADERTITLEA : PropSheetMessage.PSM_SETHEADERTITLEW, (IntPtr)index, lpszText); + + /// Sets the text of the Next button in a wizard. You can use this macro or send the PSM_SETNEXTTEXT message explicitly. + /// + /// Type: HWND + /// Handle to the wizard. + /// + /// + /// Type: LPTSTR + /// Pointer to a buffer that contains the text. + /// + /// None + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_setnexttext void PropSheet_SetNextText( hDlg, lpszText ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_SetNextText")] + public static void PropSheet_SetNextText(HWND hDlg, string lpszText) => + SendMessage(hDlg, PropSheetMessage.PSM_SETNEXTTEXT, default, lpszText); + + /// Sets the title of a property sheet. You can use this macro or send the PSM_SETTITLE message explicitly. + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// + /// Type: DWORD + /// + /// Flag that indicates whether to include the prefix "Properties for" with the specified title string. If dwStyle is the + /// PSH_PROPTITLE value, the prefix is included. Otherwise, the prefix is not used. + /// + /// + /// + /// Type: LPTSTR + /// + /// Pointer to a buffer that contains the title string. If the HIWORD of this parameter is NULL, the property sheet loads the + /// string resource specified in the LOWORD. + /// + /// + /// None + /// + /// In an Aero Wizard, this macro can be used to change the title of an interior page dynamically; for example, when handling the + /// PSN_SETACTIVE notification. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_settitle void PropSheet_SetTitle( hDlg, wStyle, lpszText ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_SetTitle")] + public static void PropSheet_SetTitle(HWND hDlg, PropSheetHeaderFlags wStyle, ResourceId lpszText) => + SendMessage(hDlg, Marshal.SystemDefaultCharSize == 1 ? PropSheetMessage.PSM_SETTITLEA : PropSheetMessage.PSM_SETTITLEW, wStyle, (IntPtr)lpszText); + + /// + /// Enables or disables the Back, Next, and Finish buttons in a wizard by posting a PSM_SETWIZBUTTONS message. You can use this macro or + /// send the PSM_SETWIZBUTTONS message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// + /// Type: DWORD + /// A value that specifies which wizard buttons are enabled. You can combine one or more of the following flags. + /// + /// + /// Value + /// Meaning + /// + /// + /// PSWIZB_BACK + /// Enable the Back button. If this flag is not set, the Back button is displayed as disabled. + /// + /// + /// PSWIZB_DISABLEDFINISH + /// Display a disabled Finish button. + /// + /// + /// PSWIZB_FINISH + /// Display an enabled Finish button. + /// + /// + /// PSWIZB_NEXT + /// Enable the Next button. If this flag is not set, the Next button is displayed as disabled. + /// + /// + /// + /// None + /// + /// + /// This macro uses PostMessage to send the PSM_SETWIZBUTTONS message. If your notification handler calls PropSheet_SetWizButtons, + /// do nothing that will affect window focus until after the handler returns. For example, if you call MessageBox immediately after + /// calling PropSheet_SetWizButtons, the message box will receive focus. Since messages sent with PostMessage are not + /// delivered until they reach the head of the message queue, the PSM_SETWIZBUTTONS message will not be delivered until after the + /// wizard has lost focus to the message box. As a result, the property sheet will not be able to properly set the focus for the buttons. + /// + /// + /// Wizards display either three or four buttons below each page. This message is used to specify which buttons are enabled. Wizards + /// normally display Back, Cancel, and either a Next or Finish button. You typically enable only the Next button for the welcome page, + /// Next and Back for interior pages, and Back and Finish for the completion page. The Cancel button is always enabled. Normally, setting + /// PSWIZB_FINISH or PSWIZB_DISABLEDFINISH replaces the Next button with a Finish button. To display Next and Finish buttons + /// simultaneously, set the PSH_WIZARDHASFINISH FLAG in the dwFlags member of the wizard's PROPSHEETHEADER structure when you + /// create the wizard. Every page will then display all four buttons. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_setwizbuttons void PropSheet_SetWizButtons( hDlg, dwFlags ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_SetWizButtons")] + public static void PropSheet_SetWizButtons(HWND hDlg, PSWIZB dwFlags) => + PostMessage(hDlg, PropSheetMessage.PSM_SETWIZBUTTONS, default, (IntPtr)dwFlags); + + /// Show or hide buttons in a wizard. You can use this macro or send the PSM_SHOWWIZBUTTONS message explicitly. + /// + /// Type: HWND + /// Handle to the wizard. + /// + /// + /// Type: DWORD + /// + /// One or more of the following values that specify which property sheet buttons are to be shown. If a button value is included in both + /// this parameter and dwButton then it is shown. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// PSWIZB_BACK + /// 0x0001. The Back button. + /// + /// + /// PSWIZB_NEXT + /// 0x0002. The Next button. + /// + /// + /// PSWIZB_FINISH + /// 0x0004. The Finish button. + /// + /// + /// PSWIZB_CANCEL + /// 0x0010. The Cancel button. + /// + /// + /// PSWIZB_SHOW + /// Set only this flag (defined as zero) to hide all buttons specified in dwButton. + /// + /// + /// PSWIZB_RESTORE + /// Not implemented. + /// + /// + /// + /// + /// Type: DWORD + /// + /// One or more of the same values used in dwFlag. Here, they specify which property sheet buttons are to be shown or hidden. If a + /// button value appears in this parameter but not in dwFlag, it indicates that the button should be hidden. + /// + /// + /// None + /// The following example code hides the Back button and shows the Next button. + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_showwizbuttons void PropSheet_ShowWizButtons( hDlg, + // dwFlag, dwButton ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_ShowWizButtons")] + public static void PropSheet_ShowWizButtons(HWND hDlg, PSWIZB dwFlag, PSWIZB dwButton) => + SendMessage(hDlg, (uint)PropSheetMessage.PSM_SHOWWIZBUTTONS, (IntPtr)(int)dwFlag, (IntPtr)(int)dwButton); + + /// + /// Informs a property sheet that information in a page has reverted to the previously saved state. You can use this macro or send the + /// PSM_UNCHANGED message explicitly. + /// + /// + /// Type: HWND + /// Handle to the property sheet. + /// + /// + /// Type: HWND + /// Handle to the page that has reverted to the previously saved state. + /// + /// None + /// + /// The property sheet disables the Apply Now button if no other pages have registered changes with the property sheet. + /// Note  This macro is not supported when using the Aero wizard style (PSH_AEROWIZARD). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/prsht/nf-prsht-propsheet_unchanged void PropSheet_UnChanged( hDlg, hwnd ); + [PInvokeData("prsht.h", MSDNShortId = "NF:prsht.PropSheet_UnChanged")] + public static void PropSheet_UnChanged(HWND hDlg, HPROPSHEETPAGE hwnd) => + SendMessage(hDlg, PropSheetMessage.PSM_UNCHANGED, (IntPtr)hwnd, 0); + /// Defines the frame and pages of a property sheet. [PInvokeData("Commctrl.h", MSDNShortId = "bb774546")] [StructLayout(LayoutKind.Sequential)] public struct PROPSHEETHEADER { /// - /// Size, in bytes, of this structure. The property sheet manager uses this member to determine which version of the - /// PROPSHEETHEADER structure you are using. For more information, see the Remarks. + /// Size, in bytes, of this structure. The property sheet manager uses this member to determine which version of the PROPSHEETHEADER + /// structure you are using. For more information, see the Remarks. /// public uint dwSize; @@ -543,28 +3337,28 @@ public static partial class ComCtl32 public HWND hwndParent; /// - /// Handle to the instance from which to load the icon or title string resource. If the pszIcon or pszCaption member identifies - /// a resource to load, this member must be specified. + /// Handle to the instance from which to load the icon or title string resource. If the pszIcon or pszCaption member identifies a + /// resource to load, this member must be specified. /// public HINSTANCE hInstance; /// - /// Handle to the icon to use as the small icon in the title bar of the property sheet dialog box. If the dwFlags member does - /// not include PSH_USEHICON, this member is ignored. This member is declared as a union with pszIcon. + /// Handle to the icon to use as the small icon in the title bar of the property sheet dialog box. If the dwFlags member does not + /// include PSH_USEHICON, this member is ignored. This member is declared as a union with pszIcon. /// OR /// - /// String icon resource to use as the small icon in the title bar of the property sheet dialog box. This member can specify - /// either the identifier of the icon resource or the address of the string that specifies the name of the icon resource. If the - /// dwFlags member does not include PSH_USEICONID, this member is ignored. This member is declared as a union with hIcon. + /// String icon resource to use as the small icon in the title bar of the property sheet dialog box. This member can specify either + /// the identifier of the icon resource or the address of the string that specifies the name of the icon resource. If the dwFlags + /// member does not include PSH_USEICONID, this member is ignored. This member is declared as a union with hIcon. /// /// public ResourceIdOrHandle pIcon; /// - /// Title of the property sheet dialog box. This member can specify either the identifier of a string resource or the address of - /// a string that specifies the title. If the dwFlags member includes PSH_PROPTITLE, the string "Properties for" is inserted at - /// the beginning of the title. This field is ignored for Wizard97 wizards. For Aero wizards, the string alone is used for the - /// caption, regardless of whether the PSH_PROPTITLE flag is set. + /// Title of the property sheet dialog box. This member can specify either the identifier of a string resource or the address of a + /// string that specifies the title. If the dwFlags member includes PSH_PROPTITLE, the string "Properties for" is inserted at the + /// beginning of the title. This field is ignored for Wizard97 wizards. For Aero wizards, the string alone is used for the caption, + /// regardless of whether the PSH_PROPTITLE flag is set. /// public ResourceId pszCaption; @@ -572,8 +3366,8 @@ public static partial class ComCtl32 public uint nPages; /// - /// Zero-based index of the initial page that appears when the property sheet dialog box is created. This member is declared as - /// a union with pStartPage. + /// Zero-based index of the initial page that appears when the property sheet dialog box is created. This member is declared as a + /// union with pStartPage. /// OR /// /// Name of the initial page that appears when the property sheet dialog box is created. This member can specify either the @@ -584,29 +3378,27 @@ public static partial class ComCtl32 /// /// Pointer to an array of PROPSHEETPAGE structures that define the pages in the property sheet. If the dwFlags member does not - /// include PSH_PROPSHEETPAGE, this member is ignored. Note that the PROPSHEETPAGE structure is variable in size. Applications - /// that parse the array pointed to by ppsp must take the size of each page into account. This member is declared as a union - /// with phpage. + /// include PSH_PROPSHEETPAGE, this member is ignored. Note that the PROPSHEETPAGE structure is variable in size. Applications that + /// parse the array pointed to by ppsp must take the size of each page into account. This member is declared as a union with phpage. /// OR /// /// Pointer to an array of handles to the property sheet pages. Each handle must have been created by a previous call to the - /// CreatePropertySheetPage function. If the dwFlags member includes PSH_PROPSHEETPAGE, phpage is ignored and should be set to - /// NULL. When the PropertySheet function returns, any HPROPSHEETPAGE handles in the phpage array will have been destroyed. This - /// member is declared as a union with ppsp. + /// CreatePropertySheetPage function. If the dwFlags member includes PSH_PROPSHEETPAGE, phpage is ignored and should be set to NULL. + /// When the PropertySheet function returns, any HPROPSHEETPAGE handles in the phpage array will have been destroyed. This member is + /// declared as a union with ppsp. /// /// public IntPtr phpage; /// - /// Pointer to an application-defined callback function that is called when the property sheet is initialized. For more - /// information about the callback function, see the description of the PropSheetProc function. If the dwFlags member does not - /// include PSH_USECALLBACK, this member is ignored. + /// Pointer to an application-defined callback function that is called when the property sheet is initialized. For more information + /// about the callback function, see the description of the PropSheetProc function. If the dwFlags member does not include + /// PSH_USECALLBACK, this member is ignored. /// public PropSheetProc pfnCallback; /// - /// Version 5.80 or later. Handle to the watermark bitmap. If the dwFlags member does not include PSH_USEHBMWATERMARK, this - /// member is ignored. + /// Version 5.80 or later. Handle to the watermark bitmap. If the dwFlags member does not include PSH_USEHBMWATERMARK, this member is ignored. /// OR /// /// Version 5.80 or later. Bitmap resource to use as the watermark. This member can specify either the identifier of the bitmap @@ -617,8 +3409,8 @@ public static partial class ComCtl32 public ResourceIdOrHandle hbmWatermark; /// - /// Version 5.80 or later. HPALETTE structure used for drawing the watermark bitmap and/or header bitmap. If the dwFlags member - /// does not include PSH_USEHPLWATERMARK, this member is ignored. + /// Version 5.80 or later. HPALETTE structure used for drawing the watermark bitmap and/or header bitmap. If the dwFlags member does + /// not include PSH_USEHPLWATERMARK, this member is ignored. /// public HPALETTE hplWatermark; @@ -626,9 +3418,9 @@ public static partial class ComCtl32 /// Version 5.80 or later. Handle to the header bitmap. If the dwFlags member does not include PSH_USEHBMHEADER, this member is ignored. /// OR /// - /// Version 5.80 or later. Bitmap resource to use as the header. This member can specify either the identifier of the bitmap - /// resource or the address of the string that specifies the name of the bitmap resource. If the dwFlags member includes - /// PSH_USEHBMHEADER, this member is ignored. + /// Version 5.80 or later. Bitmap resource to use as the header. This member can specify either the identifier of the bitmap resource + /// or the address of the string that specifies the name of the bitmap resource. If the dwFlags member includes PSH_USEHBMHEADER, + /// this member is ignored. /// /// public ResourceIdOrHandle hbmHeader; @@ -659,21 +3451,21 @@ public static partial class ComCtl32 private IntPtr _pszTemplate; /// - /// Handle to the icon to use as the icon in the tab of the page. If the dwFlags member does not include PSP_USEHICON, this - /// member is ignored. This member is declared as a union with pszIcon. + /// Handle to the icon to use as the icon in the tab of the page. If the dwFlags member does not include PSP_USEHICON, this member is + /// ignored. This member is declared as a union with pszIcon. /// OR /// - /// Icon resource to use as the icon in the tab of the page. This member can specify either the identifier of the icon resource - /// or the address of the string that specifies the name of the icon resource. To use this member, you must set the - /// PSP_USEICONID flag in the dwFlags member. This member is declared as a union with hIcon. + /// Icon resource to use as the icon in the tab of the page. This member can specify either the identifier of the icon resource or + /// the address of the string that specifies the name of the icon resource. To use this member, you must set the PSP_USEICONID flag + /// in the dwFlags member. This member is declared as a union with hIcon. /// /// private IntPtr _hIcon; /// /// Title of the property sheet dialog box. This title overrides the title specified in the dialog box template. This member can - /// specify either the identifier of a string resource or the address of a string that specifies the title. To use this member, - /// you must set the PSP_USETITLE flag in the dwFlags member. + /// specify either the identifier of a string resource or the address of a string that specifies the title. To use this member, you + /// must set the PSP_USETITLE flag in the dwFlags member. /// private IntPtr _pszTitle; @@ -685,23 +3477,21 @@ public static partial class ComCtl32 public DialogProc? pfnDlgProc; /// - /// When the page is created, a copy of the page's PROPSHEETPAGE structure is passed to the dialog box procedure with a - /// WM_INITDIALOG message. The lParam member is provided to allow you to pass application-specific information to the dialog box - /// procedure. It has no effect on the page itself. For more information, see Property Sheet Creation. + /// When the page is created, a copy of the page's PROPSHEETPAGE structure is passed to the dialog box procedure with a WM_INITDIALOG + /// message. The lParam member is provided to allow you to pass application-specific information to the dialog box procedure. It has + /// no effect on the page itself. For more information, see Property Sheet Creation. /// public IntPtr lParam; /// - /// Pointer to an application-defined callback function that is called when the page is created and when it is about to be - /// destroyed. For more information about the callback function, see PropSheetPageProc. To use this member, you must set the - /// PSP_USECALLBACK flag in the dwFlags member. + /// Pointer to an application-defined callback function that is called when the page is created and when it is about to be destroyed. + /// For more information about the callback function, see PropSheetPageProc. To use this member, you must set the PSP_USECALLBACK + /// flag in the dwFlags member. /// [MarshalAs(UnmanagedType.FunctionPtr)] private PropSheetPageProc? _pfnCallback; - /// - /// Pointer to the reference count value. To use this member, you must set the PSP_USEREFPARENT flag in the dwFlags member. - /// + /// Pointer to the reference count value. To use this member, you must set the PSP_USEREFPARENT flag in the dwFlags member. private IntPtr _pcRefParent; /// @@ -738,9 +3528,9 @@ public static partial class ComCtl32 private IntPtr _pszHeaderSubTitle; /// - /// Version 6.0 or later. An activation context handle. Set this member to the handle that is returned when you create the - /// activation context with CreateActCtx. The system will activate this context before creating the dialog box. You do not need - /// to use this member if you use a global manifest. + /// Version 6.0 or later. An activation context handle. Set this member to the handle that is returned when you create the activation + /// context with CreateActCtx. The system will activate this context before creating the dialog box. You do not need to use this + /// member if you use a global manifest. /// public HACTCTX hActCtx; @@ -765,8 +3555,8 @@ public static partial class ComCtl32 /// /// A pointer to a dialog box template in memory. The PropertySheet function assumes that the template is in writeable memory; a - /// read-only template will cause an exception on some versions of Windows. If dwFlags does not include the PSP_DLGINDIRECT - /// value, this member is ignored. + /// read-only template will cause an exception on some versions of Windows. If dwFlags does not include the PSP_DLGINDIRECT value, + /// this member is ignored. /// public IntPtr pResource { @@ -780,8 +3570,8 @@ public static partial class ComCtl32 } /// - /// A handle to the icon to use as the small icon in the tab for the page. If dwFlags does not include the PSP_USEHICON value, - /// this member is ignored. + /// A handle to the icon to use as the small icon in the tab for the page. If dwFlags does not include the PSP_USEHICON value, this + /// member is ignored. /// public HICON hIcon { @@ -796,8 +3586,8 @@ public static partial class ComCtl32 /// /// Icon resource to use as the small icon in the tab for the page. This member can specify either the identifier of the icon - /// resource or the pointer to the string that specifies the name of the icon resource. If dwFlags does not include the - /// PSP_USEICONID value, this member is ignored. + /// resource or the pointer to the string that specifies the name of the icon resource. If dwFlags does not include the PSP_USEICONID + /// value, this member is ignored. /// public SafeResourceId pszIcon { @@ -878,9 +3668,9 @@ public static partial class ComCtl32 } /// - /// Pointer to an application-defined callback function that is called when the page is created and when it is about to be - /// destroyed. For more information about the callback function, see PropSheetPageProc. To use this member, you must set the - /// PSP_USECALLBACK flag in the dwFlags member. + /// Pointer to an application-defined callback function that is called when the page is created and when it is about to be destroyed. + /// For more information about the callback function, see PropSheetPageProc. To use this member, you must set the PSP_USECALLBACK + /// flag in the dwFlags member. /// public PropSheetPageProc? pfnCallback { @@ -892,9 +3682,7 @@ public static partial class ComCtl32 } } - /// - /// Pointer to the reference count value. To use this member, you must set the PSP_USEREFPARENT flag in the dwFlags member. - /// + /// Pointer to the reference count value. To use this member, you must set the PSP_USEREFPARENT flag in the dwFlags member. public IntPtr pcRefParent { get => _pcRefParent; @@ -913,6 +3701,7 @@ public static partial class ComCtl32 FreeResource(ref _pszTitle); FreeResource(ref _pszHeaderTitle); FreeResource(ref _pszHeaderSubTitle); + GC.SuppressFinalize(this); } private static IntPtr GetClonedHandle(SafeResourceId rid) => rid == null ? IntPtr.Zero : (rid.IsIntResource ? rid.DangerousGetHandle() : StringHelper.AllocString(rid.ToString()));