I'm trying to make a program that will open and close bluestacks application. Close means totally exiting the application. Since even if you exit the bluestacks app the process will just restart. The processes I'm trying kill is:
- "HD-BlockDevice.exe"
- "HD-Agent.exe"
- "HD-LogRotatorService.exe"
- "HD-UpdaterService.exe"
When I manually kill the first process, the other process will close except for the 2~3 ones. It's kinda pain to kill four processes every time i close the application so i am creating this one. Here is my code
Public Class Form1
Dim p() As Process
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer_ProcessCheck.Start()
End Sub
Private Sub Timer_ProcessCheck_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer_ProcessCheck.Tick
p = Process.GetProcessesByName("HD-BlockDevice.exe")
If p.Count > 0 Then
' Process is running
'Button_Close.Enabled = True
Else
' Process is not running
'Button_Close.Enabled = False
End If
End Sub
Private Sub Button_Open_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Open.Click
Process.Start("C:\Program Files (x86)\BlueStacks\HD-StartLauncher.exe")
End Sub
Private Sub Button_Close_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Close.Click
'p = Process.GetProcessesByName("HD-BlockDevice.exe")
'p.kill()
'p.close()
'While p.Length > 0
'For i As Integer = p.Length - 1 To 0 Step -1
'p(i).CloseMainWindow()
'Next
'p = Process.GetProcessesByName("HD-BlockDevice.exe")
'End While
'Timer_ProcessKill.Start()
End Sub
Private Sub Timer_ProcessKill_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer_ProcessKill.Tick
For Each prog As Process In Process.GetProcesses
If prog.ProcessName = "HD-BlockDevice.exe" Then
prog.Kill()
End If
Next
End Sub
End Class
My problems are:
- my process checker wont work (it doesn't enable the close button when the process is already there)
- any of the process kill I have look up doesn't work (those are the ones I've made to comment in the code anyways)
well after looking at it on different angle i finally found an idea to kill it via command prompt... and after reading a lot on the net how to do it i finally found an answer to make it work...