By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,448 Members | 1,224 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,448 IT Pros & Developers. It's quick & easy.

Closing an alertbox

P: n/a
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
Nov 15 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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.
"Lance @hotmail.com>" <lancestuff27<nospam> wrote in message
news:10*************@corp.supernews.com...
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

Nov 15 '05 #2

P: n/a
L#
On Wed, 4 Feb 2004 09:49:38 -0000, "Lance"
<lancestuff27<nospam>@hotmail.com> wrote:
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...
--
Ludwig
mailto:ludwig_(nospamplease)stuyck@pandora(nospamp lease).be
Nov 15 '05 #3

P: n/a
"Lance @hotmail.com>" <lancestuff27<nospam> wrote in message
news:10*************@corp.supernews.com...
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.
Nov 15 '05 #4

P: n/a
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

"Lance @hotmail.com>" <lancestuff27<nospam> wrote in message
news:10*************@corp.supernews.com...
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

Nov 15 '05 #5

P: n/a
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!
"Ron Rohrssen" <rl******@fightspam.rockwellcollins.com> wrote in message
news:uD**************@TK2MSFTNGP09.phx.gbl...
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.
"Lance @hotmail.com>" <lancestuff27<nospam> wrote in message
news:10*************@corp.supernews.com...
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


Nov 15 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.