Note that there are some explanatory texts on larger screens.

plurals
  1. POErrors with resizing property sheet
    primarykey
    data
    text
    <p>I'm trying to make a re-sizable property sheet using the example <a href="http://support.microsoft.com/kb/300606" rel="nofollow">http://support.microsoft.com/kb/300606</a>. However I get several errors in my code which I don't know how to overcome. I created the property sheet using a class wizard on my Dialog. I only need the re-size function mentioned in the article. Any help will be appreciated.</p> <p>.cpp class</p> <pre><code> #include "stdafx.h" #include "Geometry.h" #include "GeoSheet.h" // CGeoSheet IMPLEMENT_DYNAMIC(CGeoSheet, CPropertySheet) CGeoSheet::CGeoSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage) :CPropertySheet(nIDCaption, pParentWnd, iSelectPage) { } CGeoSheet::CGeoSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage) :CPropertySheet(pszCaption, pParentWnd, iSelectPage) { } CGeoSheet::~CGeoSheet() { } BEGIN_MESSAGE_MAP(CGeoSheet, CPropertySheet) ON_COMMAND(IDOK, OnOK) END_MESSAGE_MAP() // CGeoSheet message handlers void CGeoSheet::OnOK() { CPropertySheet::OnClose(); } // Overriding DoModal() allows us to hook our callback into // the prop sheet creation int CGeoSheet::DoModal() { // Hook into property sheet creation code AFX_OLDPROPSHEETHEADER* psh = GetPropSheetHeader(); psh-&gt;dwFlags |= PSH_USECALLBACK; psh-&gt;pfnCallback = XmnPropSheetCallback; return CPropertySheet::DoModal(); } // This function must be a STATIC member function. //Callback to allow us set the default window styles // for the property sheet int CGeoSheet ::XmnPropSheetCallback(HWND hWnd, UINT message, LPARAM lParam) { extern int CALLBACK AfxPropSheetCallback(HWND, UINT message, LPARAM lParam); // XMN: Call MFC's callback int nRes = AfxPropSheetCallback(hWnd, message, lParam); switch (message) { case PSCB_PRECREATE: // Set our own window styles ((LPDLGTEMPLATE)lParam)-&gt;style |= (DS_3DLOOK | DS_SETFONT | WS_THICKFRAME | WS_SYSMENU | WS_POPUP | WS_VISIBLE | WS_CAPTION); break; } return nRes; } </code></pre> <p>.h file</p> <pre><code>#pragma once // CGeoSheet class CGeoSheet : public CPropertySheet { DECLARE_DYNAMIC(CGeoSheet) public: CGeoSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); CGeoSheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); virtual ~CGeoSheet(); protected: DECLARE_MESSAGE_MAP() //{{AFX_MSG(CMyPropertySheet) // NOTE - the ClassWizard will add and remove member functions here. afx_msg void OnOK(); int CGeoSheet::DoModal(); int CGeoSheet ::XmnPropSheetCallback(HWND hWnd, UINT message, LPARAM lParam); //}}AFX_MSG }; </code></pre> <p>I keep getting these errors.</p> <pre><code>geosheet.cpp(49) : error C2065: 'AFX_OLDPROPSHEETHEADER' : undeclared identifier geosheet.cpp(49) : error C2065: 'psh' : undeclared identifier geosheet.cpp(49) : error C3861: 'GetPropSheetHeader': identifier not found geosheet.cpp(50) : error C2065: 'psh' : undeclared identifier geosheet.cpp(50) : error C2227: left of '-&gt;dwFlags' must point to class/struct/union/generic type type is ''unknown-type'' geosheet.cpp(51) : error C2065: 'psh' : undeclared identifier geosheet.cpp(51) : error C2227: left of '-&gt;pfnCallback' must point to class/struct/union/generic type type is ''unknown-type'' </code></pre> <p><b>Edit</b> I modified the DoModal function according to <a href="http://www.tech-archive.net/Archive/VC/microsoft.public.vc.mfc/2005-09/msg00585.html" rel="nofollow">http://www.tech-archive.net/Archive/VC/microsoft.public.vc.mfc/2005-09/msg00585.html</a>; and now I get this single error.</p> <p>Code:</p> <pre><code>int CGeoSheet::DoModal() { // Hook into property sheet creation code m_psh.dwFlags |= PSH_USECALLBACK; m_psh.pfnCallback = XmnPropSheetCallback;// &lt;--Error return CPropertySheet::DoModal(); } </code></pre> <p>Error:</p> <pre><code>geosheet.cpp(50) : error C2440: '=' : cannot convert from 'int (__cdecl *)(HWND,UINT,LPARAM)' to 'PFNPROPSHEETCALLBACK' This conversion requires a reinterpret_cast, a C-style cast or function-style cast </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload