Solved

CPropertySheet in a CFormView

Posted on 1997-06-12
6
737 Views
Last Modified: 2013-11-20
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?
0
Comment
Question by:cyourch
  • 3
  • 2
6 Comments
 
LVL 4

Accepted Solution

by:
mbhakta earned 40 total points
ID: 1302098
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.
0
 

Author Comment

by:cyourch
ID: 1302099
There is a CPropertySheet as a member of my derived CFormView class.

CPropertySheetView::CPropertySheetView(UINT nIDTemplate) :
      CFormView(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
  DWORD dwSheetStyle = DS_MODALFRAME | DS_SETFONT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | DS_3DLOOK | DS_CONTEXTHELP;
#else
 // The WS_SYSMENU style is needed because the 16-bit MFC
 // property sheet
 // class looks for a system menu.
  DWORD dwSheetStyle = DS_MODALFRAME|DS_SETFONT|WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_SYSMENU;
#endif

 // 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;
}

0
 

Expert Comment

by:ravib
ID: 1302100
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
instructions.

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 4

Expert Comment

by:mbhakta
ID: 1302101
Create your CPropertySheet based window without a parent. Once, it is created successfully use SetParent() , to make the property sheet of the FormView.
0
 

Author Comment

by:cyourch
ID: 1302102
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.
0
 
LVL 4

Expert Comment

by:mbhakta
ID: 1302103
Ok , then please get in touch with the webmaster and cancel this question. This will save all experts from entering this expired question.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.NET how to use the Vertical ScrollBar 5 90
sameEnds challenge 3 136
Line meaning 9 82
Sed question 2 70
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: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

863 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

18 Experts available now in Live!

Get 1:1 Help Now