2014-06-01から1ヶ月間の記事一覧

プロセス名でウィンドウハンドル取得 コピペ用

C#

Process[] ps = Process.GetProcessesByName("hogehoge"); /* Process[] ps = Process.GetProcesses(); foreach(var p in ps) { Console.WriteLine(p.ProcessName); } */ if (!ps.Any()) { return; } IntPtr hWnd = ps[0].MainWindowHandle; RECT rect = new…

Win32API コピペ用

C#

using System.Runtime.InteropServices; using System.Diagnostics; #region GetWindowRect [StructLayout(LayoutKind.Sequential, Pack = 4)] private struct RECT { public int left; public int top; public int right; public int bottom; } [DllImport(…