久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <i id='RE70V'><tr id='RE70V'><dt id='RE70V'><q id='RE70V'><span id='RE70V'><b id='RE70V'><form id='RE70V'><ins id='RE70V'></ins><ul id='RE70V'></ul><sub id='RE70V'></sub></form><legend id='RE70V'></legend><bdo id='RE70V'><pre id='RE70V'><center id='RE70V'></center></pre></bdo></b><th id='RE70V'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='RE70V'><tfoot id='RE70V'></tfoot><dl id='RE70V'><fieldset id='RE70V'></fieldset></dl></div>

    1. <small id='RE70V'></small><noframes id='RE70V'>

        <bdo id='RE70V'></bdo><ul id='RE70V'></ul>
    2. <legend id='RE70V'><style id='RE70V'><dir id='RE70V'><q id='RE70V'></q></dir></style></legend>

      <tfoot id='RE70V'></tfoot>

        如何有效地殺死 C++ (Win32) 中的進程?

        How to effectively kill a process in C++ (Win32)?(如何有效地殺死 C++ (Win32) 中的進程?)

          <bdo id='J0vwS'></bdo><ul id='J0vwS'></ul>

              <i id='J0vwS'><tr id='J0vwS'><dt id='J0vwS'><q id='J0vwS'><span id='J0vwS'><b id='J0vwS'><form id='J0vwS'><ins id='J0vwS'></ins><ul id='J0vwS'></ul><sub id='J0vwS'></sub></form><legend id='J0vwS'></legend><bdo id='J0vwS'><pre id='J0vwS'><center id='J0vwS'></center></pre></bdo></b><th id='J0vwS'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='J0vwS'><tfoot id='J0vwS'></tfoot><dl id='J0vwS'><fieldset id='J0vwS'></fieldset></dl></div>
                <tbody id='J0vwS'></tbody>

              <small id='J0vwS'></small><noframes id='J0vwS'>

              • <legend id='J0vwS'><style id='J0vwS'><dir id='J0vwS'><q id='J0vwS'></q></dir></style></legend>

                  <tfoot id='J0vwS'></tfoot>
                1. 本文介紹了如何有效地殺死 C++ (Win32) 中的進程?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我目前正在編寫一個非常輕量級的程序,所以我必須使用 C++,因為它沒有綁定到 .NET 框架,這會大大增加程序的大小.

                  I am currently writing a very lightweight program so I have to use C++ since it is not bound to .NET framework which drastically increases size of the program.

                  我需要能夠終止進程,為此我需要獲得進程句柄.不幸的是,我還沒有想出如何做到這一點.

                  附言我知道要終止進程,您必須使用 TerminateProcess.

                  P.S. I know that to kill a process you have to use TerminateProcess.

                  推薦答案

                  OpenProcess() 所需的 PID 通常不容易掌握.如果你得到的只是一個進程名稱,那么你需要迭代機器上正在運行的進程.使用 CreateToolhelp32Snapshot 執行此操作,然后使用 Process32First 并使用 Process32Next 循環.PROCESSENTRY32.szExeFile 為您提供進程名稱(不是路徑!),th32ProcessID 為您提供 PID.

                  The PID you need for OpenProcess() is not normally easy to get a hold of. If all you got is a process name then you need to iterate the running processes on the machine. Do so with CreateToolhelp32Snapshot, followed by Process32First and loop with Process32Next. The PROCESSENTRY32.szExeFile gives you the process name (not path!), th32ProcessID gives you the PID.

                  接下來的考慮是該過程可能會出現不止一次.并且有可能將相同的進程名稱用于非常不同的程序.比如設置".如果您不只是想將它們全部殺死,則需要嘗試從它們獲取一些運行時信息.窗口標題欄文本,也許.GetProcessImageFileName() 可以為您提供 .exe 的路徑.它使用本機內核格式,您需要 QueryDosDevice 將磁盤驅動器設備名稱映射到驅動器號.

                  The next consideration is that the process may appear more than once. And there's a chance that the same process name is used for very different programs. Like "Setup". If you don't just want to kill them all, you'll need to try to obtain some runtime info from them. Window caption bar text, perhaps. GetProcessImageFileName() can give you the path to the .exe. It uses the native kernel format, you'd need QueryDosDevice to map a disk drive device name to a drive letter.

                  接下來要考慮的是您在 OpenProcess() 中要求的權限.您不太可能獲得PROCESS_ALL_ACCESS,您只需要PROCESS_TERMINATE.雖然這也是特權.確保您用于運行程序的帳戶可以獲得該權限.

                  The next consideration is the rights you ask for in OpenProcess(). You are unlikely to get PROCESS_ALL_ACCESS, all you need is PROCESS_TERMINATE. Although that's privileged as well. Ensure the account you use to run your program can obtain that right.

                  這篇關于如何有效地殺死 C++ (Win32) 中的進程?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  In what ways do C++ exceptions slow down code when there are no exceptions thown?(當沒有異常時,C++ 異常會以何種方式減慢代碼速度?)
                  Why catch an exception as reference-to-const?(為什么要捕獲異常作為對 const 的引用?)
                  When and how should I use exception handling?(我應該何時以及如何使用異常處理?)
                  Scope of exception object in C++(C++中異常對象的范圍)
                  Catching exceptions from a constructor#39;s initializer list(從構造函數的初始化列表中捕獲異常)
                  Difference between C++03 throw() specifier C++11 noexcept(C++03 throw() 說明符 C++11 noexcept 之間的區別)

                2. <i id='6ZJPo'><tr id='6ZJPo'><dt id='6ZJPo'><q id='6ZJPo'><span id='6ZJPo'><b id='6ZJPo'><form id='6ZJPo'><ins id='6ZJPo'></ins><ul id='6ZJPo'></ul><sub id='6ZJPo'></sub></form><legend id='6ZJPo'></legend><bdo id='6ZJPo'><pre id='6ZJPo'><center id='6ZJPo'></center></pre></bdo></b><th id='6ZJPo'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='6ZJPo'><tfoot id='6ZJPo'></tfoot><dl id='6ZJPo'><fieldset id='6ZJPo'></fieldset></dl></div>
                    <legend id='6ZJPo'><style id='6ZJPo'><dir id='6ZJPo'><q id='6ZJPo'></q></dir></style></legend>
                      <tbody id='6ZJPo'></tbody>

                      • <tfoot id='6ZJPo'></tfoot>

                            <bdo id='6ZJPo'></bdo><ul id='6ZJPo'></ul>

                            <small id='6ZJPo'></small><noframes id='6ZJPo'>

                            主站蜘蛛池模板: 手机看片在线播放 | 色综合99| 精品一区二区不卡 | 日韩欧美在线不卡 | 亚洲视频精品 | 最新中文字幕在线 | 999久久久 | 亚洲精品国产成人 | 国产精品久久久久久高潮 | 亚洲精品欧美 | www.788.com色淫免费 | 欧美精品一区在线发布 | 五月天婷婷综合 | 中文字幕一区二区三区乱码在线 | 日本一区二区三区在线观看 | 国产精品久久久亚洲 | 91视频在线看 | 国产丝袜人妖cd露出 | 日日夜夜视频 | 国内精品在线视频 | 国产精品一区在线 | 国产欧美日韩 | 亚洲精品视频导航 | 色天天综合 | 国产精品99久久久久久久久久久久 | 蜜桃在线视频 | 国产在线精品一区二区三区 | 亚洲成人播放器 | 色妹子综合网 | 91资源在线观看 | 久久精品久久久 | 99成人 | 美女逼网站 | 亚洲成人精品一区二区 | 羞视频在线观看 | 中文字幕在线三区 | 日本在线免费 | 一级毛片在线看 | 久久精品国产一区二区电影 | 国产精品一二三区在线观看 | 欧美亚洲视频 |