Click to See Complete Forum and Search --> : Need to Programatically Kill Applications
I have a Windows NT Workstation which runs unattended. Upon reboot, the machine
will start up 4 console applications. A Marimba tuner is installed on the
machine which will automatically look for software updates once a day during
off hours. If there is an update, the machine needs to terminate the 4 running
applications before updating the software. Marimba allows for a pre-update
script/application to be executed and this is what I need to write.
On UNIX this is easy.
But I'm not sure if this is even possible under NT. I've been playing around
with a C++ program which calls DestroyWindow, and also have used the CWnd
class and its various methods, but without any luck. My best guess is that
security prevents one application from killing another. Is this true? If
not, how would I go about killing these applications using a C/C++ application
or script.
thanks,
mike
Randy Charles Morin
07-23-2001, 05:05 PM
Have you look at TerminateProcess?
--
Randy Charles Morin
Author of Programming Windows Services
http://www.kbcafe.com
Feel free to contact me by private email or messenger
MSN Messenger - morin_randy@hotmail.com
Yahoo Messenger - randymorin@yahoo.com
Ask Randy Newsgroup - http://communities.msn.com/KBCafecom/askrandy.msnw
"mike" <lellom@nasd.com> wrote in message news:3b5c2c90$1@news.devx.com...
>
> I have a Windows NT Workstation which runs unattended. Upon reboot, the
machine
> will start up 4 console applications. A Marimba tuner is installed on the
> machine which will automatically look for software updates once a day
during
> off hours. If there is an update, the machine needs to terminate the 4
running
> applications before updating the software. Marimba allows for a pre-update
> script/application to be executed and this is what I need to write.
>
> On UNIX this is easy.
>
> But I'm not sure if this is even possible under NT. I've been playing
around
> with a C++ program which calls DestroyWindow, and also have used the CWnd
> class and its various methods, but without any luck. My best guess is that
> security prevents one application from killing another. Is this true? If
> not, how would I go about killing these applications using a C/C++
application
> or script.
>
> thanks,
>
> mike
>
Hey Mike,
Check into the FindWindow API call. It may be what your looking for. Once
you have the handle to the window, just send a WM_CLOSE message to it.
Here's a short example of how to use it.
CString csWindowTitle = "Window Title";
HWND result = ::FindWindow(NULL, csWindowTitle);
if (result != NULL)
::SendMessage(result, WM_COMMAND, WM_CLOSE, 0);
-Joe
"mike" <lellom@nasd.com> wrote:
>
>I have a Windows NT Workstation which runs unattended. Upon reboot, the
machine
>will start up 4 console applications. A Marimba tuner is installed on the
>machine which will automatically look for software updates once a day during
>off hours. If there is an update, the machine needs to terminate the 4 running
>applications before updating the software. Marimba allows for a pre-update
>script/application to be executed and this is what I need to write.
>
>On UNIX this is easy.
>
>But I'm not sure if this is even possible under NT. I've been playing around
>with a C++ program which calls DestroyWindow, and also have used the CWnd
>class and its various methods, but without any luck. My best guess is that
>security prevents one application from killing another. Is this true? If
>not, how would I go about killing these applications using a C/C++ application
>or script.
>
>thanks,
>
>mike
>
devx.com
Copyright Internet.com Inc. All Rights Reserved