using System;
using System.Runtime.InteropServices;
public class CSharpAPIsDemo
{
public CSharpAPIsDemo()
{
}
[DllImport("user32")]
public static extern int EnumWindows(CallBack x, int y);
public delegate bool CallBack(int hwnd, int lParam);
public static bool Report(int hwnd, int lParam)
{
Console.Write("Window handle is :");
Console.WriteLine(hwnd);
return true;
}
public void PrintHandles()
{
CallBack myCallBack = new CallBack(Report);
EnumWindows(myCallBack, 0);
}
}