A good way for that would be using (attempting to create) a named event to
bring itself to foreground. The application would have to use MsgWFMOEx in
its message loop, then.
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
I said it should not be used in a multiple-instance situation. Not just
for detecting the
instance, but at all. Note that the race condition I describe can mean
that the second
instance is detected before the first instance has produced a window.
Therefore, there is
nothing to flash. Therefore, it is unreliable.
joe
On Fri, 13 Apr 2007 11:09:11 -0700, "David Ching"
<dc@remove-this.dcsoft.com> wrote:
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:u2cv13d1kjpfbcqocu34mt6r01q21m9jkv@4ax.com...
FindWIndow as a methodology is not reliable, and it is trivial to induce
a
failure. It
should never be used for a multiple-instance situation. See my essay.
http://www.flounder.com/nomultiples.htm
But he isn't using FindWindow() to detect if another instance is running;
that is what the mutex is used for (your recommended method). He is using
the FindWindow() to potentially have the nice effect of bringing to the
foreground the main window of the previous instance. This is 100%
reliable.
-- David
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm