Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I built a checkbox Modal Dialog with MFC that compiled and linked, but the run got stopped with an ASSERT:
if (hWndCtrl == NULL)
{
  pSite = m_pDlgWnd->GetOleControlSite(nIDC);
  if (pSite == NULL
  {
    TRACE(traceAppMsg, ...);
    ASSERT(FALSE);
    AfxThrowNotSupportedException();
  }
  ...
}

I don't understand how to fix it. In previous versions of Visual Studio I have never had this problem.

What I have tried:

I have stepped through the code. No help.
Posted
Updated 26-May-17 7:23am
v2
Comments
Richard MacCutchan 26-May-17 11:45am    
Check the trace message which should tell you what is wrong.
jeron1 26-May-17 12:33pm    
In addition to what Richard said, maybe a little more context would be helpful, what is your code doing when this occurs? Looking at the call stack may give some clues.
Member 13180427 26-May-17 15:36pm    
TRACE(traceAppMsg, 0, "Error: no data exchange control with ID 0x%04X.\n", nIDC);

The ASSERT occurs at line: if(in1DLG.DoModal() == IDOK)
void CDriver::Drive()
{
Cin1DLG in1DLG;
if(in1DLG.DoModal() == IDOK)
{
};
}

Thank you for comments
jeron1 26-May-17 16:56pm    
If you set a breakpoint on that line and step into the function you may see exactly where it breaks. A DDX_Control (resource ID) issue maybe, OnInitDialog() issue (not calling the base class method)?

1 solution

The fact is: Something in the creation of the checkbox went wrong.

Often is some mismatch in the resource identifiers the cause. Normally some value greater than 1000 in the resource.h and NOT IDC_STATIC.

Check the ID in the rc file, that is has a valid number and the id of the associated member variable.
 
Share this answer
 
Comments
Member 13180427 26-May-17 15:21pm    
My IDC_STATIC1 thru IDC_STATIC6 are numbered 1000 thru 1005 in the resource file, and all others are 310 or less. So it must be something else. I did notice the following error: Error: no data exchange control with ID 0x03EA (hex?).
Thank you for your comment KarstenK.
Member 13180427 26-May-17 16:10pm    
1. Has anyone had success using MFC dialog check boxes for Visual Studio 2010?
2. Please comment on use of .NET programming for Visual Studio 2010. Do all advertised capabilities work?

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