How do I kill a spawned process?

Wah…! This is pretty involved when it needs to be cross-platform. I’m starting to wonder if there isn’t a better solution to this problem.
My main options are:

  1. somehow identify which program runs which mime.
  2. start playing videos by opening the files with the most obvious player per platform (windows media player for Windows).
  3. somehow identify and kill processes that were spawned from xdg-open $f (and the Windows and Mac and Windows variations).

All three options have their disadvantages: #1 seems really hard on Windows, #2 is very vulnerable to errors (what if that ultra-strange codec file is played by some local proprietary program), #3 is apparently impossible.

I’d appreciate any insight you might have…!