Previous Instance
- From: "Lindsay" <me@xxxxxxxx>
- Date: Sun, 15 May 2005 20:20:24 +0100
I need some help on how to detect a previous instance.
My need is this:
Clicking an icon (shortcut or exe), starts the app. If you click the icon
again, the first instance recieves focus and the second instance closes.
I found some code in the API-Guide using DdeConnect which works well but has
a bug. When you click the icon a second time, although the first instance
becomes visible, I cannot get it to be the foreground window. It will be
active but have no keyboard focus. All APIs have failed trying to give it
focus. It seems the window with the icon keeps the focus. If the first
instance is minimized (i.e. at the bottom of the z-order) and you have other
windows visible, when the app becomes visible, it remains at the bottom of
the z-order. I could use SetWindowPos to get it to the top, but it still
doesn't have keyboard focus.
Any ideas?
.
- Follow-Ups:
- Re: Previous Instance
- From: Michael C
- Re: Previous Instance
- From: Tom Esh
- Re: Previous Instance
- From: Fatih Argun
- Re: Previous Instance
- Prev by Date: Re: extraneous chars at end of string
- Next by Date: Re: Previous Instance
- Previous by thread: extraneous chars at end of string
- Next by thread: Re: Previous Instance
- Index(es):
Relevant Pages
|