예제 #1
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            try
            {
                MODSDK.POINT point = new MODSDK.POINT();
                point.x = 1;
                point.y = 2;

                MODSDK.JTPOLYGON_INFO jtPolygonInfo = new MODSDK.JTPOLYGON_INFO();
                jtPolygonInfo.wType       = 2;
                jtPolygonInfo.wPointCount = 333;

                //IntPtr pPoint = Marshal.AllocCoTaskMem(Marshal.SizeOf(point));
                //Marshal.StructureToPtr(point, pPoint, false);
                //jtPolygonInfo.pPoints = pPoint;

                //jtPolygonInfo.pPoints.x = 1;
                //jtPolygonInfo.pPoints.y = 2;


                MODSDK.JtModTest(ref jtPolygonInfo);


                //MODSDK.POINT newPoint = (MODSDK.POINT)Marshal.PtrToStructure(jtPolygonInfo.pPoints, typeof(MODSDK.POINT));
                //// 释放在非托管代码中分配的Point实例内存
                //Marshal.DestroyStructure(pPoint, typeof(MODSDK.POINT));
            }
            catch (DllNotFoundException dllNotFoundExc)
            {
                Console.WriteLine("DllNotFoundException was detected, "
                                  + "error message: \r\n{0}", dllNotFoundExc.Message);
            }
        }
예제 #2
0
        private void btnCallModCreate_Click(object sender, EventArgs e)
        {
            del = new MODSDK.CMP_FRAME_INFO_DELEGATE(onCallback);


            MODSDK.POINT point1 = new MODSDK.POINT();
            point1.x = line[0, 0];
            point1.y = line[0, 1];

            MODSDK.POINT point2 = new MODSDK.POINT();
            point2.x = line[1, 0];
            point2.y = line[1, 1];

            MODSDK.POINT[] points = new MODSDK.POINT[] { point1, point2 };

            MODSDK.JTPOLYGON_INFO jtPolygonInfo = new MODSDK.JTPOLYGON_INFO();
            jtPolygonInfo.wType       = 3;
            jtPolygonInfo.wPointCount = 2;

            IntPtr pPoint  = Marshal.AllocCoTaskMem(Marshal.SizeOf(point1) * points.Length);
            long   LongPtr = pPoint.ToInt64(); // Must work both on x86 and x64

            foreach (MODSDK.POINT p in points)
            {
                IntPtr ptr = new IntPtr(LongPtr);
                Marshal.StructureToPtr(p, ptr, false);
                LongPtr += Marshal.SizeOf(typeof(Point));
            }
            jtPolygonInfo.pPoints = pPoint;
            //jtPolygonInfo.pPoints = new IntPtr(LongPtr);


            MODSDK.JTMOD_OPEN_PARAM jtOpenParam = new MODSDK.JTMOD_OPEN_PARAM();
            jtOpenParam.size      = (ushort)Marshal.SizeOf(jtOpenParam);
            jtOpenParam.nWidth    = (ushort)picCapture.Width;
            jtOpenParam.nHeight   = (ushort)picCapture.Height;
            jtOpenParam.wPolygons = 1;

            IntPtr pPolygons = Marshal.AllocCoTaskMem(Marshal.SizeOf(jtPolygonInfo));

            Marshal.StructureToPtr(jtPolygonInfo, pPolygons, false);
            jtOpenParam.pPolygons = pPolygons;

            jtOpenParam.startobjectID = 1;

            jtOpenParam.cameraIP                = textBoxIP.Text.PadRight(15).ToCharArray();
            jtOpenParam.nChannelID              = (ushort)iChannelNum[(int)iSelIndex]; //textBoxIP.Text + ";";
            jtOpenParam.calibrationObjectWidth  = (uint)rect[0];
            jtOpenParam.calibrationObjectHeight = (uint)rect[0];

            //jtOpenParam.pCallback = del;

            jtOpenParam.dwCallback = 1;

            uint[] dwReverse = new uint[] { 1 };
            jtOpenParam.dwReverse = dwReverse;

            glopara = MODSDK.JtModCreate(ref jtOpenParam);
        }
