0
votes

I have an MFC ActiveX control embedded in a web page. Some of the parameters for this control are very large. I don't know what these values will be at compile time, but I do know that once retrieved, they will almost certainly never change.

Currently, I embed the parameters like so:

<object name="MyActiveX">
  <param name="param" value="<%= GetData() %>" />
</object>

I want to do something like this:

<object name="MyActiveX">
  <param name="param" value="content/data" valuetype="ref" />
</object>

The idea is that the browser would retrieve the resource from the web server and pass it on to the control. The browser's own caching would then take care of the unneccesary downloads. Unfortunately, ref parameters don't work like this. The browser just passes the url along to the control (which strikes me as utterly useless, but I digress).

So, is there some way I can make this work? Alternatively, is there an easy way in MFC to instruct the control's host container to retrieve a URI identified resource? Any better ideas?

2

2 Answers

1
votes

Implement the IPersistStream or IPersistStreamInit interface then you can specify content with the object's data attribute as in: <object clsid="XXXX" data="mydata.bin"></object>. Internet Explorer will download the file referenced by the data attribute hand it to you via its IPersistStream::Load interface. ATL has default implementations for these interfaces which will populate your control's properties, almost certainly so does MFC.

0
votes

Does it really need the data when it is created?

Could you make it an 'init' step

largeData = GetData();
MyActiveX.init( largeData );