using System.Runtime.InteropServices;
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
public static extern bool IsWindow(IntPtr hWnd);
public static void Main(string[] args) {
IntPtr hNotepad = FindWindow("Notepad", null);
if ( hNotepad != IntPtr.Zero ) {
if ( IsWindow(hNotepad) )
Console.WriteLine("유효한 윈도우 핸들입니다.");
Console.WriteLine("유효하지 않은 윈도우 핸들입니다.");
Console.WriteLine("메모장이 없습니다.");