MSDN 方法: コールバック関数を実装する
MSDN EnumWindows
BOOL EnumWindows( WNDENUMPROC lpEnumFunc, // コールバック関数 LPARAM lParam // アプリケーション定義の値 );
using System; using System.Runtime.InteropServices; namespace pinvoke { class Program { public delegate bool CallBack(int hwnd, int lParam); [DllImport("user32")] public static extern int EnumWindows(CallBack x, int y); public static void Main() { CallBack myCallBack = new CallBack(Report); EnumWindows(myCallBack, 0); } public static bool Report(int hwnd, int lParam) { Console.Write("Window handle is "); Console.WriteLine(hwnd); return true; } }