CPropertySheet in a CFormView

I have run into a problem embedding a CPropertySheet into a CFormView as a child window. What I am doing is implementing a "find" view window, kind of like the find dialog in Windows 95.

I basically create the CPropertySheet as a child window of my view and then add my property pages. In addition, I have a few controls that are part of the underlying CFormView too. Things work fine when I compile for Win 3.x but I get an exception under Win32. The exception cannot be ignored, my application basically crashes.

I am using MSVC 4.2b and I get the exception in CPropertySheet::Create() on the following line:

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

Any ideas?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

That is not very informative. There might be something else which is going wrong during the creation of your property sheet. Please show me the code in detail.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cyourchAuthor Commented:
There is a CPropertySheet as a member of my derived CFormView class.

CPropertySheetView::CPropertySheetView(UINT nIDTemplate) :
  m_PropSheet = new CPropertySheetEx(AFX_IDS_APP_TITLE, this, 0);

int CPropertySheetView::OnCreate(LPCREATESTRUCT lpCreateStruct)
  if (CFormView::OnCreate(lpCreateStruct) == -1)
    return -1;

#ifdef WIN32
 // The WS_SYSMENU style is needed because the 16-bit MFC
 // property sheet
 // class looks for a system menu.

 // This causes the following error under win32.
 // "First-chance exception in Nman32.exe: 0xC0000005: Access Violation."
 if (!m_PropSheet->Create(this, dwSheetStyle))
    return -1;

 // Assign an id to the property sheet window.
  ::SetDlgCtrlID(m_PropSheet->m_hWnd, IDC_PROPERTYSHEET);

  return 0;

Using a standard CPropertySheet as a child control can cause
problems (as admitted by Microsoft).  Try subclassing from
CPropertySheet and set its style to WS_EX_CONTROLPARENT.  This
fixes a focus bug in property sheets.

See "www.microsoft.com/kb/articles/q149/5/01.htm" for specific

Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

Create your CPropertySheet based window without a parent. Once, it is created successfully use SetParent() , to make the property sheet of the FormView.
cyourchAuthor Commented:
Neither of the above ideas worked! I have decided to scrap the idea of making a property sheet a child of my view. Instead, I think the better approach for me is to embed a CTabCtrl and do my own property pages. This will work better because I still had tabbing problems with the proeprty sheet approach.
Ok , then please get in touch with the webmaster and cancel this question. This will save all experts from entering this expired question.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.