VTI71.DLL Give error du0x80004005 in c# project

0

I am try to automate Gupta's Team Developer control as mention in

Centura Gupta Team Developer Automation Possibility

I download 32-bit trial version of Team Developer 7.1

[DllImport("user32.dll")]
        static extern IntPtr WindowFromPoint(System.Drawing.Point p);     

        [DllImport("User32.dll", SetLastError = true, CharSet = CharSet.Auto)]
        static extern long GetClassName(IntPtr hwnd, StringBuilder lpClassName, long nMaxCount);

        const string guptadllpath = @"C:\program files (x86)\gupta\team developer 7.1\VTI71.DLL";        
        [DllImport(guptadllpath)]
        extern static int VisTblFindString(IntPtr hwndTable, int lStartRow, IntPtr hwndColumn, string lpctszSearchFor);

        IntPtr _wndFromPoint;
        private void MainForm_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                Cursor.Current = Cursors.Default;
                Point p = PointToScreen(e.Location);

                _wndFromPoint = WindowFromPoint(p);

                StringBuilder classText = new StringBuilder(256);
                GetClassName(_wndFromPoint, classText, 256);

                listBox1.Items.Add("Class: " + classText);

                int a = VisTblFindString(_wndFromPoint, 0, IntPtr.Zero, "Pat");

                this.Text = a.ToString();
            }
        }

But give me below error:

System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.

My sample application isenter image description here

Please suggest me how to resolve this error. Is it correct way to use Gupta's dll in c# for automate?

Thanks,

sqlbase
guptateamdeveloper
asked on Stack Overflow Aug 30, 2018 by mahen • edited Aug 30, 2018 by mahen

2 Answers

1

Calling VisTblFindString(..) from outside won't work. Even though the function takes a window handle as a parameter this will only work from inside the "grid-application". The reason is that one process cannot peek into the memory of another process (ok you can use GetWindowText(..) but this is not applicable here since in a grid not every cell is a distinct window).

You have to set up some interprocess-communication. Unfortunately in gupta grid there are no built-in functions that support this. The only way I see is that you have to modify the grid-application (not sure if you control the source code of it). If you have the possibility to modify it then you can implement automation e.g. via Windows messages.

answered on Stack Overflow Aug 31, 2018 by Thomas Uttendorfer • edited Aug 31, 2018 by Thomas Uttendorfer
0

I dont know c# from a bar of soap - but if you are using the dll outside of TeamDeveloper, it could be the way you have imported it , or you haven't registered the dll, or you dont have a license to use it outside of TeamDeveloper , or you should be using the 64bit version. A Trial license may not cut it. But I'm just guessing here.

answered on Stack Overflow Aug 31, 2018 by GuptaSteve

User contributions licensed under CC BY-SA 3.0