Link to home
Start Free TrialLog in
Avatar of bhstanes
bhstanes

asked on

Changing Properties of an activex control

I am a novice and I have an existing program that I am trying to edit.  There is a dialog box that has several buttons that I needed to color.  I found that I could easily create new buttons by inserting an activex control (Microsoft Form Command Button).  After doing so I found that the buttons I changed would no longer enable and diable during program execution like they were supposed to.  The orignal code had a member variable assigned to the button.  That member variable was a CButton type.  I deleted that member variable and put in one with the same name but a CCommandButton type.  Originally the code called in a function called EnablePBs and the ran that through a code

void CR5KDlg::EnablePBs(BOOL bEnable)
{

    m_btnDownload.EnableWindow(bEnable);
    m_btnEraseFlash.EnableWindow(bEnable);
    m_btnSetDateTime.EnableWindow(bEnable);

      int nCmdShow = SW_SHOW;
    if (bEnable)
    {
        nCmdShow = SW_HIDE;
        m_ProgressCtrl.SetPos(0);
        m_stSteps.SetWindowText("");
        m_stPctComplete.SetWindowText("");
    }

    m_ProgressCtrl.ShowWindow(nCmdShow);
    m_stSteps.ShowWindow(nCmdShow);
    m_stPctComplete.ShowWindow(nCmdShow);

}

I have tried changing the code to m_btnname.SetEnabled(bEnable), but that just causes exception errors.  I am not sure exactly what to do to make this work.  PLease Help.  
ASKER CERTIFIED SOLUTION
Avatar of hemakumar
hemakumar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial