Link to home
Start Free TrialLog in
Avatar of sureka
sureka

asked on

Kill Process or Close the Window

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
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Wow, I never killed a process using MAPI *LOL* :o)
Sorry, posted on wrong question.

>I never killed a process using MAPI *LOL* :o)
Just try, maybe works ;-)
Avatar of KurtVon
KurtVon

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

Killed a few brain cells too.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Also have a look to this previous question. You don't need to FindWindow to identify your process:
https://www.experts-exchange.com/questions/20713066/Killing-a-process-programatically.html
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
>>You don't need to FindWindow to identify your process

Have you read the article I linked above?
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...
Maybe links are not valid now, but there are valid once, because I test and READ links before posting.