小弟写了一个网吧计费程序。
问题:在强制退出进程(例如:反恐精英)后,再起动任何游戏便出现“非法操作”。
我调用了Windows API TerminateProcess().
我估计是显示资源无法释放导致的。
请问各位有什么更好的强制退出进程的方法

解决方案 »

  1.   

    退出进程最好的方法是向其主窗口发WM_CLOSE消息。
      

  2.   

    不行
    我是先发送WM_CLOSE然后等待其结束,等待5秒后再强行结束的.
      

  3.   

    TerminateProcess() is easier, but doesn't unload the dll's from memory, which means it doesn't let the dll's know the process is terminated, and leaves them floating around in memory, lost, causing problems. It should only be used in worst-case situations. system(), WinExec(), ShellExecute(), and ShellExecueEx(), are easier, but you don't get as much information about the process being started. Since CreateProcess() is very powerful, and seems rather intimidating at first
    you can see codeproject example:
    http://www.codeproject.com/cpp/kill_process.asp
      

  4.   

    WM_QUIT试试
    TerminateProcess太暴力了
    可能有些资源没有清除