Get Spread control from a windows handle?

Posted by: thomas.rutledge on 27 February 2024, 6:03 am EST

  • Posted 27 February 2024, 6:03 am EST

    We’re working with some UI test automation. If we have a windows handle, how can we find the spread control? We’re using Spread 15.

  • Posted 27 February 2024, 8:09 pm EST

    Hi Thomas,

    You can find the Form control that contains the FpSpread control by using the window handle with the Control’s FromHandle method. After that, you can find the FpSpread control in the Controls collection of the form. The code snippet is provided below:

    var formWindow = Control.FromHandle(this.Handle) as Form1; //You can replace "this.Handle" with the Form1 window handle
    if (formWindow != null)
    {
        var spControl = formWindow.Controls.Find("fpSpread1", false);
        if (spControl != null)
        {
            Debug.WriteLine("FpSpread control found...");
        }
    }

    Refer WinHandle.zip for full implementation.

    This process is a general way to find a control using its window handle, and it’s not specific to the Spread.NET product. For more information, you can also refer to help links available online, depending on the methods and tools you are using for UI Automation testing in your application.

    If you need any further help regarding this issue, we request you provide us with more details about your use-case scenario with a small sample application implementing the same.

    Thanks & Regards,

    Aastha

  • Posted 4 March 2024, 11:10 pm EST

    Thanks for the reply.

    Do you have a recommended way to communicate from a separate test automation process to an instance of a spread.net control? The above code only works inside a single process. We’re wondering if there is a better way other than overriding WndProc and creating Application-Defined Messages.

    Any insights to how you internally test Spread.NET will help.

  • Posted 5 March 2024, 10:34 pm EST

    Hi Thomas,

    We are in discussions with the developers regarding this requirement. [Internal Tracking ID: SPNET-34760]

    We will update you on this as soon as we hear back from them.

    Thanks & Regards,

    Aastha

  • Posted 6 March 2024, 3:34 pm EST

    Hi Thomas,

    Currently, we do not provide support for UI automation testing for FpSpread control via testing tools.

    There are no immediate plans to add this support, but we’ll keep you informed if the developers decide to consider it in the future.

    Apologies for the inconvenience caused.

    Thanks & Regards,

    Aastha

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels