newLISP Fan Club

Forum => newLISP and the O.S. => Topic started by: Sammo on November 13, 2005, 03:14:56 PM

Title: List running processes/applications
Post by: Sammo on November 13, 2005, 03:14:56 PM
Does anyone know of a windows function and associated DLL that will return a list of all running processs and/or applications — lists similar to those provided by Task Manager?



Thanks,

-- Sam
Title:
Post by: Ryon on November 13, 2005, 04:29:18 PM
Hmmm... Is there a function that can push control-alt-delete? :-)
Title:
Post by: HPW on November 14, 2005, 01:57:32 AM
Sam,



For which platform?



There is a 'NtQuerySystemInformation' in 'ntdll.dll' which seems to do this on NT/WIN2K/XP. Quite complicated. I have found a delphi-snippet.



Do you need it in neobook?
Title:
Post by: Sammo on November 14, 2005, 12:07:26 PM
Hello Hans-Peter,



Yes, I need it in Neobook. The best solution would support Win98 as well as WinNT, Win2K and WinXP.



Thanks,

-- Sam
Title:
Post by: nigelbrown on November 16, 2005, 05:48:39 PM
I've used autoit http://www.autoitscript.com/autoit3/downloads.php  to access systems type functions (from a Basic program) to manipulate clipboard and control a browser and autoit always worked well.

I see they have a function:



ProcessList

--------------------------------------------------------------------------------



Returns an array listing the currently running processes (names and PIDs).

their example is:

; List all processes

$list = ProcessList()

for $i = 1 to $list[0][0]

  msgbox(0, $list[$i][0], $list[$i][1])

next



to use the autoit dll in basic was easy.



May be worth a look.



Nigel

PS update - looking further at the dll functions the process listing is not callable - only checking if a specified process is running (see:

ProcessExists

--------------------------------------------------------------------------------



Checks to see if a specified process exists. )



Autoit scripts can be compiled so an external exe could be made that when run leaves a list of active processes as a file somewhere to be consulted.



Depends on why you want the process list?
Title:
Post by: HPW on November 18, 2005, 12:18:27 AM
>The best solution would support Win98 as well as WinNT, Win2K and WinXP.



After some test with a standalone EXE, I found that only WinNT must use 'ntdll.dll' for this. WIN95 run with the other code. Win2K and WinXP run with both variants. Have to check how to link dynamicly against 'ntdll.dll' that it is not loaded on startup, so it gives no error on systems where not present.