WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Killing and Terminating Apps

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Kill an Application

Keywords:  kill application close

Question:

Is there anyway to write a wbt file to:
  1. Open the Close Program Box with CTRL-ALT-DEL.

  2. Search for a specific line in that dialog box and highlight it.

  3. Click on End Task.
Thanks.

Answer:

See IntControl 56, it can terminate an application by exe name, or window title.

OR

Try our Process extender functions.

NOTES: Windows NT/2000: The handle must have PROCESS_TERMINATE access.

** Use this function only in extreme circumstances.**

The tKillProc function is used to unconditionally cause a process to exit. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if tKillProc is used rather than WinClose.

tKillProc causes all threads within a process to terminate, and causes a process to exit, but DLLs attached to the process are not notified that the process is terminating.

Terminating a process causes the following:

Example:

Addextender("wwprc44I.dll")
run("notepad.exe","")

count=tCountProc()
proclist=tlistproc()
killapp=askitemlist("*** Choose Notepad from the list ***",proclist,@TAB,@unsorted,@single)
procname=itemextract(1,killapp,"|")
procid=itemextract(2,killapp,"|")

if Procid!=""
   hProcess=tOpenProc(procid,3);PROCESS_TERMINATE
	if hProcess
	   tKillProc(hProcess)
		tcloseproc(hProcess)  
	   Message("tKillProc","%procname% is terminated")
	endif
else
  Message("tKillProc","Need a valid process id")

endif


Article ID:   W13264
Filename:   Kill Apps albeit Ungracefully.txt
File Created: 2013:04:01:09:18:48
Last Updated: 2013:04:01:09:18:48