kill process/ end process of bluestacks -
i'm trying make program open , close bluestacks application. close means totally exiting application. since if exit bluestacks app process restart. processes i'm trying kill is:
- "hd-blockdevice.exe"
- "hd-agent.exe"
- "hd-logrotatorservice.exe"
- "hd-updaterservice.exe"
when manually kill first process, other process close except 2~3 ones. it's kinda pain kill 4 processes every time close application creating one. here code
public class form1 dim p() process private sub form1_load(byval sender system.object, byval e system.eventargs) handles mybase.load timer_processcheck.start() end sub private sub timer_processcheck_tick(byval sender system.object, byval e system.eventargs) handles timer_processcheck.tick p = process.getprocessesbyname("hd-blockdevice.exe") if p.count > 0 ' process running 'button_close.enabled = true else ' process not running 'button_close.enabled = false end if end sub private sub button_open_click(byval sender system.object, byval e 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 system.object, byval e system.eventargs) handles button_close.click 'p = process.getprocessesbyname("hd-blockdevice.exe") 'p.kill() 'p.close() 'while p.length > 0 'for integer = p.length - 1 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 object, byval e system.eventargs) handles timer_processkill.tick each prog process in process.getprocesses if prog.processname = "hd-blockdevice.exe" prog.kill() end if next end sub end class
my problems are:
- my process checker wont work (it doesn't enable close button when process there)
- any of process kill have doesn't work (those ones i've made comment in code anyways)
well after looking @ on different angle found idea kill via command prompt... , after reading lot on net how found answer make work...
public class form1 private sub form1_load(byval sender system.object, byval e system.eventargs) handles mybase.load dim working_area rectangle = systeminformation.workingarea dim neww integer = working_area.left + working_area.width - me.width dim newh integer = working_area.top + working_area.height - me.height me.location = new point(neww, newh) timer_processcheck.start() end sub private sub button_open_click(byval sender system.object, byval e 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 system.object, byval e system.eventargs) handles button_close.click timer_processcheck.stop() process.start("cmd.exe", "/c taskkill /im hd-blockdevice.exe /f") process.start("cmd.exe", "/c taskkill /im hd-agent.exe /f") process.start("cmd.exe", "/c taskkill /im hd-logrotatorservice.exe /f") process.start("cmd.exe", "/c taskkill /im hd-updaterservice.exe /f") me.close() end sub private sub timer_processcheck_tick(byval sender system.object, byval e system.eventargs) handles timer_processcheck.tick dim oprocess new process() dim ostartinfo new processstartinfo("tasklist") ostartinfo.createnowindow = true ostartinfo.useshellexecute = false ostartinfo.redirectstandardoutput = true oprocess.startinfo = ostartinfo oprocess.start() dim soutput string using ostreamreader system.io.streamreader = oprocess.standardoutput soutput = ostreamreader.readtoend() end using if soutput.contains("hd-blockdevice.exe") button_close.enabled = true else button_close.enabled = false end if end sub end class
Comments
Post a Comment