>with W98 i use TerminateProcess to stop a program (word or excel) but on W2k the code doesn't work why ?
You need to get a handle to the process with the necessary permissions to terminate it; when you perform the OpenProcess() call to access the process to terminate, you need the PROCESS_TERMINATE or PROCESS_ALL_ACCESS permission to have been granted to then shut down the process using TerminateProcess(), a privilege not usually granted to normal user applications that did not spawn the other process. See the entry
Process Security and Access Rights in the MSDN and the related articles on altering the security identifier for a process.
In general, it is not recommended to use TerminateProcess() to halt a running application unless the process has stopped responding to normal Windows messages.