User (Legacy) Posted September 17, 2003 Report Share Posted September 17, 2003 Hello When I call GetPicture in the ChartFX then I see GDI objects leak. Why? (if I pass parameter as CHART_BITMAP then 1 GDI object per time if I pass parameter CHART_METAFILE then 2 GDI object per time ) Can you offer me any work around? PS I use Chart FX Client Server ActiveX Control (version 5.0.9) example of my code ;-) Private Sub Command1_Click() ChartFX1.GetPicture CHART_BITMAP End Sub Thanks Link to comment Share on other sites More sharing options...
Software FX Posted September 17, 2003 Report Share Posted September 17, 2003 A Picture Object is created and returned to you. You are responsible, when you're done with it, to release it. -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
User (Legacy) Posted September 17, 2003 Author Report Share Posted September 17, 2003 Hello, of course, I can write Private Sub Command1_Click() Set temp = ChartFX1.GetPicture(CHART_BITMAP) Set temp = Nothing End Sub it's nothing change and this is same that previous code... What should I write that there is no GDI leaks? Thanks Link to comment Share on other sites More sharing options...
Software FX Posted September 17, 2003 Report Share Posted September 17, 2003 This looks like a bug, I will have to check further. A workaround is easy though, call DeleteObject (pic.Handle) after you are done with it. -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
User (Legacy) Posted September 18, 2003 Author Report Share Posted September 18, 2003 Thanks fo your answer. Your workaround helps avoid GDI leaks when I call GetPicture and pass in it CHART_BITMAP parameter but when I pass CHART_METAFILE then it doesn't help and 2 GDI object leak per time. The saving as bitmap gives low qualities of bitmap therefor I can't use it. I try using Export method and save bitmap in the stream ( I read that it's possibly in the documentation ). In my test project I have done following CComVariant vt1; vt1.vt = VT_UNKNOWN; vt1.punkVal = pStream;// this interface inherit from IStream interface m_Chart.Export( ChartfxLib::CHART_METAFILE, vt1 ); but Export returns E_FAIL, Where am I wrong? Thanks Link to comment Share on other sites More sharing options...
Software FX Posted September 18, 2003 Report Share Posted September 18, 2003 You need to assign VT_STREAM instead of VT_UNKNOWN. Because of some checking made by _varaint_t, you will need to use raw_Export. -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.