Okay, before I am going to post my problem, I am going to explain the project. The coding that I have a problem with might make people think that I am creating some malware or something stupid.
So the project I am doing is associated with iTunes. iTunes allows people to have one library. There is another way, but it is very confusing to some people, and very unreliable. So my project is that I will allow people to have multiple iTunes libraries on one computer.
So the problem is this. In order to have an option to choose your library, I gotta make sure that iTunes is not running. So this is the script:
So when I use the Threading.Thread.Sleep(2000) code, the form becomes unresponsive. How do I fix the problem?Code:Private Sub CheckAndCloseiTunes() retry: 'Custom class that includes the function to safely close iTunes Dim Processes As Process() = Process.GetProcessesByName("iTunes") If Processes.Length > 0 Then Dim SafeProcessQuit As New VitalMod.VitalOptions SafeProcessQuit.CloseApplication("iTunes") 'After every two seconds, makes sure iTunes has exited. Threading.Thread.Sleep(2000) GoTo retry Else Exit Sub End If End Sub




Reply With Quote