Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Close an application - doesn't work!

  • Please log in to reply
32 replies to this topic
  • Members
  • 390 posts
  • Last active: Nov 25 2015 12:35 PM
  • Joined: 02 Dec 2010

EndTask takes _three_ parameters. This is how to call EndTask to 'force' the process to terminate. I assume this will work like the WMI method.

, Ptr , WinExist("ahk_exe Pvxwin32.exe")
, UInt, false
, UInt, true) ; force
MsgBox, % ErrorLevel

If by 'soft' killing the process (EndTask -> false) it is Windows that eventually kills the process because of the timeout, then that probably means that the process could just be 'hard' killed, as the process will hang anyway.

As for which method is the best, just pick the one you want.

New Autohotkey forum: http://ahkscript.org.

  • Members
  • 558 posts
  • Last active: Dec 13 2019 02:02 PM
  • Joined: 01 Feb 2006

Thank you very much!


The last example is perhaps the best (I think).
I can use the same script in both Win XP and Win 8.
it gives "0" as the ErrorLevel in the both OS (I hope the same in Win 7).


Maybe even better than the script below?

oWMI := ComObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
NAme := "Pvxwin32.exe"
for proc in oWMI.ExecQuery("Select * from Win32_Process Where Name = '" NAme "'")
	MsgBox % proc.terminate()

I have only tested the script with one configuration of Pvxwin32.exe - yet :p !



  • Administrators
  • 4345 posts
  • AutoHotkey Foundation
  • Last active: May 02 2019 09:16 PM
  • Joined: 21 Dec 2007

That method of ending an application works in all versions of win7 64bit or 32 bit

Never lose.