Only if you use it to execute a program that knows how to close programs.
Perhaps you want to read the following article.
What can I do with the HINSTANCE returned by the ShellExecute function?
http://blogs.msdn.com/oldnewthing/archive/2006/05/05/590749.aspx
--
Rob
"Rob Kennedy" <m...@privacy.net> wrote in message
news:446beb6e$1...@newsgroups.borland.com...
Well, TerminateProcess does a pretty thorough job. Search the newsgroup
archives for discussions about that function and various alternatives.
You're not the first person to ask how to close a program, so you should
be able to find lots of other messages on the topic.
--
Rob
"Rob Kennedy" <m...@privacy.net> wrote in message
news:446bf646$1...@newsgroups.borland.com...
See also:
How can I search the newsgroup archives?
http://www.cs.wisc.edu/~rkennedy/mozilla-search
--
Rob
procedure TForm1.Button1Click(Sender: TObject);
var
aHWnd : HWND;
begin
aHWnd := FindWindow('Notepad', nil);
if (aHWnd <> 0) then
PostMessage(aHWnd, WM_QUIT, 0, 0);
// or ...
//PostMessage(aHWnd, WM_CLOSE, 0, 0);
end;
Andrew
"Alan" <alanplt...@yahoo.com.au> wrote in message
news:446be589$1...@newsgroups.borland.com...
Sure you can
Create temporary .bat file using TStringList (create, add(..), savetofile(your bat file) with following content
TASKKILL /IM notepad.exe
del "short path to this .bat file here"
close
Then run this using shellexecute(GetDesktopWindow,.........SW_HIDE);
Enjoy!
Arab Ibrahim