Interférence dans un processus
Bonjour,
J'écris dans Notepad des données provenant d'une table. Le problème est : tant que le processus n'est pas terminé je ne peux rien faire. Si j'utilise ma souris pour faire une action quelconque, l'écriture s'arrête.
Comment faire pour pouvoir continuer à utiliser mon application pendant l'écriture du fichier afin de ne pas devoir attendre la fin du processus
Merci de vos réponses.
Voici mon code :
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 26 27 28 29 30 31
| Private Async Sub btnImprimer_Click(sender As Object, e As EventArgs) Handles btnImprimer.Click
Dim notepad As Process = New Process()
notepad.StartInfo.FileName = "Notepad.exe"
notepad.StartInfo.UseShellExecute = False
notepad.StartInfo.RedirectStandardInput = True
notepad.Start()
notepad.WaitForInputIdle()
OuvrirConnection()
Dim Select_cmd As New SQLiteCommand("Select * FROM Phrases order by Etape")
Select_cmd.Connection = ObjetConnection
Dim reader As SQLiteDataReader = Select_cmd.ExecuteReader()
If notepad.Responding Then
Do While reader.Read
Dim maLigne As String = reader.Item("Phrase_ES") & vbCrLf &
reader.Item("Phrase_FR") & vbCrLf
System.Windows.Forms.SendKeys.SendWait(maLigne)
Loop
End If
FermerConnection()
notepad.Close()
End Sub |