Listing C
BOOL CPageTab1::OnInitDialog()
{
    CPropertyPage::OnInitDialog();

    // Read values from registry
    CWinApp *pWinApp = AfxGetApp();
    m_bCommunications = pWinApp->GetProfileInt(TEXT("news.com"), TEXT("Communications"), 0);
    m_bEnterprise = pWinApp->GetProfileInt(TEXT("news.com"), TEXT("Enterprise"), 0);
    m_bMedia = pWinApp->GetProfileInt(TEXT("news.com"), TEXT("Media"), 0);
    m_bPersonalTechnology = pWinApp->GetProfileInt(TEXT("news.com"), TEXT("Personal Technology"), 0);
    m_bEBusiness = pWinApp->GetProfileInt(TEXT("news.com"), TEXT("EBusiness"), 0);

    // Update MFC variables
    UpdateData(FALSE);
   
    return TRUE;  // unless you set the focus to a control
            // EXCEPTION: OCX Property Pages should return FALSE
}

BOOL CPageTab1::OnKillActive()
{
    // Save and validate
    UpdateData(TRUE);

    // Write values to registry
    CWinApp *pWinApp = AfxGetApp();
    pWinApp->WriteProfileInt(TEXT("news.com"), TEXT("Communications"), m_bCommunications);
    pWinApp->WriteProfileInt(TEXT("news.com"), TEXT("Enterprise"), m_bEnterprise);
    pWinApp->WriteProfileInt(TEXT("news.com"), TEXT("Media"), m_bMedia);
    pWinApp->WriteProfileInt(TEXT("news.com"), TEXT("Personal Technology"), m_bPersonalTechnology);
    pWinApp->WriteProfileInt(TEXT("news.com"), TEXT("EBusiness"), m_bEBusiness);
   
    return CPropertyPage::OnKillActive();
}