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)


      int nCmdShow = SW_SHOW;
    if (bEnable)
        nCmdShow = SW_HIDE;



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.  
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I tested my application with Microsoft Form Command Button and wizard created CCommandButton wrapper class and
in OnInitDialog i called after

CDialog::OnInitDailog;//see that u call that function after  this


and both are working perfectly.check it with a single button first of all the u can identify where the problem is coming from.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.