{"id":44,"date":"2005-11-25T17:17:55","date_gmt":"2005-11-25T22:17:55","guid":{"rendered":"http:\/\/www.juixe.com\/techknow\/?p=44"},"modified":"2005-11-25T17:17:55","modified_gmt":"2005-11-25T22:17:55","slug":"visual-kill-9","status":"publish","type":"post","link":"http:\/\/juixe.com\/techknow\/index.php\/2005\/11\/25\/visual-kill-9\/","title":{"rendered":"Visual Kill -9"},"content":{"rendered":"<p>Here is some Visual Basic script code which allows you to terminate a process given a process id number.<\/p>\n<pre>\n' Kills a program given its process id.\nFunction ProgKill(strProcessId)\n   ' Declare used variables\n   Dim strWQL\n   Dim objProcess\n   Dim objResult\n   Dim intReturnCode\n   Dim wmi\n\n   Set wmi = GetObject(&quot;winmgmts:&quot;)\n   ' Get Process by WMI\n   strWQL = _\n      &quot;select * from win32_process where ProcessId='&quot; _\n      & strProcessId & &quot;'&quot;\n   Set objResult = wmi.ExecQuery(strWQL)\n\n   ' Kill all found process\n   For Each objProcess in objResult\n      ' Try to kill the process\n      intReturnCode = objProcess.Terminate(0)\n   Next\nEnd Function\n<\/pre>\n<p>You can use code like this to kill a process started in your script after a given event or set time.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is some Visual Basic script code which allows you to terminate a process given a process id number. &#8216; Kills a program given its process id. Function ProgKill(strProcessId) &#8216; Declare used variables Dim strWQL Dim objProcess Dim objResult Dim intReturnCode Dim wmi Set wmi = GetObject(&quot;winmgmts:&quot;) &#8216; Get Process by WMI strWQL = _ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":""},"categories":[11,3,5],"tags":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p902K-I","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/posts\/44"}],"collection":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/comments?post=44"}],"version-history":[{"count":0,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/posts\/44\/revisions"}],"wp:attachment":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/media?parent=44"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/categories?post=44"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/tags?post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}