Click here to Skip to main content
15,897,226 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Comments
Richard MacCutchan 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 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

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.
 
Share this answer
 
Comments
Richard MacCutchan 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 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 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900