http://msdn.microsoft.com/en-us/library/ms633500(v=vs.85).aspxによると、FindWindowEx関数を定義します。
using System.Runtime.InteropServices;
[DllImport("user32.dll", CharSet=CharSet.Unicode)]
static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle);
これで、childAfterをIntPtr.Zeroとして設定する「ボタン」コントロール(Spy ++から名前を取得)の最初のハンドルを見つけることができます。
IntPtr hWndParent = new IntPtr(2032496); // providing parent window handle
IntPtr hWndButton = FindWindowEx(hWndParent, IntPtr.Zero, "Button", string.Empty);
その親ウィンドウ内で「ボタン」コントロールの2番目、3番目、または任意のハンドルを取得するにはどうすればよいですか?実際、ボタンのタイトルは異なる場合があるため、4番目のパラメーターを定義する名前で直接見つけることはできません。