Depending on the operation, terminating by PID can be a very complex issue. For instance, let's say I have three of the same paint.net programs running. They all have the same image name, but different PIDs. I only want to terminate the second one. So, how do I do that? Well, I can't use the image name, because it would close all three, so hey, I'll terminate by PID, instead! Well, which PID? Why, the second one, of course! Ah, but how do I determine which one is the second one? Well, if task list creates a time ordered list, that would not be a problem, but if it doesn't, things get pretty open for bad results, even with additional programming of a QB64 app running in the background to try to add a time stamp to that task list. So, I'd have to test out has task list orders the list of processes running, and hope it is by time. If not, more work to do.
So, I'm not sure what you are trying to achieve here, simple termination by image name, or you need the PID for a more complex issue, as discussed above. There may be alternative solutions, too. I just don't know of any at the moment. At any rate, no, this cannot be done natively in QB64, much like keeping a window persistent can't be done natively, either. Frankly, if it wasn't for SHELL, I would have pitched QBasic back in the 1990's. It at least made it possible to achieve some of the things that were impossible in native QB. Unfortunately, it was just too daunting a task for Rob to make all those SHELL functions, Windows API functions, which can be done with libraries, native to QB64. I'm just assuming he could have, if he had the time, help, and energy.
Pete