예제 #3
0
        private void btnTest2_Click(object sender, EventArgs e)
        {
            MODSDK.CMP_FRAME_INFO_DELEGATE del = new MODSDK.CMP_FRAME_INFO_DELEGATE(onCallback);


            MODSDK.POINT point = new MODSDK.POINT();
            point.x = 1;
            point.y = 2;

            MODSDK.JTPOLYGON_INFO jtPolygonInfo = new MODSDK.JTPOLYGON_INFO();
            jtPolygonInfo.wType       = 2;
            jtPolygonInfo.wPointCount = 333;

            //IntPtr pPoint = Marshal.AllocCoTaskMem(Marshal.SizeOf(point));
            //Marshal.StructureToPtr(point, pPoint, false);
            //jtPolygonInfo.pPoints = pPoint;


            MODSDK.JTMOD_OPEN_PARAM jtOpenParam = new MODSDK.JTMOD_OPEN_PARAM();
            jtOpenParam.size      = 1;
            jtOpenParam.nWidth    = 1;
            jtOpenParam.nHeight   = 1;
            jtOpenParam.wPolygons = 1;

            IntPtr pPolygons = Marshal.AllocCoTaskMem(Marshal.SizeOf(jtPolygonInfo));

            Marshal.StructureToPtr(jtPolygonInfo, pPolygons, false);
            jtOpenParam.pPolygons = pPolygons;

            jtOpenParam.startobjectID = 1;

            jtOpenParam.pCallback = del;

            jtOpenParam.dwCallback = 1;

            uint[] dwReverse = new uint[] { 1 };
            jtOpenParam.dwReverse = dwReverse;

            MODSDK.JtModCreate(ref jtOpenParam);
        }
예제 #4
0
        private void btnCallModCreate_Click(object sender, EventArgs e)
        {
            int selectedChannel = -1;

            int[,] line = new int[2, 2];
            foreach (var item in ptrRealHandleDict)
            {
                if (item.Value == selectedRealPlayWnd.Handle)
                {
                    line            = lineDict[item.Key];
                    selectedChannel = item.Key;
                    break;
                }
            }
            int[] rect = new int[2];
            foreach (var item in ptrRealHandleDict)
            {
                if (item.Value == selectedRealPlayWnd.Handle)
                {
                    rect = rectDict[item.Key];
                    break;
                }
            }

            //del = new MODSDK.CMP_FRAME_INFO_DELEGATE(onCallback);
            if (selectedChannel == 1)
            {
                del1 = new MODSDK.CMP_FRAME_INFO_DELEGATE(onCallback);
            }
            else
            {
                del2 = new MODSDK.CMP_FRAME_INFO_DELEGATE(onCallback);
            }

            MODSDK.POINT point1 = new MODSDK.POINT();
            point1.x = line[0, 0];
            point1.y = line[0, 1];

            MODSDK.POINT point2 = new MODSDK.POINT();
            point2.x = line[1, 0];
            point2.y = line[1, 1];

            MODSDK.POINT[] points = new MODSDK.POINT[] { point1, point2 };

            MODSDK.JTPOLYGON_INFO jtPolygonInfo = new MODSDK.JTPOLYGON_INFO();
            jtPolygonInfo.wType       = 3;
            jtPolygonInfo.wPointCount = 2;

            IntPtr pPoint  = Marshal.AllocCoTaskMem(Marshal.SizeOf(point1) * points.Length);
            long   LongPtr = pPoint.ToInt64(); // Must work both on x86 and x64

            foreach (MODSDK.POINT p in points)
            {
                IntPtr ptr = new IntPtr(LongPtr);
                Marshal.StructureToPtr(p, ptr, false);
                LongPtr += Marshal.SizeOf(typeof(Point));
            }
            jtPolygonInfo.pPoints = pPoint;
            //jtPolygonInfo.pPoints = new IntPtr(LongPtr);


            MODSDK.JTMOD_OPEN_PARAM jtOpenParam = new MODSDK.JTMOD_OPEN_PARAM();
            jtOpenParam.size      = (ushort)Marshal.SizeOf(jtOpenParam);
            jtOpenParam.nWidth    = (ushort)picCapture.Width;
            jtOpenParam.nHeight   = (ushort)picCapture.Height;
            jtOpenParam.wPolygons = 1;

            IntPtr pPolygons = Marshal.AllocCoTaskMem(Marshal.SizeOf(jtPolygonInfo));

            Marshal.StructureToPtr(jtPolygonInfo, pPolygons, false);
            jtOpenParam.pPolygons = pPolygons;

            jtOpenParam.startobjectID = 1;

            jtOpenParam.cameraIP                = textBoxIP.Text.PadRight(15).ToCharArray();
            jtOpenParam.nChannelID              = (ushort)iChannelNum[(int)iSelIndex]; //textBoxIP.Text + ";";
            jtOpenParam.calibrationObjectWidth  = (uint)rect[0];
            jtOpenParam.calibrationObjectHeight = (uint)rect[0];

            //jtOpenParam.pCallback = del;
            if (selectedChannel == 1)
            {
                jtOpenParam.pCallback = del1;
            }
            else
            {
                jtOpenParam.pCallback = del2;
            }

            jtOpenParam.dwCallback = 1;

            uint[] dwReverse = new uint[] { 1 };
            jtOpenParam.dwReverse = dwReverse;

            int glopara = MODSDK.JtModCreate(ref jtOpenParam);

            gloparaDict.Add(selectedChannel, glopara);
        }
