Terminate JVM created from C++ with CreateProcess
843802Feb 13 2006 — edited Feb 15 2006Hi!
How can I terminate (from C++) an application running in JVM that I've created with CreateProcess()?
That's the code:
STARTUPINFO startup;
PROCESS_INFORMATION procinfo;
::ZeroMemory(&startup, sizeof(startup));
startup.cb = sizeof(startup);
startup.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
startup.wShowWindow = SW_HIDE; // hidden console window
startup.hStdInput = NULL; // not used
startup.hStdOutput = NULL;
startup.hStdError = NULL;
BOOL started = ::CreateProcess(NULL, cmd, NULL, NULL, TRUE, 0, NULL, NULL, &startup, &procinfo);
'cmd' contains, for example, "javaws c:\AMnotepad.jnlp".
If I use TerminateProcess (procinfo.hProcess, 9), this will do nothing, because the HANDLE (and the process ID) it's not the same.
Can somebody tell me why this happens and how can I terminate the process I've created?
Thanks.