PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

ActiveX without MFC or ATL help!

Hi,

I need some help with an ActiveX (without MFC or ATL) project I am trying to write.

So far, I am able to create the ActiveX control, display it, however when I set the properties, it doesn't update it's display. I am using some piece of codes I found on the web to help me with this project.

I have attached the source code of a test project.

The other thing I would like to know is how ActiveX events works. I would like to be able to catch all ActiveX events and when I am done return the execution to the default event handler.
Attachments:
activex.zip (42 KB)
You could take a look at this:
http://www.codeproject.com/com/dyn_idispatch.asp

I've found it useful for exposing objects to ActiveX scripting engines and handling events. Probably not exactly what you're looking for, but it is educational to look at the source.

Dan East
Thanks, will look at it. It's seems to be a good read and might reveal a few things I am looking for.
Is it possible that when I change an ActiveX property I have to issue some kind of event to the control to tell it to update itself? I saw the OnChanged event somewhere. When I can a property the control display doesn't update but if I check the property value after, it's the new value I assigned.
Anyone?
I believe you have to write the handler code for property change in the property handler method which should be added when property was added to the control.

For the property you have added, add following piece for code in you .h
// Dispatch maps
//{{AFX_DISPATCH(CIEActiveXCtrl)
afx_msg void OnPropertyChanged();
//}}AFX_DISPATCH

And in .cpp

BEGIN_DISPATCH_MAP(CIEActiveXCtrl, COleControl)
//{{AFX_DISPATCH_MAP(CIEActiveXCtrl)
DISP_PROPERTY_NOTIFY(CIEActiveXCtrl, "Property", m_Property, OnPropertyChanged, VT_BSTR)
END_DISPATCH_MAP()

and implementation of the method OnPropertyChanged() should take care of updating the property value.

I hope this helps.
Thanks
Jatinder