Jump to content
Software FX Community

Re: Problem getting DC in Visual C++ 6.0

User (Legacy)

Recommended Posts

Try this code it may help.  Also, you may want to check how you have #import 

ed your ocx.

In my code I have done the following...

#import "sfxbar.dll" named_guids no_namespace

#import "cfx4032.ocx" named_guids no_namespace

_variant_t pInfo = m_spChartFX->PaintInfo(CPI_GETDC);

HDC handle = (HDC) pInfo.lVal; // NB. The data member of the VARIANT is a

VT_I4 (A 4-byte integer)


or using PaintInfo2()

VARIANT vResult;

m_spChartFX->PaintInfo2(CPI_GETDC, pInfo, &vResult);

Good Luck

Josh Eanes wrote in message ...

>Hello, I have been having a problem trying to get a device context of a

>chartfx object. I am using VC++ 6.0.


>The following code is what I put in:


> HDC hDevice;

> hDevice = m_pChartFX->PaintInfo(CPI_GETDC);


>Once I set this in, I get a "error C2679: binary '=' : no operator defined

>which takes a right-hand operand of type 'class _variant_t' (or there is no

>acceptable conversion)" error.


>Am I doing something wrong here? This seems to be the process that the

>example uses...


>Thank you for your help!


>Joshua Eanes


>PS. I have also tried using PaintInfo2. For example, the following code:


> HDC hDevice;

> _variant_t hmel;

> m_pChartFX->PaintInfo2(CPI_GETDC, hmel, hDevice);


>Gives me a "error C2664: 'PaintInfo2' : cannot convert parameter 3 from

>'struct HDC__ *' to 'struct tagVARIANT *'

> Types pointed to are unrelated; conversion requires

>reinterpret_cast, C-style cast or function-style cast" error.





Link to comment
Share on other sites


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

  • Create New...