NativeDialogs icon indicating copy to clipboard operation
NativeDialogs copied to clipboard

NativeDialogs requires a proper manifest file under windows

Open francesco-cattoglio opened this issue 5 years ago • 0 comments

Hi there! First and foremost, thank you SO MUCH for this library, it is really nice and useful. I have been using this under the MSYS2/MinGW64 toolchain, and I have encountered two problems when compiling and running code containing the MessageDialog functions. The first is trivial: there is a #pragma to link to comctl32.dll, but MinGW ignores that, so one needs to manually pass the -lcomctl32 flag to the linker. The second is much more convoluted and it took me several hours to overcome: linking to comctl32 is not enough, one must specify which version of the library needs to be used, otherwise you will get an error related to "not being able to find the dll entrypoint for TaskDialogIndirect" at runtime. The solution is adding the following to your manifest file:

<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="*"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>

This all boils down to the fact that TaskDialog() and TaskDialogIndirect() were introduced in Windows Vista, while the default manifest file that MinGW64 adds to your executable is Windows XP compatible, so there is some kind of "dll mismatch". This is not an issue of the library per-se, but I think it would be nice to add something to the README for non-MSVC users.

francesco-cattoglio avatar May 10 '19 12:05 francesco-cattoglio