0

I’m at the moment automating the test for a legacy application developed in vb6, which uses a GridEx2000b Control from Janus Systems.

For doing this I’m using Ranorex as my favorite tool for developing the test automation, so that I can develop the test code using c#.

My problem now is to automate the GridEx 2000b control, which Ranorex out of-the-box don’t have any support for. Therefore I’m trying to figure out a solution where I can reference the GrixEx control using the Win32 handle I can find for the control, so I can use the ComInterface from the component to navigate the automate the control.

I have an idea of a solution but I cannot figure out how to do it, where I hope that you guys would be able help me.

The pseudo code for the problem:

using GridEX20;

class GridExWrapper
{
    public GridEX20.GridEXClass Instance;

    public GridExWrapper(IntPtr win32handle)
    {
        Instance = (GridEX20.GridEXClass)Win32ControlUtilities.GetControlReference(win32Handle);
    }
}


class Win32ControlUtilities
{
    public static SomeKindOfHandle GetControlReference(IntPtr win32Handle)
    {
        ...
        ...
        ...
    }
}

I’ll get the win32handle from Ranorex or some other spy tool. Then I can use the GridExWrapper like this.

using NUnit.Framework;

class Program
{
    [Test]
    public void control_should_have_9_items()
    {
        /// Get win32 handle from Ranorex
        IntPtr win32handle = XXXXXX;
        int expectedItemCount = 9;

        GridEXClass control = new GridExWrapper(win32handle);
        Assert.AreEqual(expectedItemCount, control.ItemCount);
    }

}
  • I'm not familiar with this control, so: what kind of thing is `GetControlReference()` supposed to return? What does that function do? – andlabs Feb 10 '15 at 21:28
  • The control it self, GridEx2000 is not really the case, it could be whatever OCX Control embedded into any VB6 application. – Jakob Ojvind Nielsen Feb 12 '15 at 07:51
  • The GrixEx is an OCX Control used in an VB6 application. The GetControlReference isn't an existing method, but an attempt to simulate the idea of what I want to achieve. I want somehow to marshal or hook into the OCX Control in the VB6 application, so that I can use the same gridex interop class and have an object that I can control within .Net. A form of remote control of the object within the VB6 application. – Jakob Ojvind Nielsen Feb 12 '15 at 07:57

1 Answers1

0

You could try the Microsoft UI Automation library (System.Windows.Automation) for identifying the properties of the control. Sometimes even if Ranorex fails, MSUIA manages to recognize the control as it looks into native properties of a control for identification. Not guaranteed but worth a try.Here is a link to a tutorial on using MSUIA.

Sanjit Misra
  • 159
  • 1
  • 8