Article View: comp.os.ms-windows.programmer.misc
Article #2581Enabling the first and only window in MFC
From: Jarkko Turunen
Date: Wed, 06 Jan 1993 16:52
Date: Wed, 06 Jan 1993 16:52
22 lines
1026 bytes
1026 bytes
I want user not to be able to run many instances of my application. So if
he tries to run another instance my program should bring the first
instance to top. I've been trying it with this following code:
BOOL CMyApp::InitInstance()
{
If( m_hPrevInstance != NULL )
{
m_pMainWindow->BringWindowToTop();
return FALSE;
}
else
{
m_pMainWindow = new CMyWindow;
m_pMainWindow->ShowWindow( m_nCmdShow );
m_pMainWindow->UpdateWindow();
return TRUE;
}
}
The first instance runs fine and no other instances are displayed or created
but the first windows is not brought to the top.
Technical Details
Message-ID:
<C0Fyw0.3pq@pcuf.fi>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!fuug!pcuf!newsShow Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!fuug!pcuf!news From: turre@pcuf.fi (Jarkko Turunen) Subject: Enabling the first and only window in MFC Message-ID: <C0Fyw0.3pq@pcuf.fi> Sender: news@pcuf.fi (News) Nntp-Posting-Host: pcuf.fi Organization: The PC-users of Finland Date: Wed, 6 Jan 1993 16:52:47 GMT Lines: 22