首页 > 编程语言 >C# XD部分罗辑验证

C# XD部分罗辑验证

时间:2022-09-26 14:33:57浏览次数:40  
标签:C# hWnd System XD int Send 罗辑 using SendKeys

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using System.Diagnostics;
using System.Threading;


namespace WSD
{
public partial class Form1 : Form
{



[DllImport("user32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);

[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
private static extern int SetActiveWindow(IntPtr hWnd);

[DllImport("user32.dll")]
private static extern int ShowWindowAsync(IntPtr hWnd, int ncmdshow);
[DllImport("user32.dll")]
private static extern bool islconic(IntPtr hWnd);
[DllImport("user32.dll", EntryPoint = "PostMessageA")]
public static extern bool PostMessage(IntPtr hWnd, int msg, int wParam, int lParam);
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string strclassname, string strwindowname);
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int msg, int wParm, int lParam);
public const int wm_sys = 0x0112; // 系统指定
public const int SC_MAX = 0xF030;
public const int sc_f2 = 0X72;
public const int wm_keydown = 0X100;


public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)

{

Process pro1 = Process.GetProcessById(23928);

IntPtr hWnd = pro1.MainWindowHandle;
SendMessage(hWnd, wm_sys, SC_MAX, 0);

System.Threading.Thread.Sleep(2000);

SetForegroundWindow(hWnd);
SetActiveWindow(hWnd);

// ShowWindowAsync(hWnd, 9);
// SetForegroundWindow(hWnd);

SendKeys.Send("{F4}");
// System.Threading.Thread.Sleep(50);
SendKeys.Send("{F1}");
SendKeys.Send("0");
// System.Threading.Thread.Sleep(50);
SendKeys.Send("0");
// System.Threading.Thread.Sleep(50)
SendKeys.Send("2");
SendKeys.Send("7");
SendKeys.Send("7");
SendKeys.Send("3");
SendKeys.Send("{ENTER}");

System.Threading.Thread.Sleep(100);
SendKeys.Send("{BACKSPACE}");
SendKeys.Send("{BACKSPACE}");
SendKeys.Send("{BACKSPACE}");
SendKeys.Send("{BACKSPACE}");
SendKeys.Send("{BACKSPACE}");
SendKeys.Send("{BACKSPACE}");


System.Threading.Thread.Sleep(100);

 


SendKeys.Send("1");
SendKeys.Send("5");
SendKeys.Send(".");
SendKeys.Send("6");
SendKeys.Send("{ENTER}");


SendKeys.Send("1");
SendKeys.Send("0");
SendKeys.Send("0");
SendKeys.Send("{ENTER}");
SendKeys.Send("{ENTER}");
SendKeys.Send("{ENTER}");

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

// SetForegroundWindow(hWnd);
// System.Threading.Thread.Sleep(1000);

}
}
}

标签:C#,hWnd,System,XD,int,Send,罗辑,using,SendKeys
From: https://www.cnblogs.com/lionmxs/p/16730865.html

相关文章

  • 命令:@echo off
    @echooff关闭命令回显,表示执行了这条命令后关闭所有命令(包括本身这条命令)的回显。echooff执行以后,后面所有的命令均不显示,但本条命令是显示的。@的作用就是关......
  • SAP COOIS新增客制化字段 屏幕增强
    需求因为业务需求,需要将其他系统接过来的数据(以Batch字段为例)通过事务码COOIS来进行匹配展示。展示效果如下:IOHEADER附加结构第一次需要创建附加结构,如果不是第一次,可......
  • App.config配置详解
     转载地址:https://www.cnblogs.com/luna-hehe/p/9104748.html经上一篇文章https://www.cnblogs.com/luna-hehe/p/9104701.html发现自己对配置文件很是不了解,同样还是查......
  • 小程序使用canvas 2D实现签字效果
    效果如下:  请结合小程序官方文档进行解读wxml:<view><view>请在下方签字:</view><canvasid="myCanvas"type="2d"style="border:1pxsolid#d3d3d3;"......
  • doc文档数据添加
    fromdocximportDocument#创建Document对象doc=Document()#添加标题doc.add_heading('春晓',level=1)#添加段落doc.add_paragraph('作者:孟浩然')doc.add......
  • 问题:cmd途径打开url
    用startstartURLstartObsidian://open?vault=TEST打开软件obsidian的库TESTstarthttps://www.baidu.com(默认浏览器)用explorerexplorerhttps://www.baidu.com......
  • elasticsearch 5.6.16 x-pack license过期处理
    elasticsearch5.6.16x-packlicense过期处理访问官网申请免费license即可,地址为:https://register.elastic.co/marvel_register升级至6.3+版本,高版本的基础版该功......
  • router.afterEach 与 router.beforeEach
    vue中router.afterEach用法,和router.beforeEach用法router.afterEach是vue全局的导航钩子函数,我个人的理解是,进入某个路由之后触发的钩子函数,我用的比较多的有两种用......
  • Stream流中的常用方法_map 和Stream流中的count方法
    映射:map:如果需要将流中的元素映射到另一个流中,可以使用map方法<R>Stream<R>map(Function<?superT,?extendsR>mapper);该接口需要一个Function函数式接口参数,可......
  • 题解【CF209C Trails and Glades】
    CF209CTrailsandGlades解题报告图论基础题。考虑一张无向联通图存在欧拉回路的条件是什么:每一个点的度数均为偶数。但这个条件的前提是连通图,那么我们可以考虑......