This is a migrated thread and some comments may be shown as answers.

RadMenu Excel Add In

3 Answers 80 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Christian
Top achievements
Rank 1
Christian asked on 01 Mar 2019, 07:21 AM

Hello,

using the RadMenu inside Winforms in an Excel Add In leads to problems:

  • Excel exits with code > 0, which means there was a problem
  • Excel (sometimes) takes 3-5 seconds to close 
  • Excel sometimes restarts after closing (which is the main problem, because it's very annoying for the customers)

Attached is a simple test project

  1. Run the project
  2. Click the "button2" (a simple form with a RadMenu opens)
  3. Close excel directly (do not close the form first!)

From what I've found, I think it has to do with some kind of animation thread... ?

Kind regards,

Christian

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 01 Mar 2019, 12:57 PM
Hello, Christian,         

The provided sample project is greatly appreciated. Please note that our controls are designed to work as stand alone applications rather than add-ins, so some side effects may occur.

However, I have logged it in our feedback portal by creating a public item on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Christian
Top achievements
Rank 1
answered on 01 Mar 2019, 02:36 PM

Hi Dess,

using the default .net WinForms menu does't cause any problems, so I think it must be something which the RadMenu does differently.

Your suggestion to close the form before excel closes is ok ... but regarding a VSTO add in not really feasible.

  • There is no central list of opened forms (a standalone application would have "Application.OpenForms")
  • There is no 100% way to do stuff while excel closes (if there is any operation which does take to much time ... excel closes ... it does not care if there is anything running)

Christian

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 06 Mar 2019, 07:34 AM
Hello, Christian,    
 
RadMenu internally uses a RadMessageFilter for handling the shortcuts that may be added to the menu. It uses Hooks rather than the IMessageFilter interface. This is needed because sometimes we are in an unmanaged environment (like in MFC or in Outlook). We have further reviewed the code in the RadMenu and it seems that we properly manage the Hooks. However, I suppose that Excel somehow also uses it when the form is closed when closing the Excel instance. This causes the exception and application hanging.

I am not sure exactly how this can be managed without affecting the shortcuts. But the possible solution that I can suggest is to create a custom RadMenu and override its OnLoad method as it is demonstrated below. It is required not to use shortcuts for the menu in this case:

public class CustomMenu : RadMenu
{
    protected override void OnLoad(System.Drawing.Size desiredSize)
    {
        base.OnLoad(desiredSize);
        if (!this.IsDesignMode)
        {
            RadMessageFilter.Instance.RemoveListener(this);
        }
    }
 
    public override string ThemeClassName 
    {
        get
        {
            return typeof(RadMenu).FullName; 
        }
    }
}

I hope this information helps. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Menu
Asked by
Christian
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Christian
Top achievements
Rank 1
Share this question
or