Article View: borland.public.cppbuilder.nativeapi
Article #12619Re: How to terminate an application, if you just know the window (HWND)?
From: Yahia El-Qasem
Date: Sun, 23 Nov 2003 10:50
Date: Sun, 23 Nov 2003 10:50
35 lines
1653 bytes
1653 bytes
get the ProcessID via GetWindowThreadProcessId and then us something like :
HANDLE h = NULL;
try {
h = OpenProcess ( PROCESS_TERMINATE, FALSE, PID );
if ( h )
{
TerminateProcess ( h, 1 );
CloseHandle ( h );
h = NULL;
}
PID = (-1);
}
__finally
{
try {
if ( h )
CloseHandle ( h );
}
catch (...)
{
};
if ( PID < 0 )
Result = true;
return ( Result );
};
HTH
Yahia
Technical Details
Message-ID:
<3fc09113@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4j21svs6vheoao1pci01rc5dfgu5foag8t@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,b0b54b319450e271 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-11-23 03:08:56 PST Reply-To: "Yahia El-Qasem" <Yahia.El-Qasemno.spam@mgh.metro-ag.de> From: "Yahia El-Qasem" <Yahia.El-Qasem@mgh.metro-ag.de> Newsgroups: borland.public.cppbuilder.nativeapi References: <4j21svs6vheoao1pci01rc5dfgu5foag8t@4ax.com> Subject: Re: How to terminate an application, if you just know the window (HWND)? Date: Sun, 23 Nov 2003 11:50:42 +0100 Lines: 37 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 217.83.96.133 Message-ID: <3fc09113@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1069584659 217.83.96.133 (23 Nov 2003 02:50:59 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail