Re: test if a program is running

new topic     » goto parent     » topic index » view thread      » older message » newer message
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})

add this line after the call to GetProcessImageFileName
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?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu