home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.misc
- Path: 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
-
- 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.
-