Aggregating an ActiveX control
We want to create a COM object that aggregates the ShockwaveFlash
control so that we can tweak the design-time appearance. I have
attempted to create the aggregated control as follows:
- Create an ATL project. Add -> Class, choose "ATL Simple Object"
- For each interface in the original control add a line like
COM_INTERFACE_ENTRY_AGGREGATE(IID_IPersistStorage, m_inner)
- Add DECLARE_GET_CONTROLLING_UNKNOWN()
- Create & release the inner object in FinalConstruct/Release:
HRESULT FinalConstruct()
{
HRESULT hr = CoCreateInstance(CLSID_ShockwaveFlash,
GetControllingUnknown(), CLSCTX_ALL,
IID_IUnknown, (void**) &m_inner);
return hr;
}
void FinalRelease()
{
if (m_inner) {
m_inner->Release();
m_inner = NULL;
}
}
- In the .rgs file, liberally sprinkle 'Insertable' and 'Control' keys.
This is supposed to be a replacement of the Flash control, with no
additional functionality.
When I try this in the ActiveX Control Test Container it seems to work
at first -- I can right-click on the control and see the default Flash
menu with the About Adobe Flash 9 menu item. But if I click the
Design/Run button, it crashes with a _com_error exception.
If I try inserting the control in Microsoft Office PowerPoint 2003, I
get a message box saying 'Could not access system registry'. The Help
says this is error 335, 'An attempt to read from or write to the system
registry failed.'
So I was wondering if some kind soul might be able to tell me whether
the approach I am trying is at least plausible, and if there is some way
to try to work out what is going wrong. Perhaps it is as simple as a
registry entry missing from the .rgs file that PowerPoint is trying to
read unconditionally. Or perhaps I need to rethink the whole thing.
Any suggestions?
Thanks in advance
-- Damian Cugley
--
Oxford Computer Consultants Ltd,
23-38 Hythe Bridge Street,
Oxford OX1 2EP
http://www.oxfordcc.co.uk/