Re: Previous Instance



On Sun, 15 May 2005 20:20:24 +0100, "Lindsay" <me@xxxxxxxx> wrote:

>
>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.

Sounds like the foreground lock at work. I would not recommend
changing it since messing about with user settings is almost always a
bad idea. IMO a better way is demonstrated in the "ForceFore" example
on Karl Peterson's site: http://vb.mvps.org/
While you're there, also check out the "PrevInst" example. It
demonstrates a technique for communicating between instances.


-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
.



Relevant Pages

  • RE: APPCRASH - Microsoft Office Word has stopped working
    ... Disabling HP related files from the Startup: ... 1.Click Start Icon. ... On the User Account Control window, ... When I use Mailmerge - Envelopes, after printing the envelope and close Word ...
    (microsoft.public.word.mailmerge.fields)
  • RE: word 2007 app crash
    ... I just did the "quick fix" by changing my default printer to Microsoft ... If you does not have any other printer icon in Printers and Faxes folder, ... On the User Account Control window, ... Click Restart to apply the changes. ...
    (microsoft.public.word.application.errors)
  • RE: Word Crash - File hpz3r4v2.dll
    ... I understand from your mail that 'an application failure' error message ... Disabling HP related files from the Startup: ... 1.Click Start Icon. ... On the User Account Control window, ...
    (microsoft.public.word.application.errors)
  • Re: Word doesnt close properly
    ... Disabling HP related files from the Startup: ... 1.Click Start Icon. ... HP Photosmart series drivers ... On the User Account Control window, ...
    (microsoft.public.word.application.errors)
  • RE: word 2007 app crash
    ... 1.Click Start Icon. ... On the User Account Control window, ... Click Restart to apply the changes. ... 12 crash is listed for the word must close event. ...
    (microsoft.public.word.application.errors)