Click here to Skip to main content
12,818,664 members (30,170 online)
Rate this:
Please Sign up or sign in to vote.

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.

Posted 28-Nov-12 20:03pm
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

Rate this: bad
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)

		vector<ipaddressinfo> IPAddrInfoVectorDoc;
		//Get IP Address vector
		//Add IP Address list in left view
		m_pLeftView->CreateIPAddressList();// == false)
	return TRUE;

As of now, StatusBar code is commented which causes my application to work fine.
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)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170308.1 | Last Updated 29 Nov 2012
Copyright © CodeProject, 1999-2017
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