MFC program asking for "New..." (instance?) upon startup?

Started by
2 comments, last by Endurion 16 years, 8 months ago
OK... I've got an odd problem that is bugging the hell outta me. Recently, my MFC program has started doing something I haven't seen before. When I run from within VC++ 6, it pops up a dialog asking me for "New". That's it. It doesn't say what is supposed to be "new." It lists 2 things for me to select from - one of which is the actual exe and project name ("ATM"). The other seems to be related, but I can't figure out where it is getting the string from ("Gameln"). Regardless, the program only works properly when I select the real name, otherwise it hangs. I've traced execution from the beginning and found that it pops up this dialog at the following location in WINMAIN.CPP - (line 39) if (!pThread->InitInstance()) It seems that whatever "InitInstance" is doing, it needs to ask me for that instance in order for it to continue. Another odd issue, however, is that I can't set a debug breakpoint anywhere in the program other than in WINMAIN.cpp. If I try, it gives me the error of "One or more breakpoints have been disabled." This means that I can't debug anything in the actual execution of my program. What "instance" is it creating, why is it asking me for it and how do I make it go away? [Edited by - InnocuousFox on August 14, 2007 10:08:49 PM]

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Advertisement
Ah, this sounds like the doc template manager jumping in.

Did you recently play with AddDocTemplate? If there's more than one and you choose "New Document" (which MFC apps can do on startup automatically) it doesn't know which document type it's supposed to open. That's where this fugly Dialog comes up.

If you still have only one AddDocTemplate call maybe the string table for the document descriptions is messed up. If i recall right there's a string table entry carrying the default extension, document description and such. There's a page in the MSDN telling which of the parts of that string mean what.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

It may very well have started when I was dorking with a new document. The question is, how do I get it to go away? I HATE MFC but had a contractor build this framework for me as a test bed. Now I'm stuck maintaining it which I can do for the most part, but I get lost at times. At least I know about where to look - but not what I'm looking for necessarily. Any thoughts?

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

As said, try if you can find that other AddDocTemplate call (probably in the InitInstance function of the App). It has to be a second document type being added.
Alternatively look where that template is created, search for "new CMultiDocTemplate(".

If you want to go hardcode you could try to mess up the resource string entry for that second template. It does display a name in the dialog box? Look for it in the resource explorers string table. Rename it's ID constant. If i remember right the document manager will ASSERT if it can't find the string entry. The stack trace at that point should show you where that template is added.

Do you have the MFC source code installed? If so, it'll help tremendously to step into the InitInstance function down where it starts the dialog. There code is commented so you might find the cause better that way. - Nevermind, just read, that there's a problem with debugging.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

This topic is closed to new replies.

Advertisement