Yash Bhutada
Yash Bhutada

Reputation: 43

Attempted an unsupported operation in CPropertySheet, MFC, C++

I am trying to open a new message dialog box in MFC C++, however in one of the PC, I am getting the error

Attempted an unsupported operation.

void CMainFrame::OpenAfnMessage( CString strTitle)
{
    CMsgForm MyMsg( strTitle , this );
    int nDisposition = MyMsg.DoModal( ); 
}

CMsgForm::CMsgForm( LPCTSTR pszCaption , CWnd * pParentWnd , UINT iSelectPage )
:CPropertySheet( pszCaption , pParentWnd , iSelectPage )
{
    m_psh.dwFlags |= PSH_NOAPPLYNOW;
    AddPage( & m_msgpage );
    AddPage( & m_hdrpage );
    m_pFrame = (CFrame *) pParentWnd;
}

BOOL CMsgForm::OnInitDialog( )
{
    BOOL bResult = CPropertySheet::OnInitDialog( );
    
    //Draws the common view for both pages
    
    SetActivePage( & m_hdrpage ); //At this point, the error is observed
    m_hdrpage.UpdateHeaderPage( pMsgpkt );


    // Update Message Page fields accordingly.
    SetActivePage( & m_msgpage );
    m_msgpage.UpdateMessagePage( pMsgpkt );

    UpdateData( FALSE );

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}

class CMsgForm : public CPropertySheet
{
    DECLARE_DYNAMIC( CMsgForm )

// Construction & Destruction
public:
    CMsgForm( LPCTSTR pszCaption , CWnd * pParentWnd = NULL , UINT iSelectPage = 0 );
    virtual ~ CMsgForm( );
public:
    CMsgPage m_msgpage;  
    CHdrPage m_hdrpage;  
};

class CHdrPage : public CPropertyPage
{
    DECLARE_DYNCREATE( CHdrPage )

// Construction & Destruction
public:
    CHdrPage( );
    ~ CHdrPage( );

// Dialog Data
public:
    
    enum { IDD = IDD_HDR_PAGE };
};

CHdrPage::CHdrPage( ) : CPropertyPage( CHdrPage::IDD )
{
    
}

When I am calling SetActivePage( & m_hdrpage ); in CMsgForm::OnInitDialog(), I get the error. It is observed only in 1 PC, rest all the PCs that I am trying this, it works completely fine and generates the UI properly.

The error so far is observed only in 1 PC, and it works fine in all other PCs that I have tried it so far

Upvotes: -1

Views: 55

Answers (0)

Related Questions