[DllImport("user32.dll")] public static extern int FindWindow ( string lpClassName, // class name string lpWindowName // window name ); [DllImport("user32.dll")] public static extern int SetForegroundWindow ( int hWnd // handle to window ); private void button_Notepad_Click(object sender, EventArgs e) { if (File.Exists(localisation)) { System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(localisation, "notepad++"); System.Diagnostics.Process.Start(psi); } // rechercher le handle de la fenêtre int iHandle = NativeWin32.FindWindow(null, localisation); NativeWin32.SetForegroundWindow(iHandle); // Ouvrir la fenetre Atteindre : Ctrl+G System.Windows.Forms.SendKeys.Send("{ESC}%R{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}"); // Entrer le numéro de ligne System.Windows.Forms.SendKeys.Send(num_ligne); // valider System.Windows.Forms.SendKeys.Send("{ENTER}"); }