08-08-2024, 04:17 PM
(08-08-2024, 01:59 PM)BDS107 Wrote: Can you request a list in QB64 like the DOS command TASKLIST?There's nothing built-in for this so you'll have to use OS-specific APIs for it.
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.
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.