예제 #5
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            try
            {
                MODSDK.POINT point = new MODSDK.POINT();
                point.x = 1;
                point.y = 2;

                MODSDK.JTPOLYGON_INFO jtPolygonInfo = new MODSDK.JTPOLYGON_INFO();
                jtPolygonInfo.wType = 2;
                jtPolygonInfo.wPointCount = 333;

                //IntPtr pPoint = Marshal.AllocCoTaskMem(Marshal.SizeOf(point));
                //Marshal.StructureToPtr(point, pPoint, false);
                //jtPolygonInfo.pPoints = pPoint;

                //jtPolygonInfo.pPoints.x = 1;
                //jtPolygonInfo.pPoints.y = 2;

                MODSDK.JtModTest(ref jtPolygonInfo);

                //MODSDK.POINT newPoint = (MODSDK.POINT)Marshal.PtrToStructure(jtPolygonInfo.pPoints, typeof(MODSDK.POINT));
                //// 释放在非托管代码中分配的Point实例内存
                //Marshal.DestroyStructure(pPoint, typeof(MODSDK.POINT));
            }
            catch (DllNotFoundException dllNotFoundExc)
            {
                Console.WriteLine("DllNotFoundException was detected, "
               + "error message: \r\n{0}", dllNotFoundExc.Message);

            }
        }
예제 #6
0
        private void btnCallModCreate_Click(object sender, EventArgs e)
        {
            del = new MODSDK.CMP_FRAME_INFO_DELEGATE(onCallback);

            MODSDK.POINT point1 = new MODSDK.POINT();
            point1.x = line[0, 0];
            point1.y = line[0, 1];

            MODSDK.POINT point2 = new MODSDK.POINT();
            point2.x = line[1, 0];
            point2.y = line[1, 1];

            MODSDK.POINT[] points = new MODSDK.POINT[] { point1, point2 };

            MODSDK.JTPOLYGON_INFO jtPolygonInfo = new MODSDK.JTPOLYGON_INFO();
            jtPolygonInfo.wType = 3;
            jtPolygonInfo.wPointCount = 2;

            IntPtr pPoint = Marshal.AllocCoTaskMem(Marshal.SizeOf(point1) * points.Length);
            long LongPtr = pPoint.ToInt64(); // Must work both on x86 and x64
            foreach (MODSDK.POINT p in points)
            {
                IntPtr ptr = new IntPtr(LongPtr);
                Marshal.StructureToPtr(p, ptr, false);
                LongPtr += Marshal.SizeOf(typeof(Point));
            }
            jtPolygonInfo.pPoints = pPoint;
            //jtPolygonInfo.pPoints = new IntPtr(LongPtr);

            MODSDK.JTMOD_OPEN_PARAM jtOpenParam = new MODSDK.JTMOD_OPEN_PARAM();
            jtOpenParam.size = (ushort)Marshal.SizeOf(jtOpenParam);
            jtOpenParam.nWidth = (ushort)picCapture.Width;
            jtOpenParam.nHeight = (ushort)picCapture.Height;
            jtOpenParam.wPolygons = 1;

            IntPtr pPolygons = Marshal.AllocCoTaskMem(Marshal.SizeOf(jtPolygonInfo));
            Marshal.StructureToPtr(jtPolygonInfo, pPolygons, false);
            jtOpenParam.pPolygons = pPolygons;

            jtOpenParam.startobjectID = 1;

            jtOpenParam.cameraIP = textBoxIP.Text.PadRight(15).ToCharArray();
            jtOpenParam.nChannelID = (ushort)iChannelNum[(int)iSelIndex]; //textBoxIP.Text + ";";
            jtOpenParam.calibrationObjectWidth = (uint)rect[0];
            jtOpenParam.calibrationObjectHeight = (uint)rect[0];

            //jtOpenParam.pCallback = del;

            jtOpenParam.dwCallback = 1;

            uint[] dwReverse = new uint[] { 1 };
            jtOpenParam.dwReverse = dwReverse;

            glopara = MODSDK.JtModCreate(ref jtOpenParam);
        }
