Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tasklist
#7
(08-08-2024, 01:59 PM)BDS107 Wrote: Can you request a list in QB64 like the DOS command TASKLIST?
You can of course use a SHELL and save the result temporarily on disk. But that is too slow if you want to update constantly. So, I don't want this.
There's nothing built-in for this so you'll have to use OS-specific APIs for it.

On Windows, you can use `EnumProcesses` and then `OpenProcess` to get the list of all Process IDs and information about each. You can call these and the other associated APIs via `Declare Library`.

On Linux /proc is the actual API, so you should be able to do it all from QB64 code (no Declare Library necessary). Use `_FILES$` to iterate the contents of `/proc` to get all the process IDs (each process ID is a folder name). Then use `OPEN` to read the various files in each process directory to get information on each process. The docs for what files are there and what they contain is here.

On Mac OS I'm not totally sure. Google suggests there is a `libproc` library you can use, which you would then call via `Declare Library`. It seems more limited in terms of what you can read compared to Windows and Linux though.
Reply


Messages In This Thread
Tasklist - by BDS107 - 08-08-2024, 01:59 PM
RE: Tasklist - by SpriggsySpriggs - 08-08-2024, 02:08 PM
RE: Tasklist - by Steffan-68 - 08-08-2024, 04:07 PM
RE: Tasklist - by SMcNeill - 08-08-2024, 02:34 PM
RE: Tasklist - by Pete - 08-08-2024, 03:31 PM
RE: Tasklist - by Pete - 08-08-2024, 04:13 PM
RE: Tasklist - by DSMan195276 - 08-08-2024, 04:17 PM
RE: Tasklist - by BDS107 - 08-09-2024, 09:57 AM
RE: Tasklist - by BDS107 - 08-09-2024, 08:53 PM
RE: Tasklist - by TerryRitchie - 08-09-2024, 09:44 PM
RE: Tasklist - by SMcNeill - 08-10-2024, 03:06 AM
RE: Tasklist - by Pete - 08-10-2024, 03:23 AM



Users browsing this thread: 9 Guest(s)