Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Terminate Process returns The handle is invalid

401 views
Skip to first unread message

Bob

unread,
Jul 1, 2008, 9:46:54 PM7/1/08
to
We are trying to kill a process.
We have tried the Post Quit message method.
This failed.

The OS in Win 2003 Server Service Pack 1.

calling "TerminateProcess(ProcessID, 15000)"

returns in Get LAst error:

The handle is invalid!.

We know the ProcessID is correct.

We are quite lost.

What can we do

Kind Regards,

Robert.


Mike Warren

unread,
Jul 1, 2008, 10:01:04 PM7/1/08
to
Bob wrote:

> The handle is invalid!.
>
> We know the ProcessID is correct.

Sometimes people confuse process ID with window handles.

How are you getting ProcessID?


--
- Mike

Rob Kennedy

unread,
Jul 2, 2008, 12:07:23 AM7/2/08
to
Bob wrote:
> We are trying to kill a process.
> We have tried the Post Quit message method.
> This failed.
>
> The OS in Win 2003 Server Service Pack 1.
>
> calling "TerminateProcess(ProcessID, 15000)"
>
> returns in Get LAst error:
>
> The handle is invalid!.
>
> We know the ProcessID is correct.

But read the message again. Maybe the ID is correct, but what about the
*handle*?

--
Rob

Bob

unread,
Jul 2, 2008, 2:14:15 AM7/2/08
to
That would be me.
I confused it.

Thanks,

Robert.

"Mike Warren" <miwa-not...@or-this-csas.net.au> wrote in message
news:xn0fs78r...@newsgroups.borland.com...

Remy Lebeau (TeamB)

unread,
Jul 2, 2008, 2:00:54 PM7/2/08
to

"Bob" <B...@Bob.com> wrote in message
news:486ade0d$1...@newsgroups.borland.com...

> calling "TerminateProcess(ProcessID, 15000)"
>
> returns in Get LAst error:
>
> The handle is invalid!.

As it should. Please read the documentation. TerminateProcess() requires a
handle to the process, not the process ID. You have to use OpenProcess() to
retreive the handle for a given ID (unless you spawned the process yourself
in code, in which case use the handle that CreateProcess() returns).


Gambit


0 new messages