Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VS2008 C++ MFC
Hello
 
I am facing a peculiar problem with VS2008 MFC application.
 
I have created an MFC application which initially shows a Dialog box, after clicking OK in dialog box, it shows a Form showing left and right pane with some information.
 
Problem I am facing is when I click OK on a dialog box, Form gets displayed on some machines and on other machines does not get displayed.
 
When I comment Form's Status Bar code in my application, form gets displayed on all machines. Here strange part is, when I replace this application with older one (with Status Bar code), that works fine now. I tried this on 3 machines which were not showing the form earlier. They shows the form now with older application.
 
I am unable to crack what causes this strange behavior.
All machines have same installtions(.NET framework 2.0 and 3.5).
 
Looking forward for your reply.
 

thanks
Nipun
Posted 28-Nov-12 19:03pm
NipunG394
Comments
Richard MacCutchan at 29-Nov-12 6:23am
   
You need to show some of your code here. No one can guess what is happening in your program. You also need to be clear as to whether this is MFC or C++/CLI.
NipunG at 29-Nov-12 7:11am
   
I have posted some code below. PLease have a look and let me know if this helps to understand my problem.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This is an MFC based application.
Here is some code where exactly I am facing the error:
 
BOOL CEmuDiagnosticsClientDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;
 
	m_pMainFrame = (CMainFrame*)AfxGetMainWnd();
	
	//Do Modal Dialog box
	if( m_IPAddressDlg->DoModal() == IDOK)
	{
		//m_pMainFrame->SetStatusBar(STATUSBAR_CONNECTING);

		vector<ipaddressinfo> IPAddrInfoVectorDoc;
		//Get IP Address vector
		m_IPAddressDlg->GetIPAddressData(m_IPAddrInfoVectorDoc);
		//Add IP Address list in left view
		m_pLeftView->CreateIPAddressList();// == false)
		m_IPAddressDlg->SetDlgCretaedFirstTime(false);
		m_IPAddressDlg->DeleteVectorEntries();
		m_IPAddrInfoVectorDoc.clear();
	}
	//m_pMainFrame->SetStatusBar(STATUSBAR_READY);
	return TRUE;
}</ipaddressinfo>
 
As of now, StatusBar code is commented which causes my application to work fine.
  Permalink  
Comments
Richard MacCutchan at 29-Nov-12 7:40am
   
I do not see a definition of the SetStatusBar() function in the CFrameWnd class. Is this something you have written yourself?
NipunG at 29-Nov-12 7:46am
   
Yes, I have written this. It simply calls SetPaneText() function as shown below with various options:
m_wndStatusBar.SetPaneText(0, "Ready");
 
And, Here how I am creating "CMFCStatusBar m_wndStatusBar" object:
if (!m_wndStatusBar.Create(this))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
Richard MacCutchan at 29-Nov-12 8:20am
   
I can see nothing wrong in this code that you are showing. There must be some other issue in your program. The only thing I can suggest is to spend time with your debugger to try and find out what is going on.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 343
1 _Amy 290
2 Manfred R. Bihy 200
3 Maciej Los 185
4 CHill60 180
0 OriginalGriff 7,445
1 Sergey Alexandrovich Kryukov 6,347
2 Maciej Los 3,799
3 Peter Leow 3,558
4 CHill60 2,702


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 29 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100