Article View: comp.os.ms-windows.programmer.misc
Article #2926Re: How to avoid multiple instances of a program in NT and 95?
From: Raymond Chen
Date: Tue, 04 Feb 1997 00:00
Date: Tue, 04 Feb 1997 00:00
16 lines
1411 bytes
1411 bytes
>BOOL CYourApp::CheckFirst()
>{
> CWnd* wndPrev;
> CWnd* wndChild;
> if (wndPrev=CWnd::FindWindow(m_pszAppName,NULL))
> {
This still won't work if a second instance is started before the
first gets a chance to create its window.
Create a named event and check if you get ERROR_ALREADY_EXISTS
from GetLastError.
--
(My return address is intentionally invalid; delete ".---" to get my real address.
My responses are not to be considered official technical support or advice.)
Technical Details
Message-ID:
<32f7e6e5.422962@157.55.96.156>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<5d4eeb$n6u$1@euler.space.net> <aFwHpCAU3e9yEwa8@ormesci.demon.co.uk>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: raymondc@microsoft.com.--- (Raymond Chen) Subject: Re: How to avoid multiple instances of a program in NT and 95? Date: 1997/02/04 Message-ID: <32f7e6e5.422962@157.55.96.156> X-Deja-AN: 214321464 references: <5d4eeb$n6u$1@euler.space.net> <aFwHpCAU3e9yEwa8@ormesci.demon.co.uk> content-type: text/plain; charset=us-ascii organization: Microsoft Corporation mime-version: 1.0 newsgroups: comp.os.ms-windows.programmer.misc,comp.os.ms-windows.programmer.win32,de.comp.os.ms-windows.programmer,fido.ger.windows.prog