Micro Focus QTP (UFT) Forums
Killing the windows process using QTP Script. - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: Killing the windows process using QTP Script. (/Thread-Killing-the-windows-process-using-QTP-Script)



Killing the windows process using QTP Script. - nagaraj_kv - 06-07-2011

I am creating word object and excel object in my script. After execution of script, windows process (winword.exe) will be showing in Task Manager.
After multiple execution of test cases, it keep on creating WINWORD.exe in task manager. After some time, script will not work.
After execution of every script, I can kill the process.

How to kill this Windows process (WINWORD.exe) using QTP script ?


RE: Killing the windows process using QTP Script. - cavinandan - 06-07-2011

apply this method

wdobject.Quit


RE: Killing the windows process using QTP Script. - ksshwetha - 06-15-2011

Hi,

You can use killExcel() to kill the excel process before opening or after editing.





RE: Killing the windows process using QTP Script. - Rodrigo Carvalho - 05-03-2012

Very easy: SystemUtil.CloseProcessByName("WINWORD.exe")

* You may want to save your file before killing the process... good luck.

Rodrigo


RE: Killing the windows process using QTP Script. - Ankesh - 05-03-2012

Hi,

You can use the below function. This will kill any process runing in task manager. All u need to do is to pass the Program name.
Code:
Public Function General_CloseProcess(strProgramName)
   Dim objshell
   Set objshell=CreateObject("WScript.Shell")
   objshell.Run "TASKKILL /F /IM "& strProgramName
   Set objshell=nothing
End Function

'If want to close excel
Call General_CloseProcess("Excel.EXE")
'Killing word
Call General_CloseProcess("WINWORD.exe")

Regards,
Ankesh