Excel-DNA / ExcelDna

Excel-DNA - Free and easy .NET for Excel. This repository contains the core Excel-DNA library.
https://excel-dna.net
zlib License
1.3k stars 276 forks source link

Excel-DNA does does not enable Visual Styles (loads old version of COMCTL32) #257

Open iainb123 opened 5 years ago

iainb123 commented 5 years ago

Hi,

I'm having a problem with common controls (e.g. ListView) when created from within the Excel add-in - they appear to be using an older version of the common controls libraries. This is annoying as I'd like to use some of the newer features like the sort indicators in the list view etc.

It looks like there is a workaround if I can create a resource of type RT_RESOURCE with value ISOLATIONAWARE_MANIFEST_RESOURCE_ID as described here: https://stackoverflow.com/questions/46176073/ms-excel-sdk-issue-cant-use-tooltip-in-tree-view-control-in-xll-add-in

There's an example of suitable manifests to solve the common controls issue here: https://docs.microsoft.com/en-us/windows/win32/controls/cookbook-overview#using-comctl32-version-6-in-control-panel-or-a-dll-that-is-run-by-rundll32exe

The problem I'm having is that I don't seem to get the manifest embedded in the resulting add-in - I see a NULL context when I call GetCurrentActCtx (with a success code). I'm following the instructions on MSDN (https://blogs.msdn.microsoft.com/cheller/2006/08/24/how-to-embed-a-manifest-in-an-assembly-let-me-count-the-ways/)

Has anyone else found a way of using the latest version of the common controls in their ExcelDNA add-in, or a way around this manifest issue? If I look at the generated DLL with ildasm I can see there's a manifest, but it doesn't seem to include the XML specifying the latest version of the common controls DLL.

augustoproiete commented 5 years ago

@iainb123 Would you be able to put together an example project that reproduces this issue, as well as screenshots of actual vs expected appearance of controls?

iainb123 commented 5 years ago

Thank you for responding, but we gave up on this route and went for a custom control in the end. In our case it made for simpler code in C# than accessing the real control’s functionality, although it doesn’t look quite the same.

Iain


From: C. Augusto Proiete notifications@github.com Sent: Sunday, October 20, 2019 7:02 pm To: Excel-DNA/ExcelDna Cc: iainb123; Mention Subject: Re: [Excel-DNA/ExcelDna] Common Controls version (#257)

@iainb123https://github.com/iainb123 Would you be able to put together an example project that reproduces this issue, as well as screenshots of actual vs expected appearance of controls?

augustoproiete commented 3 years ago

I was able to reproduce this with an Excel add-in and can see that Visual Styles are not enabled.

Windows MessageBox on a regular .NET app (Visual Styles enabled by default):

image

Windows MessageBox on an Excel-DNA add-in (Visual Styles not enabled by default):

image