🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #2937

Re: How to avoid multiple instances of a program in NT and 95?

#2937
From: Mario Schlesinger
Date: Thu, 06 Feb 1997 00:00
32 lines
1862 bytes
Someday (Mon, 03 Feb 97 10:24:56 GMT) someone
(Alois.Buecherl@terraSat.de (Alois Buecherl)) wrote:

>I've been striving for so long now to find a SAVE way to start only one 
>instance of my C++ program under Windows NT and 95. As you might recall, this 
>used to be that easy in Windows 3.1 using the prevInstance variable. Now this 
>option is gone.

Most of the time, I'm just going the easy way:

hWnd = FindWindow( szNameOfMyMainWindowClass, NULL );
if ( hWnd )  {
	BringWindowToTop( hWnd );
	SetForegroundWindow( hWnd );
	};



see 'ya
	/\/\ario


* FIDO:  2:2480/141.15 *
* EMail: schlesinger@augsburg.baynet.de *
* Homepage: http://www.schlesi-edv.com *

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
   Da ertoente eine Stimme und sagte: "Laechle und sei froh,
   es koennte schlimmer kommen!"
   Und ich laechelte und war froh - und es kam schlimmer.
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Technical Details
Message-ID: <32f9beb2.1422569@news.augsburg.baynet.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <5d4eeb$n6u$1@euler.space.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1124cf,3403ef0501dd273
X-Google-Attributes: gid1124cf,public
X-Google-Thread: 113dfb,3403ef0501dd273
X-Google-Attributes: gid113dfb,public
X-Google-Thread: f6ef4,3403ef0501dd273
X-Google-Attributes: gidf6ef4,public
X-Google-Thread: 105df1,3403ef0501dd273
X-Google-Attributes: gid105df1,public
From: schlesinger@augsburg.baynet.de (Mario Schlesinger)
Subject: Re: How to avoid multiple instances of a program in NT and 95?
Date: 1997/02/06
Message-ID: <32f9beb2.1422569@news.augsburg.baynet.de>
X-Deja-AN: 214829145
distribution: world
references: <5d4eeb$n6u$1@euler.space.net>
organization: [posted via] Leibniz-Rechenzentrum, Muenchen (Germany)
newsgroups: comp.os.ms-windows.programmer.misc,comp.os.ms-windows.programmer.win32,de.comp.os.ms-windows.programmer,fido.ger.windows.prog