The php.net site offers some guidance:
http://php.net/manual/en/book.w32api.php
w32api_deftype
w32api_init_dtype
w32api_ invoke_function
w32api_register_function
w32api_set_call_method
The cleanest way is to send a WM_CLOSE message to a Windows program.
I more brutal but effective way to kill a Win32 process is to use pskill.exe.
You can download it here:
http://technet.microsoft.com/en-us/sysinternals/bb896683.aspx
You can also call into a vbscript program as follows:
' ProcessKillLocal.vbs
' Sample VBScript to kill a program
' Author Guy Thomas http://computerperformance.co.uk/
' Version 2.7 - December 2010
' ------------------------ -------------------------------'
Option Explicit
Dim objWMIService, objProcess, colProcess
Dim strComputer, strProcessKill
strComputer = "."
'YOU NEED TO REPLACE calc.exe WITH THE APP YOU WISH TO KILL
strProcessKill = "'calc.exe'"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & strProcessKill )
For Each objProcess in colProcess
objProcess.Terminate()
Next
WSCript.Echo "Just killed process " & strProcessKill _
& " on " & strComputer
WScript.Quit
' End of WMI Example of a Kill Process