🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Run Once

#10011
From: Hans Galema
Date: Sun, 30 May 2004 14:18
38 lines
2090 bytes
JD wrote:

> I implemented code in the WinMain to prevent multiple instances
> of the application from running. 

Not only that, you also want to bring the first instance to
foreground and if minimized make it restore to its former state.

> I have a problem and a couple
> questions as noted in the code:

I can confirm your problem of a disfunctional minimize icon
for bcb3 and win98se.

>                     if( ::IsIconic(hWnd) )
>                       {
>                           // This block never executes no matter what the state
>                           ShowWindow( hWnd, SC_RESTORE );

Why not chance a C in a W ( not that it matters):

                            ShowWindow( hWnd, SW_RESTORE );

>                       }
>                     else
>                       {
>                           SetForegroundWindow( hWnd );
>                       }

Also the next adaptions were not succesfull.

                      else
                        {
			   ShowWindow( hWnd, SW_RESTORE );
                            SetForegroundWindow( hWnd );
                        }

Hans.
Technical Details
Message-ID: <40b9ecfc@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40b9cff4$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,55fa8aeaf57fcad1
X-Google-Attributes: gid10cc67,public
Date: Sun, 30 May 2004 16:18:06 +0200
From: Hans Galema <dontusethis@dontusethis.nl>
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.6b) Gecko/20031208
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Run Once
References: <40b9cff4$1@newsgroups.borland.com>
In-Reply-To: <40b9cff4$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 129.125.201.248
Message-ID: <40b9ecfc@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1085926652 129.125.201.248 (30 May 2004 07:17:32 -0700)
Lines: 38
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail