示例#1
0
        static void DSM()
        {
            currentView = "";
            Spotify = Helper.FindWindowEx((IntPtr)null, (IntPtr)null, "SpotifyMainWindow", null);
            Helper.GetWindowRect(Spotify, ref pos);

            pos = new Helper.RECT();
            Form1 Form = d;

            Bitmap R = CaptureScreen.GetFormImage(Spotify);
            x = 0;

            int start = 22;
            int end = 302;

            y = 0;
            for (x = start; x < end; x++)
            {
                Color D = R.GetPixel(x, 114);
                if (D.R == 41 && D.G == 41 && D.B == 41)
                {
                    break;
                }
            }

            Rectangle Range = new Rectangle(new Point(290 + x - 120, 75), new Size(200, 45));
            Bitmap Dc = new Bitmap(R, new Size(R.Width, R.Height));
            List<Word> Words = Ds.DoOCR(Dc, Range);

            if (Words.Count > 0)
            {
                GetView(Words[0].Text.Replace("å", "i"));
            }

            foreach (Form1 _Form in views.Values)
            {
                if ((string)_Form.Tag == currentView)
                {

                    _Form.TopMost = Helper.GetForegroundWindow() == Spotify;

                    if (Helper.GetWindowRect(Spotify, ref pos) > 0)
                    {
                        try
                        {
                            int lend = pos.Width - 30;
                            for (y = 0; y > -300; y--)
                            {
                                Color D = R.GetPixel(pos.Width  + y, 114);
                                if (D.R == 41 && D.G == 41 && D.B == 41)
                                {
                                    break;
                                }
                            }
                            _Form.Left = pos.X + 236 + x - 235;
                            _Form.Top = pos.Y + 56;
                            _Form.Width = pos.Width - pos.X - 236 - x + 235 + y - 1;
                            _Form.Height = pos.Height - pos.Y - 56 - 41;
                        }
                        catch
                        {
                        }

                    }

                }
                else
                {
                    _Form.Visible = false;
                }

            }
        }
示例#2
0
        static void ST_Tick(object sender, EventArgs e)
        {
            Helper.GetWindowRect(Spotify, ref pos);
            foreach (Form1 _Form in views.Values)
            {
                if ((string)_Form.Tag == currentView)
                {

                    _Form.TopMost = Helper.GetForegroundWindow() == Spotify;

                    if (Helper.GetWindowRect(Spotify, ref pos) > 0)
                    {
                         try
                            {
                                if (oldPos.X != pos.X || oldPos.Y != pos.Y)
                                {
                                    Helper.ReleaseCapture();
                                    Helper.SendMessage(_Form.Handle, 0x02, null, null);

                                }
                            }
                            catch
                            {
                            }
                            try
                            {
                                if (oldPos.X != pos.X || oldPos.Y != pos.Y)
                                {
                                    Helper.ReleaseCapture();
                                    Helper.SendMessage(_Form.Handle, 0x0085, null, null);
                                }
                            }
                            catch
                            {
                            }
                        _Form.Left = pos.X + 236 + x - 235;
                        _Form.Top = pos.Y + 56;
                        _Form.Width = pos.Width - pos.X - 236 - x + 235 + y - 1;
                        _Form.Height = pos.Height - pos.Y - 56 - 41;

                    }

                }
                else
                {
                    _Form.Visible = false;
                }

            }

            Checkup.TopMost = Helper.GetForegroundWindow() == Spotify;

            if (Helper.GetWindowRect(Spotify, ref pos) > 0)
            {
                try
                {
                    int lend = pos.Width - 30;

                    Checkup.Left = pos.X + 236 + x - 235;
                    Checkup.Top = pos.Y +20;
                    Checkup.Width = pos.Width - pos.X - 236 - x + 235 + y - 1;

                }
                catch
                {
                }

            }

            // TODO: Listen to messages and interop DSM();

            if (mouseState == 1 && System.Windows.Forms.Control.MouseButtons != MouseButtons.Left)
            {

            }
            if (((System.Windows.Forms.Control.MousePosition.X  < pos.X + x && System.Windows.Forms.Control.MousePosition.X  > pos.X )||
                (System.Windows.Forms.Control.MousePosition.X > pos.X + pos.Width - y + x && System.Windows.Forms.Control.MousePosition.X < pos.Width+pos.X)) &&
                System.Windows.Forms.Control.MouseButtons == MouseButtons.Left && System.Windows.Forms.Control.MousePosition.Y > pos.Y + 120)
            {
                dr = "00";
                SetTimeout(10, new EventHandler(OutLosning_Tick));
                SetTimeout(110, new EventHandler(OutLosning_Tick));
                SetTimeout(1110, new EventHandler(OutLosning_Tick));
                SetTimeout(3110, new EventHandler(OutLosning_Tick));

                mouseState = 1;
            }
            oldPos = new Helper.RECT();
            oldPos.X = pos.X;
            oldPos.Y = pos.Y;
            oldPos.Width = pos.Width;
            oldPos.Height = pos.Height;
        }
示例#3
0
        static void DSM()
        {
            Spotify = Helper.FindWindowEx((IntPtr)null, (IntPtr)null, "SpotifyMainWindow", null);
            Helper.GetWindowRect(Spotify, ref pos);

            pos = new Helper.RECT();
            Form1 Form = d;

            Bitmap R = CaptureScreen.GetFormImage(Spotify);
            x = 0;

            int start = 22;
            int end = 302;

            for (x = start; x < end; x++)
            {
                Color D = R.GetPixel(x, 114);
                if (D.R == 41 && D.G == 41 && D.B == 41)
                {
                    break;
                }
            }

            // Rectangle Range = new Rectangle(new Point( 290 + x - 120, 75), new Size(200, 45));
            // Bitmap Dc = new Bitmap(R, new Size(R.Width, R.Height));
            /**
             * This idea born by physical excercise !
             * */
            if (Helper.GetForegroundWindow() == Spotify)
            {

               foreach(Form1 _Form in views.Values)
               {
                   if ((string)_Form.Tag == currentView)
                   {

                        _Form.TopMost = Helper.GetForegroundWindow() == Spotify;
                        if (!_Form.Visible)
                        {
                     //       _Form.Show();
                        }
                        if (Helper.GetWindowRect(Spotify, ref pos) > 0)
                        {
                            try
                            {
                                int lend = pos.Width - 30;
                                for (y = 31; y > -300; y--)
                                {
                                    Color D = R.GetPixel(pos.Width - 1 + y, 114);
                                    if (D.R == 41 && D.G == 41 && D.B == 41)
                                    {
                                        break;
                                    }
                                }
                                _Form.Left = pos.X + 236 + x - 235;
                                _Form.Top = pos.Y + 56;
                          //      _Form.Width = pos.Width - pos.X - 236 - x + 235 + y - 1;
                                _Form.Height = pos.Height - pos.Y - 56 - 41;
                            }
                            catch
                            {
                            }

                        }

                    }
                    else
                    {
                //        _Form.Visible = false;
                    }

                }

            }
        }