Re: test if a program is running
- Posted by GeorgeWalters Jul 16, 2009
- 1323 views
ChrisB said...
Hi
Thanks, but yes it is, unless you meant somewhere else
<quote>
forgot something to the sample code, you should add the following lines.
add this binding
constant iCloseHandle=define_c_proc(kernel32,"CloseHandle",{C_POINTER})
c_proc(iCloseHandle,{pHandle})
</quote>
Chris
You had actually added this in your previous post and I included it in the test rtn. Here's a code snippit.
for i = 1 to length(pids) do pHandle=c_func(iOpenProcess,{PROCESS_QUERY_INFORMATION,0,pids[i]}) if pHandle then -- query process name fnVal = c_func(iGetProcessImageFileName,{pHandle,pBuffer,BUFFER_SIZE}) c_proc(iCloseHandle,{pHandle}) if fnVal then names &={peek({pBuffer,fnVal})} p = find(0,names[length(names)]) if p then names[length(names)] = names[length(names)][1..p-1] end if end if end if end for
However mine still crashes on the 3rd time. Any more ideas?