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 26 27
| //handle fenetre de l'application a problème(fenetre parente)
hWnd = (IntPtr)FindWindow("ThunderRT6FormDC", "Form1");
int hwndInt = hWnd.ToInt32();
IntPtr hwnd = hWnd;
StringBuilder sbc = new StringBuilder(256);
//boucle qui permet de récupérer les fenetre enfant
while (hwndInt != 0)
{
hwndInt = hwnd.ToInt32();
//on récupère le nom des classes
GetClassName(hwndInt, sbc, 256);
//si la classe est identique correspond a la fenetre voulue
if ((sbc.ToString().IndexOf("ThunderRT6FormDC", 0) > -1) && (hwndInt != hWnd.ToInt32()))
{
//on rdéplace, redimensionne, tue le processus, ferme la fenetre....
SetWindowPosition(1900, 1900, hwnd, 0, 0);
//SetWindowPos(hwnd, 1, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE); //CloseHandle(hwnd);
//ShowWindow(hwnd, SW_HIDE);
//Process chosen = Process.GetProcessById(Int32.Parse(processId.ToString()));
//chosen.Kill();
//chosen.WaitForExit();
}
hwnd = GetWindow(hwnd, GW_HWNDNEXT);
}
} |
Partager