ActiveX control properties

B

Ben Taylor

Hi,
I am experiencing a very strange problem with VC++.NET
2002 and I'm hoping somebody can tell me what I'm doing
wrong or whether it's a bug.
I created an ActiveX control and added some properties,
and added some controls to the propertiy page and linked
the properties to them, at this point they were working
fine - the on changed event handlers were firing, the
properties were updating, the control's OnDraw was being
called and it and the other main control class's member
functions had visibility of the relevant variables and
they were correct. I then added some extra functionality
to the OnDraw procedure, and a global function. Then, for
no apparent reason, the control's properties were not
being updated when I edited the property page, and the
control's OnDraw event wasn't being called. I tried
putting InvalidateControl() in the event handlers for the
properties, such as OnBackColorChanged in the control's
property page .cpp file, but that didn't work as they
weren't being called themselves! I couldn't understand
why, so I decided to start a new project and get to the
stage I was at when they were working, then copy and
paste the code I had written in bit by bit to see what
was causing the problem.
To add to my woe, this happened: I added one property to
the new control, a custom OLE_COLOR property, by choosing
the Add Propety option from the _DMyControl interface in
the MyControlLib node in class view, and added the
property fine. Then, when I came to add the second
property, in only had an option of property or function,
as opposed to property, function or variable, and it
displayed a totally different dialog box when I clicked
property! This time it had 'put' and 'set' options, so I
clicked help and it said these were only for ATL
projects!? This is bizarre, and totally confusing.
Does anybody know what is going on and what to do about
it? Is it a bug? If so, is there a patch available?

Thanks very much
Regards
Ben Taylor
 
B

Ben Taylor \(still confused\)

I manually solved this by checking the code that the
wizard generated against sample code in Prosise, and
discovered that he had the line DDP_Check(pDX,
IDC_MYBOOLPROP, m_myboolprop, _T("MyBoolProp")) in the
DoDataExchange function of the property page's class -
but the wizard didn't add this so I added it manually.
Hmmm... I'm not entirely sure this has fixed it
completely, although it has made it work. Should there be
another wizard command that I'm supposed to be using to
do this instead?
Thanks
Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top