RadMenu Excel Add In

4 posts, 0 answers
  1. Christian
    Christian avatar
    44 posts
    Member since:
    May 2012

    Posted 01 Mar Link to this post

    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

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3195 posts

    Posted 01 Mar Link to this post

    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.
  3. Christian
    Christian avatar
    44 posts
    Member since:
    May 2012

    Posted 01 Mar Link to this post

    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

  4. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3195 posts

    Posted 06 Mar Link to this post

    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.
Back to Top