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);
}
}
}