Solved

Assertion in WinNt 4.0 but not in Win95 (CPropertyPage)

Posted on 1997-08-18
3
255 Views
Last Modified: 2013-11-20
I have developed an application in VC ++ 4.0 in Win 95. My application uses CPropertySheet and CPropertPage to implement a Wizard. When I build the proyect for first time an Assertion rises, but this only occurs the first time and it is not a problem. Up to this point everything is normal.
(It is documented in VC++ that the operative system
handles the assertion and it must be ignored. The assertion cause is that the propertypage resource is read only, and the program is trying to write on it.)

The problem comes when I tried to rebuild and execute the same code  in Win NT 4.0. Then, at the same point arises a Debug Assertion Failed (in dlgdata.cpp Line 575),
but this assertion occurs always and I can not get rid of it.

The assertion fails when I press the next buttom in the first page of the Wizard.
      
      Could you help me!!! A solution could be to change a read only resource to read and write, but I don't know how. (?????????????)

Thanks !!!!
0
Comment
Question by:MariaLamelas
3 Comments
 

Expert Comment

by:syjwg
ID: 1304069
Could you point out exactly in what method the assertion occurs!
I have Visual C++ 5.0 and I'm not sure the asserted linenumber are the same in 4.0.
0
 
LVL 4

Accepted Solution

by:
mbhakta earned 150 total points
ID: 1304070
Your problem is with a control inside your property page. You seem to have used classwizard to assign a variable for one of the controls. And for some reason you have deleted the control from the page but forgotten to remove the associated variables. Apparently, DDX_Control() function is throwing a validation assertion for this control.

Please check throughly , which control was removed and also remove the links to that control if you don't want them anymore. If this is not the case, please explain in detail of the symptoms of the problem viz. OLE custom contro usage, some code fragments etc.
0
 

Author Comment

by:MariaLamelas
ID: 1304071
About syjwg's comment:

Now, I have tried to run the program in VC 5.0 and the assertion
comes, exactly in the same place:

When I press the Next Button of the Wizard first page, the following assertion raises :


void AFXAPI DDX_Control(CDataExchange* pDX, int nIDC, CWnd& rControl)
{
      if (rControl.m_hWnd == NULL)    // not subclassed yet
      {
--->            ASSERT(!pDX->m_bSaveAndValidate);

            HWND hWndCtrl = pDX->PrepareCtrl(nIDC);

            if (!rControl.SubclassWindow(hWndCtrl))
            {
                  ASSERT(FALSE);      // possibly trying to subclass twice?
                  AfxThrowNotSupportedException();
            }

where m_bSaveAndValidate=1 and nIDC=1017 which belongs to a list box control located in the second page of the wizard.

Afterwards, it comes a new Assertion in line 43 of file dlgdata.cpp

HWND CDataExchange::PrepareCtrl(int nIDC)
{
      ASSERT(nIDC != 0);
      ASSERT(nIDC != -1); // not allowed
      HWND hWndCtrl;
      m_pDlgWnd->GetDlgItem(nIDC, &hWndCtrl);
      if (hWndCtrl == NULL)
      {
            TRACE1("Error: no data exchange control with ID 0x%04X.\n", nIDC);
--->            ASSERT(FALSE);
            AfxThrowNotSupportedException();
      }
      m_hWndLastControl = hWndCtrl;
      m_bEditLastControl = FALSE; // not an edit item by default
      ASSERT(hWndCtrl != NULL);   // never return NULL handle
      return hWndCtrl;
}

Finally it appears a report error that says that "a not supported operation was attempted".

After mbhakta's answer:
You are right, the problem comes from a control but I have checked the code to see if thre were fragments from removed controls and I found nothing.

0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now