From 6ef4bb1698b025e349a7dc3bafd017d44afbd6db Mon Sep 17 00:00:00 2001 From: dahall Date: Wed, 22 Apr 2020 09:54:00 -0600 Subject: [PATCH] Fixed problem (#118) with TASKDIALOGCONFIG not working under x64 builds. --- PInvoke/ComCtl32/CommCtrl.TaskDialog.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/PInvoke/ComCtl32/CommCtrl.TaskDialog.cs b/PInvoke/ComCtl32/CommCtrl.TaskDialog.cs index 0f226aa0..9f06c128 100644 --- a/PInvoke/ComCtl32/CommCtrl.TaskDialog.cs +++ b/PInvoke/ComCtl32/CommCtrl.TaskDialog.cs @@ -453,7 +453,7 @@ namespace Vanara.PInvoke /// [PInvokeData("Commctrl.h", MSDNShortId = "bb760544")] [DllImport(Lib.ComCtl32, CharSet = CharSet.Unicode, ExactSpelling = true)] - public static extern HRESULT TaskDialogIndirect(TASKDIALOGCONFIG pTaskConfig, out int pnButton, out int pnRadioButton, [MarshalAs(UnmanagedType.Bool)] out bool pfVerificationFlagChecked); + public static extern HRESULT TaskDialogIndirect([In] TASKDIALOGCONFIG pTaskConfig, out int pnButton, out int pnRadioButton, [MarshalAs(UnmanagedType.Bool)] out bool pfVerificationFlagChecked); /// /// The TASKDIALOG_BUTTON structure contains information used to display a button in a task dialog. The TASKDIALOGCONFIG structure @@ -480,7 +480,7 @@ namespace Vanara.PInvoke /// // https://docs.microsoft.com/en-us/windows/desktop/api/commctrl/ns-commctrl-_taskdialogconfig [PInvokeData("commctrl.h", MSDNShortId = "bb787473")] - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 1)] public class TASKDIALOGCONFIG : IDisposable { /// Specifies the structure size, in bytes. @@ -641,6 +641,11 @@ namespace Vanara.PInvoke /// A pointer to application-defined reference data. This value is defined by the caller. public IntPtr lpCallbackData; + /// + /// The width of the task dialog's client area, in dialog units. If 0, the task dialog manager will calculate the ideal width. + /// + public uint cxWidth; + /// /// Initializes a new instance of the class setting the field properly. /// @@ -649,11 +654,6 @@ namespace Vanara.PInvoke cbSize = (uint)Marshal.SizeOf(typeof(TASKDIALOGCONFIG)); } - /// - /// The width of the task dialog's client area, in dialog units. If 0, the task dialog manager will calculate the ideal width. - /// - public uint cxWidth; - /// /// The string to be used for the task dialog title. If this parameter is NULL, the filename of the executable program is used. ///