Sign in to follow this  

program keeps crashing

This topic is 4810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay, I keep getting these errors when I run my MFC program. I get an assertation error in appui1.app line 144. If I tell it to ignore I get a message box with no title or text, just an OK button. I’m trying to use the single document template and the stupid application keeps crashing! From what I can see, there is no problem

Share this post


Link to post
Share on other sites
Care to provide more detailed information?
What kind of errors do you get (i.e. compiler/trace output)?
Which assertion fails (line 144 doesn't tell me that much)?
Did you just compile the SDI application template unmodified and get this error?
Which IDE and -version do you refer to?

Share this post


Link to post
Share on other sites
Okay, I did not use the AppWizzard for the SDI templates. I created it my self. I did this because I think MS writes very crappy code that look horrible. I make mine nice and neat with the names I want and the information & comment I want. If I use the AppWizards, then I spend more time then I would restructure the code then I would just write it from scratch.

I’m using Visual Studio.NET by the way. I though the problem is with my document template string, but it wasn’t because I uses one from another program and my program still crashed.

This is driving me crazy. I refuse to resort to those stupid AppWizzards. I want my code my way, not some one else’s. And there is not reason that, I can see any ways, why my program shouldn’t be working.

I really must get this to work, it is vital so please help me!

Share this post


Link to post
Share on other sites
I deleteed the project (But not the files). I started a new project and now I'm getting a "Failed to create empty document" message. Everything is still setup the same, but the program keeps crashing!

Share this post


Link to post
Share on other sites
Your last post didn't reveal much relevant information apart from using VS.NET and your own custom code only.

This makes the first two questions even more important or else nobody will be able to provide any help.

So I'll just ask again [smile]

What kind of errors do you get (i.e. compiler/trace output)?
What is the assertion that fails (does it fail within the MFC framework library or is it an assertion in your code template)?

Share this post


Link to post
Share on other sites
Okay, the errors do not happen until I runt the program. The program compiles fine. There is not trace output that I saw in the debugger.

I’m not sure, but I think I’m just not initializing something or forgetting something else. Before I started the new project though, I was able to debug the executable at runtime. It broke at a MessageBox function on an ASSERT macro with a string as a parameter. The message box function was just an Afx wrapper of the origanl MessageBox.

But that is where it would break at. This is what the error says:

Microsoft Visual C++ Debug Library

Program: …d Settings\Matthew R. Erdman\My Documents\Ivan\Debug\Ivan.exe
File: appui1.cpp
Line: 144

I’m getting an Unhandled Exception And this is where it breaks at:

int AFXAPI AfxMessageBox(UINT nIDPrompt, UINT nType, UINT nIDHelp)
{
CString string;
if (!string.LoadString(nIDPrompt))
{
TRACE(traceAppMsg, 0, "Error: failed to load message box prompt string 0x%04x.\n",
nIDPrompt);
ASSERT(FALSE); /* Breaks right here */
}
if (nIDHelp == (UINT)-1)
nIDHelp = nIDPrompt;
return AfxMessageBox(string, nType, nIDHelp);
}


I don’t get it

Share this post


Link to post
Share on other sites
The AFX messagebox wants to load the message string from a resource Id which doesn't exist. That's the error. You will have to add a resource file containing all your string resources.

MFC does this to support localisation and to avoid literals in code. Check out what id the function uses and add a string resource with this id to your project. This might help.

Share this post


Link to post
Share on other sites
No darookie, that isn’t the problem because I copied all the string table and resource macros to my project and I still got the error. I think the problem may lie with in the document template string. Although I can’t find any decent fact about it on MSDN.

I even used a template string from another project and it still didn’t work. So I scrapped that whole project and started a new one. This time there is no Doc/View crap. I have a simple frame with a splitter window child.

But now, each time I move the splitter window border is leaves trails. It doesn’t repaint the area like it should. This is the code I use to initialize the splitter


if(!m_splitter.CreateStatic(this,1,2))
{
return FALSE;
}
else
{
m_splitter.CreateView(0,0,RUNTIME_CLASS(CWnd),CSize(10,10),lpCC);
m_splitter.CreateView(0,1,RUNTIME_CLASS(CWnd),CSize(10,10),lpCC);
}


Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Maybe your string table entries are not being loaded correctly?
Trace the AfxMessageBox calls.

Share this post


Link to post
Share on other sites

This topic is 4810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this