1

I have an MFC application that, if built and ran, immediately closes after opening. If I debug the application, then I get an ASSERT triggered from C:...\MFC\SRC\viewform.cpp.

ERROR: Dialog with IDD 0x008A must have the child style.

If I continue debugging the program I receive the pop-up error Failed to create empty document, and the output terminal lists the following:

Warning: couldn't create client pane for splitter.
Failed to create client pane/view for frame.
Warning: Window creation failed: GetLastError returns 0x00000000
Warning: failed to create CFrameWnd.
Warning: CDocTemplate couldn't create a frame.
The thread 0xFD8 has exited with code 0 (0x0).

This is a code project I have just inherited and thus am not familiar with the code. I can say that the main dialog for the application is supposed to be a split dialog showing four windows.

However I am stumped on what these errors mean. Can anyone help? Thanks in advance.

Callstack showing wrong class being called:

CFormView::Create(const char * 0x00000000, const char * 0x00000000, unsigned long 1342177280, const tagRECT & {top=0 bottom=10 left=0 right=10}, CWnd * 0x003d5198 {CSplitterWnd hWnd=0x0006058e}, unsigned int 59648, CCreateContext * 0x0012fa7c) line 69 + 25 bytes
CSplitterWnd::CreateView(int 0, int 0, CRuntimeClass * 0x0049d020 struct CRuntimeClass const CAgentsView::classCAgentsView, tagSIZE {...}, CCreateContext * 0x0012fa7c) line 311 + 48 bytes
Raiden616
  • 1,545
  • 3
  • 18
  • 42

1 Answers1

1
ERROR: Dialog with IDD 0x008A must have the child style.

Look in resource.h to find which dialog template ID is 0x008A. In the resource view open that dialog template for editing. Right click on the dialog and select Properties. Set the style to Child.

ScottMcP-MVP
  • 10,337
  • 2
  • 15
  • 15
  • Thanks so much for the answer. Thing is I don't want it as a child - I want it as a popup. If i set it to child, then it appears as one of the frames in the split windows. But I have four other dialogs for that purpose... – Raiden616 Aug 13 '14 at 12:47
  • If it appears as a frame in the splitter then code is telling it to do that. Remove that code. (Probably a CreateView call.) – ScottMcP-MVP Aug 13 '14 at 12:52
  • There are four CreateView calls in the code, none of them refer to that dialog. They call the four dialogs that we want to use for the splitter. Is there anything else that could be telling the dialog that it has to be in the top-left split frame? – Raiden616 Aug 13 '14 at 12:54
  • The only place in the code outside of this dialog's class that the class name is being referred to is where it is being called as a popup when the button that cals it is clicked. – Raiden616 Aug 13 '14 at 12:59
  • Another place to check is InitInstance, which creates a view. You can change RUNTIME_CLASS(CSomeView) to RUNTIME_CLASS(NULL) to disable that one. – ScottMcP-MVP Aug 13 '14 at 13:01
  • Or you might have two dialogs with the same ID value. Review resource.h and eliminate duplicate values. – ScottMcP-MVP Aug 13 '14 at 13:02
  • Can't find any RUNTIME_CLASS that refers to this dialog either, or duplicate values... HOWEVER this might help - if I check the call stack then it seems to be referring to the wrong class. The Dialog I want is IDD_ANSABANDON, which should be linked to class CAnsAbandon. However, the callstack seems to be referring to CAgentView... – Raiden616 Aug 13 '14 at 13:05
  • IDD_AGENTSVIEW is the dialog which should be appearing in the splitter window. IDD_ANSABANDON is a completely different dialog which should be a popup. I wonder if IDD_ANSABANDON has become accidentally associated with class CAgentsView somehow? – Raiden616 Aug 13 '14 at 13:06
  • The association between class and dialog template is done in the dialog/view h file, like enum{ IDD = IDD_SOMEID }; – ScottMcP-MVP Aug 13 '14 at 13:11
  • Amazing, I found that and the enum{IDD = x } in CAgentsView was set to IDD_ANSABANDON... Heavens knows how that happened. Thank you so much!! – Raiden616 Aug 13 '14 at 13:13