Pausing a process in Windows

后端 未结 1 1322
既然无缘
既然无缘 2021-01-15 12:12

I\'m making a nice little Python GUI frontend for ffmpeg on Windows (one that is specifically designed to convert videos to an iPhone-friendly format and automatically impor

1条回答
  •  北荒
    北荒 (楼主)
    2021-01-15 12:56

    You can easily do this by using psutil ( https://github.com/giampaolo/psutil ):

    import psutil
    pid = 1034  # replace this with the pid of your process
    p = psutil.Process(pid)
    p.suspend()
    

    ...to resume it:

    p.resume()
    

    Internally this is implemented in C by using SuspendThread() and ResumeThread() Windows system calls.

    0 讨论(0)
提交回复
热议问题