Ref: http://dan.zzhc.org/post/3617137304/capture-window-with-c-sharp
/* 引入 Win32 API 中的 User32.DLL * 需要加上 using System.Runtime.InteropServices; */ [DllImport("user32.dll")] public static extern Boolean GetWindowRect(IntPtr hWnd, ref Rectangle bounds); public void CaptureWindow () { /* 取得目標視窗的 Handle * 需要加上 using System.Diagnostics; */ Process[] process = Process.GetProcessesByName("notepad"); /* 取得該視窗的大小與位置 */ Rectangle bounds; GetWindowRect(process[0].MainWindowHandle, ref bounds); /* 抓取截圖 */ Bitmap screenshot = new Bitmap(bounds.Width, bounds.Height, PixelFormat.Format32bppArgb); Graphics gfx = Graphics.FromImage(screenshot); gfx.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy); /* 利用 PictureBox 顯示出來 */ imageView.Image = (Image) screenshot; imageView.Update(); }
http://dan.zzhc.org/post/3617137304/capture-window-with-c-sharp
/* 引入 Win32 API 中的 User32.DLL * 需要加上 using System.Runtime.InteropServices; */ [DllImport("user32.dll")] public static extern Boolean GetWindowRect(IntPtr hWnd, ref Rectangle bounds); public void CaptureWindow () { /* 取得目標視窗的 Handle * 需要加上 using System.Diagnostics; */ Process[] process = Process.GetProcessesByName("notepad"); /* 取得該視窗的大小與位置 */ Rectangle bounds; GetWindowRect(process[0].MainWindowHandle, ref bounds); /* 抓取截圖 */ Bitmap screenshot = new Bitmap(bounds.Width, bounds.Height, PixelFormat.Format32bppArgb); Graphics gfx = Graphics.FromImage(screenshot); gfx.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy); /* 利用 PictureBox 顯示出來 */ imageView.Image = (Image) screenshot; imageView.Update(); }
http://www.red-gate.com/products/reflector/
.NET Reflector enables you to easily view, navigate, and search through, the class hierarchies of .NET assemblies, even if you don't have the code for them. With it, you can decompile and analyze .NET assemblies in C#, Visual Basic, and IL.