Solved

Assertion in WinNt 4.0 but not in Win95 (CPropertyPage)

Posted on 1997-08-18
3
260 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Get filename and folder into excel 7 75
ORA-01403: no data found 43 101
if loop in java 3 141
sumHeights2  challenge 7 103
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

773 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