Click here to Skip to main content
15,914,452 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to make flicker free dialog interface? Pin
Tommy H D Svensson18-Sep-01 5:42
Tommy H D Svensson18-Sep-01 5:42 
GeneralCString Find Pin
7-Jul-01 12:38
suss7-Jul-01 12:38 
GeneralRe: CString Find Pin
Michael Dunn7-Jul-01 19:46
sitebuilderMichael Dunn7-Jul-01 19:46 
GeneralRe: CString Find Pin
8-Jul-01 5:29
suss8-Jul-01 5:29 
GeneralSingle application instance Pin
Joe Moldovan7-Jul-01 12:35
Joe Moldovan7-Jul-01 12:35 
GeneralRe: Single application instance Pin
Tim Deveaux7-Jul-01 12:55
Tim Deveaux7-Jul-01 12:55 
GeneralRe: Single application instance Pin
l a u r e n7-Jul-01 23:00
l a u r e n7-Jul-01 23:00 
GeneralRe: Single application instance Pin
Stan Shannon8-Jul-01 1:07
Stan Shannon8-Jul-01 1:07 
This is the way I've done it for about 100 years now, works like a charm :

// Global declaration in CWinApp:
LPCTSTR lpszUniqueClass = _T("MyUnigueClassName");

CMyWinApp::OnInitInstance()
{
// Check status of class name...
if( DoIExist())
{
return( FALSE );
}
.
.
.

// Register our unique class name that we wish to use
WNDCLASS wndcls;
.
.
.
// Specify our own class name for using FindWindow later
wndcls.lpszClassName = lpszUniqueClass;
// Register new class and exit if it fails
if(!AfxRegisterClass(&wndcls))
{
TRACE("Class Registration Failed\n");
return FALSE;
}
.
.
.

}

BOOL CMyWinApp::DoIExist()
{
CWnd *pWndPrev, *pWndChild;

if(( pWndPrev = CWnd::FindWindow(lpszUniqueClass, NULL ) ))
{
if( pWndPrev->IsIconic() )
{
// If iconic, restore the main window
pWndPrev->ShowWindow(SW_RESTORE);
}
// if alive, does it have any popups?
if(( pWndChild = pWndPrev->GetLastActivePopup()) != NULL )
{
pWndChild->SetForegroundWindow();
}
return TRUE;
}
return FALSE;
}

GeneralRe: Single application instance Pin
Vu Nguyen7-Dec-01 14:43
Vu Nguyen7-Dec-01 14:43 
GeneralRe: Single application instance Pin
Vu Nguyen10-Dec-01 10:29
Vu Nguyen10-Dec-01 10:29 
GeneralRe: Single application instance Pin
Joe Moldovan8-Jul-01 10:15
Joe Moldovan8-Jul-01 10:15 
GeneralRe: Single application instance Pin
8-Jul-01 13:21
suss8-Jul-01 13:21 
GeneralRe: Single application instance Pin
8-Jul-01 13:25
suss8-Jul-01 13:25 
GeneralRe: Single application instance Pin
9-Jul-01 3:56
suss9-Jul-01 3:56 
GeneralRe: Single application instance Pin
Bret Faller9-Jul-01 11:27
Bret Faller9-Jul-01 11:27 
QuestionHow to create a menu bar in ATL control Pin
Oliver Daniel7-Jul-01 8:59
Oliver Daniel7-Jul-01 8:59 
AnswerRe: How to create a menu bar in ATL control Pin
7-Jul-01 10:10
suss7-Jul-01 10:10 
GeneralRe: How to create a menu bar in ATL control Pin
Oliver Daniel8-Jul-01 3:01
Oliver Daniel8-Jul-01 3:01 
Generalfile opening Pin
7-Jul-01 7:15
suss7-Jul-01 7:15 
GeneralRe: file opening Pin
7-Jul-01 9:33
suss7-Jul-01 9:33 
GeneralRe: file opening Pin
7-Jul-01 21:32
suss7-Jul-01 21:32 
GeneralRe: file opening Pin
Michael Dunn7-Jul-01 19:54
sitebuilderMichael Dunn7-Jul-01 19:54 
GeneralRe: file opening Pin
8-Jul-01 10:35
suss8-Jul-01 10:35 
GeneralDeskTop Icon Pin
Muhammad Nauman Khan7-Jul-01 6:52
Muhammad Nauman Khan7-Jul-01 6:52 
GeneralDeskTop Icon Pin
Muhammad Nauman Khan7-Jul-01 6:52
Muhammad Nauman Khan7-Jul-01 6:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.