📄 class1.cs
字号:
using System;
using System.Runtime.InteropServices;
namespace Example077_实现回调函数
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
public delegate bool CallBack(int hwnd, int lParam);
class Class1
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
[DllImport("user32")]
public static extern int EnumWindows(CallBack x, int y);
static void Main(string[] args)
{
//
// TODO: 在此处添加代码以启动应用程序
//
CallBack myCallBack = new CallBack(Class1.Report);
EnumWindows(myCallBack, 0);
Console.Read();
}
public static bool Report(int hwnd, int lParam)
{
Console.Write("Window handle is ");
Console.WriteLine(hwnd);
return true;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -