The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [OT] - killing a windows process?


  • To: <ukha_d@xxxxxxx>
  • Subject: RE: [OT] - killing a windows process?
  • From: "Steve Morgan" <steve@xxxxxxx>
  • Date: Thu, 6 Mar 2003 18:30:52 -0000
  • Mailing-list: list ukha_d@xxxxxxx; contact ukha_d-owner@xxxxxxx
  • Reply-to: ukha_d@xxxxxxx

I recently wrote a .NET wrapper for Wserver that I used monitor it and
kill it if necessary. It was particularly easy because I launched it
>from
.NET Framework makes it all rather trivial.

Previously, I've done it using the Win32 API, but I've given it up as a
mugs game ;-)

In what circumstances do you want to kill HomeSeer?

If you just want to close the app, you can use FindWindow, and post a
WM_CLOSE message. However, if you want to kill it (perhaps because it's
hung), you need to FindWindow (or iterate through the windows),
GetWindowThreadProcessId to get the process ID and terminate the process
with TerminateProcess. It's always best to try the WM_CLOSE method
first, then kill the process if it doesn't respond.

Cheers,
Steve



> -----Original Message-----
> From: Paul Gordon [mailto:paul_gordon@xxxxxxx]
> Sent: 06 March 2003 16:39
> To: ukha_d@xxxxxxx
> Subject: [ukha_d] [OT] - killing a windows process?
>
>
> Question for the win32 programmers among us...
>
> (Oh, and the process I want to kill is homeseer.exe, so it's
> not *totally*
> OT...)
>
> Anyone know how to programatically kill a running process
> under Windows (XP
> in this case...). I need to be able to be certain that the
> process has been
> terminated completely, just as surely as if I use the task
> manager GUI and
> use the "End Process" button...
>
> My initial thoughts have been...
>
> a) Use the Resource Kit "Kill" utility, - but this is a bit
> of a bodge as
> I'd have to shell out to run it...
>
> b) Use the Win32 API directly, this would be my preferred
> method, but I
> don't know what call I need, or how to call it from VB. (or
> even if that is
> possible?)  I'm guessing I need the WM_CLOSE API call? Bear
> in mind that I
> don't know the process ID, so I also need to enumerate that
> at run-time...
>
> Any ideas/suggestions?  - code snippets... :-)



Home | Main Index | Thread Index

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.