using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace cstest
{
public partial class Form1 : Form
{
//定义一个符合WINAPI返回值和参数的委托
public delegate bool CallBack(IntPtr hwnd, int lParam);
//声明符合上述委托的函数(定义一个函数指针)
private static CallBack myCallBack;
public Form1()
{
myCallBack = new CallBack(Report);
InitializeComponent();
GetHandle("C#");
this.textBox1.Multiline = true;
this.textBox1.Dock = DockStyle.Fill;
}
private void GetHandle(string windcaption)
{
IntPtr mainHandle = FindWindow(null, windcaption);
if (IntPtr.Zero != mainHandle)
.NET调用WINAPI 获取应用窗体句柄和内容
最新推荐文章于 2021-09-16 11:24:42 发布
本文介绍如何在.NET环境中利用WINAPI函数获取应用程序的窗体句柄及窗体内容,涉及Windows API的调用技巧和相关知识点。
摘要由CSDN通过智能技术生成