using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
 
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.IO;

     IntPtr ParenthWnd = new IntPtr(0);

            IntPtr hWnd = new IntPtr(0);
            RECT pos = new RECT();
            string lpszParentWindow =  "****";
            ParenthWnd = FindWindow("GxWindowClassD3d", lpszParentWindow);


            GetWindowRect(ParenthWnd,out pos);
            SetCursorPos(pos.Left + 386, pos.Top + 336);
            mouse_event(MouseEventFlag.LeftDown, 0, 0, 0, UIntPtr.Zero);
            mouse_event(MouseEventFlag.LeftUp, 0, 0, 0, UIntPtr.Zero);

            mouse_event(MouseEventFlag.LeftDown, 0, 0, 0, UIntPtr.Zero);
            mouse_event(MouseEventFlag.LeftUp, 0, 0, 0, UIntPtr.Zero);
            System.Threading.Thread.Sleep(10);
            Clipboard.SetDataObject("*****", false,5,1000);
             
            SendKeys.Send("^(V)");

            //SendKeys.Send("{CTRL}V");

          //  keybd_event(18, MapVirtualKey(18, 0), 0, 0); //按下CTRL鍵。 
          //keybd_event(0x57,MapVirtualKey(0x57,0),0,0);//键下V键。
          //keybd_event(0x57, MapVirtualKey(0x57, 0), 0x2, 0);//放开V键。
          //  keybd_event(18, MapVirtualKey(18, 0), 0x2, 0);//放開CTRL鍵。
             
            SetCursorPos(pos.Left + 386, pos.Top + 388);
            mouse_event(MouseEventFlag.LeftDown, 0, 0, 0, UIntPtr.Zero);
            mouse_event(MouseEventFlag.LeftUp, 0, 0, 0, UIntPtr.Zero);
           
           
            Clipboard.SetDataObject("****", false,2,1000);
            
            
           SendKeys.Send("^(V)");
            

           SendKeys.Send("^{ENTER}");

 

 /***********************************************************************/

 

  public struct RECT
        {
            public int Left; // x position of upper-left corner
            public int Top; // y position of upper-left corner
            public int Right; // x position of lower-right corner
            public int Bottom; // y position of lower-right corner
        }
        [Flags]
        enum MouseEventFlag : uint
        {
            Move = 0x0001,
            LeftDown = 0x0002,
            LeftUp = 0x0004,
            RightDown = 0x0008,
            RightUp = 0x0010,
            MiddleDown = 0x0020,
            MiddleUp = 0x0040,
            XDown = 0x0080,
            XUp = 0x0100,
            Wheel = 0x0800,
            VirtualDesk = 0x4000,
            Absolute = 0x8000
        } 

  [DllImport("User32.dll ")]
        public static extern System.IntPtr FindWindowEx(System.IntPtr parent, System.IntPtr childe, string strclass, string strname);
        [DllImport("user32.dll")]
        private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
        [DllImport("user32.dll")]
         private static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
        [DllImport("user32.dll")]
        static extern bool SetCursorPos(int X, int Y);

        [DllImport("user32.dll")]
        static extern void mouse_event(MouseEventFlag flags, int dx, int dy, uint data, UIntPtr extraInfo);
          [DllImport("user32.dll")]
          static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, uint dwExtraInfo);
           [DllImport("user32.dll")]
          static extern byte MapVirtualKey(byte wCode, int wMap); 

 

相关文章:

  • 2021-05-24
  • 2021-11-23
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2022-03-04
  • 2021-09-25
猜你喜欢
  • 2021-06-30
  • 2021-06-09
  • 2021-09-11
  • 2021-08-19
  • 2022-12-23
  • 2021-11-28
相关资源
相似解决方案