15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Assertion when embedding CPropertySheet into a CScrollView

Allen Mavel -- AllenLM@datastorm.com
Tuesday, April 09, 1996


Operating system:  Windows 95
MFC version 4.0

I'm embedding a property sheet into a view (essentially establishing a   
CFormView that happens to be a property sheet).  When looking through the   
archives of the MFC mailing list, I noticed that the recommendation was   
to embed the property sheet into a CScrollView in the OnCreate function.   
 I've done this as follows:

int CMyView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
 if (CScrollView::OnCreate(lpCreateStruct) == -1)
  return -1;
 m_Sheet.AddPage(&m_Page1);
 m_Sheet.AddPage(&m_Page2);
 m_Sheet.Create(this, WS_CHILD | WS_VISIBLE, 0);
 return 0;
}

This does work as promised, but it seems to be generating a non-fatal   
assertion in the CPropertySheet.Create() function.  The message is:

"First-chance exception in ProperView.exe (COMCTL32.DLL):  0xC0000005:   
Access Violation"

The specific line in CPropertySheet::Create() is:

 HWND hWnd = (HWND)PropertySheet(&m_psh);

This calls the AfxThunkPropertySheet() function in ccdata.cpp, which in   
turn calls:

 return _afxCommCtrl.pfnPropertySheet[1](pHeader);

which is generating the error message.  Aside from the assertion, the   
code seems to work just fine and it is giving me what I want.  For   
obvious reasons, though, I'd prefer not to have that assertion.  Can   
anyone give me a clue as to why it is occurring and what I can do to fix   
it?

Thanks,

Paul Bartholomew
pauldb@datastorm.com



Allen Mavel
Research and Development  



David W. Gillett -- DGILLETT@expertedge.com
Thursday, April 11, 1996

[Mini-digest: 3 responses]

> This does work as promised, but it seems to be generating a non-fatal   
> assertion in the CPropertySheet.Create() function.  The message is:
> 
> "First-chance exception in ProperView.exe (COMCTL32.DLL):  0xC0000005:   
> Access Violation"

... 

> Aside from the assertion, the code seems to work just fine and it
> is giving me what I want.  For obvious reasons, though, I'd prefer
> not to have that assertion.  Can anyone give me a clue as to why it
> is occurring and what I can do to fix it? 

  This behaviour appears to be normal, actually.  I once thought I 
understood what was going on at this point, but I'm less certain now. 
I believe it has something to do with manipulation of the dialog 
resources associated with the individual pages.
  Bottom line is that you will get this message when creating a 
CPropertySheet, but it's nothing to worry about.

Dave

-----From: "Mike Blaszczak" 

> Operating system:  Windows 95
> MFC version 4.0

Thanks.

> This does work as promised, but it seems to be generating a non-fatal   
> assertion in the CPropertySheet.Create() function.  The message is:

> "First-chance exception in ProperView.exe (COMCTL32.DLL):  0xC0000005:   
> Access Violation"

This message is an exception, not an assertion.  There's a pretty big 
difference.

> The specific line in CPropertySheet::Create() is:
> HWND hWnd = (HWND)PropertySheet(&m_psh);

This assertion is benign.  It is discussed in an MSKB article.  If you search 
for "exception near PropertySheet", I think you'll find it.  Maybe someone 
else knows the Q-number from the top of their head.

> Aside from the assertion, the   

An assertion is generated by a line of source code which will say something 
like ASSERT(x), where "x" is actually a conditional expression.  If the 
expression evaluated to non-zero, the assertion doesn't trip.  If the 
expression evaluates to zero, the assertion will trip.  The expression is only 
compiled and evaluated in debug builds.  This is one of the many reasons that 
debug builds are so much larger than release builds.  An ASSERT() message pops 
up a dialog box while your program is running.

An exception is a special condition generated by the operating system. It 
might be in response to hardware memory protection catching a problem, or it 
might be in response to a program generated problem, like using the "throw" 
keyword in C++.  Exceptions exist in release builds and debug builds alike.

> Paul Bartholomew
> pauldb@datastorm.com

.B ekiM
TCHAR szSpringtime[] = _T("Check twice and save a life: motorcycles are 
everywhere!");

> Allen Mavel
> Research and Development  

Richard M. Nixon
Ex-President Of The United States
TCHAR szDisclaimer[] = _T("People ought to know if thier president's a 
crook.");





| Вернуться в корень Архива |