🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #6595

Re: Avoiding multiple programinstances and restore the firstone

#6595
From: JD
Date: Tue, 26 Apr 2005 06:38
23 lines
1736 bytes
Hans Galema <notused@notused.nl> wrote:
>
> [...]
>              ::SendMessage( hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
>              ::SetForegroundWindow( hwnd );

This code is problematic if the window is not minimized
because it will disable the Minimize border icon. Ultimately,
the problem is with Windows incorrectly recording the window
state (unless you apply WS_EX_APPWINDOW to the window's
ExStyle but then you get 2 icons on the task bar) so testing
if it's minimized is useless.

The only solution is to manually track the window state and
have the second instance send the first instance a custom
message so that the first instance can decide what to do.

This component does exactly that:

    http://newsgroups.borland.com/cgi-bin/dnewsweb?cmd=article&group=borland.public.cppbuilder.vcl.components.writing&item=19759&utag=

~ JD
Technical Details
Message-ID: <426de1fe$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <4268dde6$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,fd5c6cb9a40ec609
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "JD" <nospam@nospam.com>
Sender: "JD" <nospam@nospam.com>
Reply-To: "JD" <nospam@nospam.com>
Subject: Re: Avoiding multiple programinstances and restore the firstone
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 172.165.74.147     
References:  <4268dde6$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <426de1fe$1@newsgroups.borland.com>
Date: 25 Apr 2005 23:38:54 -0700
X-Trace: newsgroups.borland.com 1114497534 207.105.83.66 (25 Apr 2005 23:38:54 -0700)
Lines: 24
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail