日期:2014-05-17 浏览次数:21316 次
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;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[DllImport("user32.dll", EntryPoint = "SendMessage")]
static extern bool PostMessage(IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam);
[DllImport("User32.dll", EntryPoint = "FindWindow")]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("User32.dll", EntryPoint = "FindWindowEx")]
private static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpClassName, string lpWindowName);
public static uint WM_LBUTTONDOWN = 0x201;
//按下鼠标左键
public static uint WM_LBUTTONUP = 0x202;
//释放鼠标左键
private void Form1_Load(object sender, EventArgs e)
{
}
public static IntPtr gethWnd()
{
String s = "EVE - xxxxx";
IntPtr hWnd = FindWindow("triuiScreen", s);
if (hWnd == IntPtr.Zero)
{
MessageBox.Show("error");
return IntPtr.Zero;
}else
{
return hWnd;
}
}
IntPtr hWnds = gethWnd();
&