Forum: Ruby Re: How do I find a Windows process with a specific Window T

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
0f1c6a5dbf661a560cc759b460137d25?d=identicon&s=25 Alexey Kalmykov (Guest)
on 2007-03-06 11:02
(Received via mailing list)
>Hi there.  I'm still kind of new to scripting with Ruby.  I have
>written a small Ruby/Fox app that displays a message in a window at
>regular intervals.  The 'regular intervals' part is done using the
>Windows Task Scheduler.

>I'd like only one message window to appear at a time though.  What I
>am seeing is that if I step away from my computer for a few hours,
>there can sometimes be several of these popup windows on the desktop.

>I'd like the app to check (when it first starts up) to see if there
>are any other instances of this popup window on the desktop, and if
>so, just exit... or maybe kill the other window's process (I haven't
>decided which yet).

May be it's better to try another way:

1) Check that some file is being open or exists
2) Using Win32 API you can register unique objects that another instance
of your application is running (as far as I can remember they called
"atoms" in MSDN)
3) ... and so on.

Finding a window isn't the only and the best way to check if you are
already running some process (it's platform dependent and there can be
another window with title 'foo').
This topic is locked and can not be replied to.