/// <summary>
        /// Check if Size of Emulator windows match with the loaded/pre-defined windows size
        /// Resize window if it doesnt match the pre-defined sizes
        /// </summary>
        /// <param name="emulator"></param>
        public static void checkEmulatorSize(IntPtr emulator)
        {
            // Get window parameters
            WinAPI.RECT rect = new WinAPI.RECT();
            WinAPI.GetWindowRect(emulator, out rect);

            // Check if match and resize if necessary
            if (rect.Width != GlobalSettings.General.EmulatorWidth || rect.Height != GlobalSettings.General.EmulatorWidth)
            {
                WinAPI.MoveWindow(emulator, rect.X, rect.Y, GlobalSettings.General.EmulatorWidth, GlobalSettings.General.EmulatorHeight, true);
                System.Threading.Thread.Sleep(100);
            }
        }
Пример #2
0
        /// <summary>
        /// Capture Screenshot from window-pointer
        /// </summary>
        /// <param name="procName"></param>
        /// <returns></returns>
        public static Bitmap CaptureApplication(IntPtr procName)
        {
            WinAPI.RECT rect = new WinAPI.RECT();
            WinAPI.GetWindowRect(procName, out rect);
            int    width  = rect.Right - rect.Left;
            int    height = rect.Bottom - rect.Top;
            Bitmap bmp    = new Bitmap(width, height, PixelFormat.Format32bppArgb);

            using (Graphics graphics = Graphics.FromImage(bmp))
            {
                bmp.SetResolution(graphics.DpiX, graphics.DpiY);
                graphics.CopyFromScreen(rect.Left, rect.Top, 0, 0, new Size(width, height), CopyPixelOperation.SourceCopy);
                return(bmp);
            }
        }
 /// <summary>
 /// Get Infos from Table to set NoteWindow appearance into the center of the table
 /// </summary>
 /// <param name="table"></param>
 private void setAppearanceLocation(string table)
 {
     // retrieve needed table from sessions list
     foreach (KeyValuePair <IntPtr, TableData> kvp in TableHandler.tableSessions)
     {
         TableData data = kvp.Value;
         if (data.tablename.Equals(table))
         {
             IntPtr      tableHandle = kvp.Key;
             WinAPI.RECT rect        = new WinAPI.RECT();
             WinAPI.GetWindowRect(tableHandle, out rect);
             int a = rect.Width / 4;
             int b = rect.Height / 3;
             WinAPI.MoveWindow(this.Handle, rect.X + a, rect.Y + b, this.Width, this.Height, true);
             break;
         }
     }
 }
Пример #4
0
        /// <summary>
        /// Clicks on predefined rectangle in order to sit down
        /// </summary>
        /// <param name="table"></param>
        /// <param name="clickBox">position for click</param>
        private void clickSeat(IntPtr table, Rectangle clickBox)
        {
            // Get Table Rectangle
            Rectangle tablePosition = new Rectangle();

            WinAPI.GetWindowRect(new HandleRef(this, table), out tablePosition);

            // Save current Cursor Position
            int old_x = Cursor.Position.X;
            int old_y = Cursor.Position.Y;

            // Set Cursor on OpenSeat and Click
            WinAPI.SetCursorPos(tablePosition.Left + (clickBox.X + 20), tablePosition.Top + (clickBox.Y + 20));
            WinAPI.mouse_event(WinAPI.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); //make left button down
            WinAPI.mouse_event(WinAPI.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);   //make left button up

            // Reset Cursor Position position before the click
            WinAPI.SetCursorPos(old_x, old_y);
        }