Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Assertion in WinNt 4.0 but not in Win95 (CPropertyPage)

Posted on 1997-08-18
3
Medium Priority
?
280 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 300 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

877 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