1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| [DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
public static extern int SendMessage(int hWnd, uint Msg, int wParam, int lParam);
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr GetWindow(IntPtr hWnd, GetWindow_Cmd uCmd);
enum GetWindow_Cmd : uint
{
GW_HWNDFIRST = 0,
GW_HWNDLAST = 1,
GW_HWNDNEXT = 2,
GW_HWNDPREV = 3,
GW_OWNER = 4,
GW_CHILD = 5,
GW_ENABLEDPOPUP = 6
}
static void Main(string[] args)
{
[...]
IntPtr hwnd3 = FindWindowEx(hwnd2, IntPtr.Zero, "TTabSheet", "Form");
IntPtr hwnd4 = FindWindowEx(hwnd3, IntPtr.Zero, "TMGDBNavigator", null);
IntPtr ptrchild = GetWindow(hwnd, GetWindow_Cmd.GW_CHILD);
ptrchild = GetWindow(ptrchild, GetWindow_Cmd.GW_HWNDNEXT);
SendMessage((int)hwnd4, WM_COMMAND, (int)ptrchild, 0); |
Partager