Jump to content
Software FX Community

Using IStream with Export function in COM Charting Tool

User (Legacy)

Recommended Posts

I am trying to get Export to work with an IStream which I believe the 

documentation tells me works.

The result of the following code is E_FAIL (Result == E_FAIL)

If I Uncomment the lines that specify VARIANT as VT_STREAM I get a C++


When I specify output to a file it works correctly.

Any samples around to do export/import from a stream?

Thanks in advance!

// ---- Sample Code ----

IStream* pStream = 0;

if ( SUCCEEDED( ::CreateStreamOnHGlobal( 0, true, &pStream ) ) )



// Val.vt = VT_STREAM;

// Val.punkVal=pStream;

_variant_t Val = pStream;

long Result = m_pChart->Export( CHART_CFXOLETEMPLATE, Val );

Link to comment
Share on other sites


That was the problem.

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message


> _variant_t does not allow for VT_STREAM, you need to by-pass _varian_t and

> use a native OLE Variant (VARIANT struct) as follows:




> V_VT(&v) = VT_STREAM;

> V_UNKNOWN(&v) = m_Stm;


> m_pChartFX->raw_Export(CHART_CFXOLETEMPLATE,v,&lResult);



> --

> FP

> Software FX


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...