Bah, I got it
I just made the variable local to OnInitDialog
Code:
BOOL CColorCoderDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
unsigned int iPageNames[] = {IDD_COLORS, IDD_KEYWORDS, IDD_OPERATORS};
for (int i = 0; i < (sizeof(m_ppPages) / sizeof(CPropertyPage)); i++)
{
m_ppPages[i].Construct(iPageNames[i], 0);
m_psSheet.AddPage(&m_ppPages[i]);
}
m_psSheet.Create(this, WS_CHILD | WS_VISIBLE, 0);
m_psSheet.ModifyStyleEx(0, WS_EX_CONTROLPARENT);
m_psSheet.ModifyStyle(0, WS_TABSTOP);
CRect rect;
GetWindowRect(&rect);
ScreenToClient(&rect);
m_psSheet.SetWindowPos(NULL, rect.left + 7, rect.top + 150, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
return TRUE; // return TRUE unless you set the focus to a control
}
Edit:: Thanks for all the help Traveller