示例#1
0
        public static void myReSize1(int index, out int width, out int height, string dizhi = @"d:\ChangZhi\dnplayer2\", string youxi = "luneng")
        {
            mylogandxianshi("模拟器" + index + "开始改位置");
            int dqwidth  = 2560; //1920 1024
            int dqheight = 1440; //1080 768
            int yiquanw  = 601;
            int yiquany  = 338;

            if (youxi.Equals("luneng"))
            {
                yiquanw = 727; //原来外框 727 425
                yiquany = 425;
            }
            width  = yiquanw;
            height = yiquany;
            lock (obj)
            {
                int    jubing = MyLdcmd.getDqmoniqiWaiCengJuBingByIndex(index, dizhi);
                IntPtr p      = new IntPtr(jubing);
                IntPtr p2     = new IntPtr(HWND_TOP);
                int    x      = 0;
                int    y      = 0;
                x = (index % 4) * (dqwidth / 4);
                y = (index / 4) * (dqheight / 4);
                mylogandxianshi(index + "x:" + x + ",y:" + y);
                if (youxi.Equals("luneng"))
                {
                    SetWindowPos(p, p2, x, y, yiquanw, yiquany, SWP_SHOWWINDOW);
                }
                else
                {
                    SetWindowPos(p, p2, x, y, yiquanw, yiquany, SWP_SHOWWINDOW);
                }
            }
        }
示例#2
0
        public void myBianWeiZhi(int index, string dizhi = @"d:\ChangZhi\dnplayer2\")
        {
            WriteLog.WriteLogFile(index + "", "模拟器" + index + "开始改位置");
            int    dqwidth  = 2560; //1920 1024
            int    dqheight = 1440; //1080 768
            int    jubing   = MyLdcmd.getDqmoniqiWaiCengJuBingByIndex(index, dizhi);
            IntPtr p        = new IntPtr(jubing);
            IntPtr p2       = new IntPtr(HWND_TOP);
            int    x        = 0;
            int    y        = 0;
            int    yiquanw  = 578;
            int    yiquany  = 1028;

            x = ((index - 1) % 4) * (dqwidth / 4);
            y = ((index - 1) / 4) * (dqheight / 4);
            WriteLog.WriteLogFile(index + "", index + "x:" + x + ",y:" + y);
            SetWindowPos(p, p2, x, y, yiquanw, yiquany, SWP_SHOWWINDOW);
        }
示例#3
0
        public void myReSizeByWAndH(int index, int jubing, int width, int height, string dizhi = @"d:\ChangZhi\dnplayer2\")
        {
            if (jubing <= 0)
            {
                jubing = MyLdcmd.getDqmoniqiWaiCengJuBingByIndex(index, dizhi);
            }
            WriteLog.WriteLogFile(index + "", "模拟器" + index + "开始改大小,外层句柄" + jubing);
            int    dqwidth  = 2560; //1920 1024
            int    dqheight = 1440; //1080 768
            IntPtr p        = new IntPtr(jubing);
            IntPtr p2       = new IntPtr(HWND_TOP);
            int    x        = 0;
            int    y        = 0;

            x = (index % 4) * (dqwidth / 4);
            y = (index / 4) * (dqheight / 4);
            WriteLog.WriteLogFile(index + "", index + "x:" + x + ",y:" + y);
            SetWindowPos(p, p2, x, y, width, height, SWP_SHOWWINDOW);
        }
示例#4
0
        public static void getWindowSize(int index, out int width, out int height)
        {
            string dizhi = @"d:\ChangZhi\dnplayer2\";

            width  = -1;
            height = -1;
            int jubing = MyLdcmd.getDqmoniqiWaiCengJuBingByIndex(index, dizhi);

            if (jubing <= 0)
            {
                WriteLog.WriteLogFile(index + "", "改变窗口位置,句柄绑定错误");
                return;
            }
            Rect lprect = new Rect();

            GetWindowRect(new IntPtr(jubing), out lprect);
            //WriteLog.WriteLogFile(index + "", "当前width,height" + width + "," + height + " 改变位置外框" + (lprect.Right - lprect.Left) + " " + (lprect.Bottom - lprect.Top) );
            width  = lprect.Right - lprect.Left;
            height = lprect.Bottom - lprect.Top;
        }
示例#5
0
        public static void myReplace(int index)
        {
            string dizhi = @"d:\ChangZhi\dnplayer2\";

            mylogandxianshi("模拟器" + index + "开始改位置");
            int dqwidth  = 2560; //2560 1920 1024
            int dqheight = 1440; //1440 1080 768

            lock (obj)
            {
                int    jubing = MyLdcmd.getDqmoniqiWaiCengJuBingByIndex(index, dizhi);
                IntPtr p      = new IntPtr(jubing);
                IntPtr p2     = new IntPtr(HWND_TOP);
                int    x      = 0;
                int    y      = 0;
                x = (index % 4) * (dqwidth / 4);
                y = (index / 4) * (dqheight / 4);
                SetWindowPos(p, p2, x, y, -1, -1, SWP_NOSIZE);
            }
        }
示例#6
0
        private static bool myQuit(int index, string dizhi)
        {
            var res = false;

            lock (obj)
            {
                int    jubing = MyLdcmd.getDqmoniqiWaiCengJuBingByIndex(index, dizhi);
                IntPtr p      = new IntPtr(jubing);
                PostMessage(p, WM_CLOSE, 0, 0);
                Thread.Sleep(5000);
                MyLdcmd myldcmd = MyLdcmd.GetObject(dizhi);
                long    kstime  = GetTimestamp();
                long    kstime2 = GetTimestamp();
                int[]   abc     = MyLdcmd.getDqmoniqiHuodongIndex(dizhi);
                if (abc.Contains(index))
                {
                    MyLdcmd.getLdCmd().Quit(index);
                    Thread.Sleep(5000);
                    zaiciguanbi();
                }
                abc = MyLdcmd.getDqmoniqiHuodongIndex(dizhi);
                if (!abc.Contains(index))
                {
                    return(true);
                }
                int shi = 0;
                while (true)
                {
                    long jstime = GetTimestamp();
                    if ((jstime - kstime2) > 1000 * 30)
                    {
                        abc     = MyLdcmd.getDqmoniqiHuodongIndex(dizhi);
                        kstime2 = GetTimestamp();
                    }
                    if (shi == 0 && abc.Contains(index))
                    {
                        MyLdcmd.getLdCmd().Quit(index);
                        Thread.Sleep(5000);
                        zaiciguanbi();
                        shi = 1;
                    }
                    if (shi == 1 && abc.Contains(index))
                    {
                        PostMessage(p, WM_CLOSE, 0, 0);
                        Thread.Sleep(5000);
                        shi = 0;
                    }
                    if (!abc.Contains(index))
                    {
                        res = true;
                        break;
                    }
                    if ((jstime - kstime) > 1000 * 60 * 5)
                    {
                        mylogandxianshi("循环很久5分钟也没有关闭" + index);
                        break;
                    }
                }
            }
            return(res);
        }
示例#7
0
        public static bool lurenResizeOk1(int index)
        {
            WriteLog.WriteLogFile(index + "", "改变窗口位置--开始");
            string dizhi = @"d:\ChangZhi\dnplayer2\";
            bool   t = false;
            long   ksjs = GetTimestamp();
            long   ks = GetTimestamp();
            int    width = -1, height = -1;

            myReSize1(index, out width, out height);
            int jubing  = MyLdcmd.getDqmoniqiWaiCengJuBingByIndex(index, dizhi);
            int jubing2 = MyLdcmd.getDqmoniqiJuBingByIndex(index, dizhi);

            if (jubing <= 0)
            {
                WriteLog.WriteLogFile(index + "", "改变窗口位置,句柄绑定错误");
                return(t);
            }
            Rect lprect = new Rect();

            GetWindowRect(new IntPtr(jubing), out lprect);
            Rect rprect = new Rect();

            GetWindowRect(new IntPtr(jubing2), out rprect);
            WriteLog.WriteLogFile(index + "", "当前width,height" + width + "," + height + " 改变位置外框" + (lprect.Right - lprect.Left) + " " + (lprect.Bottom - lprect.Top) + ",内框" + (rprect.Right - rprect.Left) + " " + (rprect.Bottom - rprect.Top));
            if ((lprect.Right - lprect.Left) == width && (lprect.Bottom - lprect.Top) == height)
            {
                WriteLog.WriteLogFile(index + "", "改变位置外框成功" + (lprect.Right - lprect.Left) + " " + (lprect.Bottom - lprect.Top) + ",内框" + (rprect.Right - rprect.Left) + " " + (rprect.Bottom - rprect.Top));
                t = true;
                return(t);
            }
            while (true)
            {
                long js = GetTimestamp();
                if ((js - ksjs) > 30 * 1000)
                {
                    lprect = new Rect();
                    GetWindowRect(new IntPtr(jubing), out lprect);
                    rprect = new Rect();
                    GetWindowRect(new IntPtr(jubing2), out rprect);
                    WriteLog.WriteLogFile(index + "", "当前width,height" + width + "," + height + " 改变位置外框" + (lprect.Right - lprect.Left) + " " + (lprect.Bottom - lprect.Top) + ",内框" + (rprect.Right - rprect.Left) + " " + (rprect.Bottom - rprect.Top));
                    if ((lprect.Right - lprect.Left) == width && (lprect.Bottom - lprect.Top) == height)
                    {
                        WriteLog.WriteLogFile(index + "", "改变位置外框" + (lprect.Right - lprect.Left) + " " + (lprect.Bottom - lprect.Top) + ",内框" + (rprect.Right - rprect.Left) + " " + (rprect.Bottom - rprect.Top));
                        t = true;
                        break;
                    }
                    if ((lprect.Right - lprect.Left) != width || (lprect.Bottom - lprect.Top) != height)
                    {
                        myReSize1(index, out width, out height);
                    }
                    ksjs = GetTimestamp();
                    WriteLog.WriteLogFile(index + "", "30s resize一次");
                }
                if ((js - ks) > 10 * 60 * 1000)
                {
                    WriteLog.WriteLogFile(index + "", "10分钟改变位置不成功 ");
                    break;
                }
            }
            return(t);
        }
示例#8
0
        public bool myQuit(int index, string dizhi, int jubing)
        {
            var res = false;

            if (jubing <= 0)
            {
                WriteLog.WriteLogFile(index + "", "准备获取句柄,在myquit处");
                jubing = MyLdcmd.getDqmoniqiWaiCengJuBingByIndex(index, dizhi);
            }
            IntPtr p = new IntPtr(jubing);

            PostMessage(p, WM_CLOSE, 0, 0);
            Thread.Sleep(5000);
            MyLdcmd myldcmd = MyLdcmd.GetObject(dizhi);
            long    kstime  = MyFuncUtil.GetTimestamp();
            long    kstime2 = MyFuncUtil.GetTimestamp();

            int[] abc = MyLdcmd.getDqmoniqiHuodongIndex(dizhi);
            if (abc.Contains(index))
            {
                MyLdcmd.getLdCmd().Quit(index);
                Thread.Sleep(5000);
                MyFuncUtil.zaiciguanbi();
            }
            abc = MyLdcmd.getDqmoniqiHuodongIndex(dizhi);
            if (!abc.Contains(index))
            {
                return(true);
            }
            int shi = 0;

            while (true)
            {
                long jstime = MyFuncUtil.GetTimestamp();
                if ((jstime - kstime2) > 1000 * 30)
                {
                    abc     = MyLdcmd.getDqmoniqiHuodongIndex(dizhi);
                    kstime2 = MyFuncUtil.GetTimestamp();
                }
                if (shi == 0 && abc.Contains(index))
                {
                    MyLdcmd.getLdCmd().Quit(index);
                    Thread.Sleep(5000);
                    MyFuncUtil.zaiciguanbi();
                    shi = 1;
                }
                if (shi == 1 && abc.Contains(index))
                {
                    PostMessage(p, WM_CLOSE, 0, 0);
                    Thread.Sleep(5000);
                    shi = 0;
                }
                if (!abc.Contains(index))
                {
                    res = true;
                    break;
                }
                if ((jstime - kstime) > 1000 * 60 * 5)
                {
                    MyFuncUtil.mylogandxianshi("循环很久5分钟也没有关闭" + index);
                    break;
                }
            }

            return(res);
        }