예제 #7
0
        private void btnTest2_Click(object sender, EventArgs e)
        {
            MODSDK.CMP_FRAME_INFO_DELEGATE del = new MODSDK.CMP_FRAME_INFO_DELEGATE(onCallback);

            MODSDK.POINT point = new MODSDK.POINT();
            point.x = 1;
            point.y = 2;

            MODSDK.JTPOLYGON_INFO jtPolygonInfo = new MODSDK.JTPOLYGON_INFO();
            jtPolygonInfo.wType = 2;
            jtPolygonInfo.wPointCount = 333;

            //IntPtr pPoint = Marshal.AllocCoTaskMem(Marshal.SizeOf(point));
            //Marshal.StructureToPtr(point, pPoint, false);
            //jtPolygonInfo.pPoints = pPoint;

            MODSDK.JTMOD_OPEN_PARAM jtOpenParam = new MODSDK.JTMOD_OPEN_PARAM();
            jtOpenParam.size = 1;
            jtOpenParam.nWidth = 1;
            jtOpenParam.nHeight = 1;
            jtOpenParam.wPolygons = 1;

            IntPtr pPolygons = Marshal.AllocCoTaskMem(Marshal.SizeOf(jtPolygonInfo));
            Marshal.StructureToPtr(jtPolygonInfo, pPolygons, false);
            jtOpenParam.pPolygons = pPolygons;

            jtOpenParam.startobjectID = 1;

            jtOpenParam.pCallback = del;

            jtOpenParam.dwCallback = 1;

            uint[] dwReverse = new uint[] { 1 };
            jtOpenParam.dwReverse = dwReverse;

            MODSDK.JtModCreate(ref jtOpenParam);
        }
예제 #8
0
        private void btnCallModCreate_Click(object sender, EventArgs e)
        {
            int selectedChannel = -1;
            int[,] line = new int[2, 2];
            foreach (var item in ptrRealHandleDict)
            {
                if (item.Value == selectedRealPlayWnd.Handle)
                {
                    line = lineDict[item.Key];
                    selectedChannel = item.Key;
                    break;
                }
            }
            int[] rect = new int[2];
            foreach (var item in ptrRealHandleDict)
            {
                if (item.Value == selectedRealPlayWnd.Handle)
                {
                    rect = rectDict[item.Key];
                    break;
                }
            }

            //del = new MODSDK.CMP_FRAME_INFO_DELEGATE(onCallback);
            if (selectedChannel == 1)
            {
                del1 = new MODSDK.CMP_FRAME_INFO_DELEGATE(onCallback);
            }
            else
            {
                del2 = new MODSDK.CMP_FRAME_INFO_DELEGATE(onCallback);
            }

            MODSDK.POINT point1 = new MODSDK.POINT();
            point1.x = line[0, 0];
            point1.y = line[0, 1];

            MODSDK.POINT point2 = new MODSDK.POINT();
            point2.x = line[1, 0];
            point2.y = line[1, 1];

            MODSDK.POINT[] points = new MODSDK.POINT[] { point1, point2 };

            MODSDK.JTPOLYGON_INFO jtPolygonInfo = new MODSDK.JTPOLYGON_INFO();
            jtPolygonInfo.wType = 3;
            jtPolygonInfo.wPointCount = 2;

            IntPtr pPoint = Marshal.AllocCoTaskMem(Marshal.SizeOf(point1) * points.Length);
            long LongPtr = pPoint.ToInt64(); // Must work both on x86 and x64
            foreach (MODSDK.POINT p in points)
            {
                IntPtr ptr = new IntPtr(LongPtr);
                Marshal.StructureToPtr(p, ptr, false);
                LongPtr += Marshal.SizeOf(typeof(Point));
            }
            jtPolygonInfo.pPoints = pPoint;
            //jtPolygonInfo.pPoints = new IntPtr(LongPtr);

            MODSDK.JTMOD_OPEN_PARAM jtOpenParam = new MODSDK.JTMOD_OPEN_PARAM();
            jtOpenParam.size = (ushort)Marshal.SizeOf(jtOpenParam);
            jtOpenParam.nWidth = (ushort)picCapture.Width;
            jtOpenParam.nHeight = (ushort)picCapture.Height;
            jtOpenParam.wPolygons = 1;

            IntPtr pPolygons = Marshal.AllocCoTaskMem(Marshal.SizeOf(jtPolygonInfo));
            Marshal.StructureToPtr(jtPolygonInfo, pPolygons, false);
            jtOpenParam.pPolygons = pPolygons;

            jtOpenParam.startobjectID = 1;

            jtOpenParam.cameraIP = textBoxIP.Text.PadRight(15).ToCharArray();
            jtOpenParam.nChannelID = (ushort)iChannelNum[(int)iSelIndex]; //textBoxIP.Text + ";";
            jtOpenParam.calibrationObjectWidth = (uint)rect[0];
            jtOpenParam.calibrationObjectHeight = (uint)rect[0];

            //jtOpenParam.pCallback = del;
            if (selectedChannel == 1)
            {
                jtOpenParam.pCallback = del1;
            }
            else
            {
                jtOpenParam.pCallback = del2;
            }

            jtOpenParam.dwCallback = 1;

            uint[] dwReverse = new uint[] { 1 };
            jtOpenParam.dwReverse = dwReverse;

            int glopara = MODSDK.JtModCreate(ref jtOpenParam);
            gloparaDict.Add(selectedChannel, glopara);
        }