SendMessage() pour DBNavigator
Bonsoir!
Je me trouve dans une impasse...
Le but est de gérer une application depuis ma propre application. N'ayant pas la main sur le code de l'application à gérer voici comment je procède:
Code:
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); |
Les handle sont bien récupérés et validés avec Spy++...
Or, ce "DBNavigator" possède une rangée de bouton, afin de continuer il faut absolument que je "simule" un clic sur l'un d'eux...
J'ai essayé la manière pour cliquer un boutton, pour gérer un menu, incluant (GetMenu(),GetMenuItemID()...) sans succès :aie:
Si une personne s'est déjà trouvée dans cette impasse, je serai ravi de connaitre l'issue :)
Merci d'avance!!!