vba - Visual Basic: killing the process of an Application Object -
in visual basic create application object , start it:
gapp = new canoe.application gmeasurement = gapp.measurement gapp.open(arrargs(0), false, false) gmeasurement.start()
once application finishes processing data 2 possible scenarios may happen: (i) data file corrupt , (in normal circumstances) allert window raised , (ii) data file ok. in (ii) case can quite application gapp.quit()
. in case (i) gapp.quit()
not work, since program expects input user (although not see window @ all).
question 1: how can quite process corresponding gapp? quiting in way:
each p process in process.getprocesses if p.processname = "canoe32" p.kill() end if next
in general bad solution since more instances of canoe32 may run (although in particular case 1 process of binary may run on system).
question 2 more elegant solution quit gapp in case has child windows?
any comments helpful
a possible solution problem use similar ticket:
how-do-i-get-the-process-id-from-a-created-excel-application-object
Comments
Post a Comment