Solved

Kill Process or Close the Window

Posted on 2004-09-01
15
374 Views
Last Modified: 2013-11-20
hi,

Greetings!

I want to Kill process so, anybody give me idea.

Better ,Give me idea on  FindWindowEx()--Its returns handler then i can sendMessage() with WM_CLOSE to that handler.

I was tried with FindWindowEx,but i unable get  window handler based on Window Title.
Is there any other way to get the window handler based on WIndow Title or Window exe.

Give me idea,

Thanks,
Sureka
0
Comment
Question by:sureka
15 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 63 total points
ID: 11952084
Check out http://support.microsoft.com/default.aspx?scid=KB;en-us;178893& ("How To Terminate an Application "Cleanly" in Win32")
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11952483
Here you have a tutorial:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppc2k2/html/ppc_2002part1.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppc2k2/html/ppc_2002part2.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppc2k2/html/ppc_2002part3.asp

Also go to you eVC help and write on the search tab:
sample sending mail cemapi mapidefs

You will see an article with a full working code of a sending mail application using mapi.
0
 
LVL 86

Expert Comment

by:jkr
ID: 11952527
Wow, I never killed a process using MAPI *LOL* :o)
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11952638
Sorry, posted on wrong question.

>I never killed a process using MAPI *LOL* :o)
Just try, maybe works ;-)
0
 
LVL 11

Expert Comment

by:KurtVon
ID: 11952713
I dunno, MAPI has killed a few of my processes in the past. :-)

Killed a few brain cells too.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 62 total points
ID: 11959860
OK, forget the MAPI method and read this article. Many ways to kill aprocess:

http://secure.codeproject.com/threads/killprocess.asp

0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11959885
Also have a look to this previous question. You don't need to FindWindow to identify your process:
http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_20713066.html
0
 
LVL 16

Expert Comment

by:kiranvj
ID: 11960317
hi..

try this

HWND hwnd;
hwnd = ::FindWindow(NULL,"title of the program");
if(hwnd)
{
  AfxMessageBox("Window detected.Press OK to close");
  ::SendMessage(hwnd,WM_CLOSE,0,0);
}

note : the title of the window is not case sensitive, but the given string should be exactly same as the window title. Here i used FindWindow.
FindWindowEx is used to find the child windows(edit box, combobox etc) of a program.

hope this helps
kiranvj
0
 
LVL 86

Expert Comment

by:jkr
ID: 11964228
>>You don't need to FindWindow to identify your process

Have you read the article I linked above?
0
 
LVL 86

Expert Comment

by:jkr
ID: 12218195
Um, since the article I posted is quite complete and jaime_olicares' comment deals with MAPI(!) and the links are 404, I cannot see a reason for a split...
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12218258
Maybe links are not valid now, but there are valid once, because I test and READ links before posting.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now