Closing an alertbox

  • Thread starter Thread starter Lance
  • Start date Start date
L

Lance

Hi,
Can anyone point me in the right direction for using C# to close an alertbox
for the admin user?

Background:
We have some servers (NT4) that are running some services that throw an
alertbox error every now and then. Now, once the alertbox 'OK' is clicked,
the services restart and continue on as normal. But UNTIL the alertbox is
clicked, the service pauses, waiting. For days on end, if someone doesn't
cotton on that one of the servers is down!
This alertbox only appears under the admin user, on the default terminal,
when we VNC or PCAnywhere to the server with the alertbox. The alertbox is
not visible when using Terminal Services - as it opens a new session or
something.
We have tried writing some VBScript to close the window, but it (sort of)
works when we leave the admin user logged into the server.

So it's a strange sort of a question:
1 - how can I create a c# service that monitors the default terminal for a
certain alertbox, and closes it automatically?

Thanks,
Lance
 
An interesting problem!

I can't help you figure out a way to solve this in C#. But, I wonder if a
simple product like Macro Express might work for you.
http://www.macroexpress.com.

I've used this before as a "listener" that looks for certain windows to
popup or even to check that a web server is still serving pages. With Macro
Express you could run a macro on a schedule (NT Scheduler). The macro could
look for a dialog with a particular title and click the ok button, or switch
to the dialog and press enter. That should be enough to close the dialog,
and you could schedule the macro to run every minute if you needed to.

Not the most elegant solution. But, it might get you by until something
better comes along.
 
Hi,
Can anyone point me in the right direction for using C# to close an alertbox
for the admin user?

Background:
We have some servers (NT4) that are running some services that throw an
alertbox error every now and then. Now, once the alertbox 'OK' is clicked,
the services restart and continue on as normal. But UNTIL the alertbox is
clicked, the service pauses, waiting. For days on end, if someone doesn't
cotton on that one of the servers is down!
This alertbox only appears under the admin user, on the default terminal,
when we VNC or PCAnywhere to the server with the alertbox. The alertbox is
not visible when using Terminal Services - as it opens a new session or
something.
We have tried writing some VBScript to close the window, but it (sort of)
works when we leave the admin user logged into the server.

So it's a strange sort of a question:
1 - how can I create a c# service that monitors the default terminal for a
certain alertbox, and closes it automatically?

Thanks,
Lance

Maybe you can use http://www.codeproject.com/csharp/popupkiller.asp to
find windows every x minutes, check the caption of them and if it's
the popup you're looking for, closing it...
 
Hi,
Can anyone point me in the right direction for using C# to close an alertbox
for the admin user?

If you are going to make your own OK-jockey app you will need the Win32
FindWindow function. If the caption is enough to identify the message box,
use just that. You should be pretty confident though since you don't want to
close anything else. If the caption is too generic to be a safe identifier,
use Spy to try and find the window's ClassName too. Look for the window
every 10 seconds or so. If you get back a handle, use that in a PostMessage
with a WM_CLOSE. That should do it.

A Win32 group would be more appropriate to ask this and you will likely get
more useful answers. Since this is very much a Windows issue there is no
point using C# for this, you would be better off using a tool closer to the
Windows API.

Martin.
 
Thanks for the replys guys. I'll try the prebuilt solutions first, and work
to the more complex ones if the simple ones don't work.

Lance
 
Thanks, but I tried to use macroexpress today for the job, and it has a
*slight* limitation: any dialog box currently open pauses all macros, until
the dialog box is dealt with. So using a macroscript to close this box
won't work. Too bad, so sad. :-(

But this macroexpress tool is a really cool piece of kit. I've been using
it for other things all day. It's great for crappy, repetitive tasks, and
fun to hack around with! :-)

Thanks!
 
Back
Top