I am writing an application and wanted to use the TaskDialogIndirect
function - however I did not want to write a huge amount of P/Invoke stuff etc. so I have included the WinAPICodePack. There is one problem though! When I create a control for the TaskDialog
and add it to the dialog everything works fine. However running the Show
methods results in an OverflowException
in mscorlib. I tracked this down to some pointer handling and marshalling.
Experimenting with the code had the result, that I found out, that the DLL MUST be compiled for .NET 3.5 and the including app TOO. Having my app on .NET 4.0 invokes this error... any idea about a workaround - or can you even reproduce this error?
Another issue is that I can set the the Icon
property to whatevery I want, but the icon is not shown at all. I have to setup an Opened
event which dynamically sets the icon...
Information: Running Visual Studio 2012 RTM on Windows 8 Pro x64 RTM. Application is a standard WPF app.
Sample code:
TaskDialog td = new TaskDialog();
td.Cancelable = true;
td.Caption = "Caption";
td.InstructionText = "Instructions";
td.Text = "Text";
TaskDialogCommandLink buttonElevation =
new TaskDialogCommandLink("elevation", "Elevation Required Sample");
buttonElevation.UseElevationIcon = true;
td.Controls.Add(buttonElevation);
td.Show(); // OverflowException occurs here!