From: Park Heesob Date: 2003-01-21T13:35:23+09:00 Subject: Re: [WIN] killing a process Hi, "Shashank Date" wrote in message news:xH3X9.47653$Gm2.993831@twister.rdc-kc.rr.com... > Using ruby1.7.3 (2002-11-17) [i386-mswin32] > > 1. Under Windows (XP), is there a way to kill a process which is created > using the system(" ...") call ? > Use taskmgr.exe > 2. How does one use the Windows API: TerminateProcess? > > Here is my attempt, assuming pid = 1234 (not sure if I am doing it right): > > require 'Win32API' > > tp = Win32API.new("kernel32","TerminateProcess",['i','i'],'i') > tp.call(1234,1) > > Try this: OpenProcess = Win32API.new("kernel32","OpenProcess",['L','L','L'],'L') TerminateProcess = Win32API.new("kernel32","TerminateProcess",['L','L'],'L') TerminateProcess.Call(OpenProcess.Call(0x00100001, 0 ,pid),0) Park Heesob