problems with chart->Draw
Posted: Wed Apr 14, 2004 5:58 pm
Hi,
Im having problems intermitent problems with CTChart::Draw, in Tchart 5.0.6.0 VC++ 6. Heres the code im using
chart->Draw(long(pDC->m_hDC),chartRect.TopLeft().x,chartRect.TopLeft().y,
chartRect.BottomRight().x,chartRect.BottomRight().y);
The problem is caused by the cast long(pDC->m_hDC), which Im forced to do because the interface has to take a long. Now, pDC->m_hDC is a pointer to a HDC struct, so its an address and is unsigned. Casting to a long, can result in a -ve integer if the address's integer value is really an unsigned int (32 bit is 1). In this situation an exception is fired, presumably by TChart and problably because it thinks the DC handle is invalid.
What can I do about this. At the moment I have to create multiple DC handles in a loop until i get a handle that has 0 as the most significant bit (32 bit for a 32 bit int) and is suitable for steema.
Thanks
-Andrzej
Im having problems intermitent problems with CTChart::Draw, in Tchart 5.0.6.0 VC++ 6. Heres the code im using
chart->Draw(long(pDC->m_hDC),chartRect.TopLeft().x,chartRect.TopLeft().y,
chartRect.BottomRight().x,chartRect.BottomRight().y);
The problem is caused by the cast long(pDC->m_hDC), which Im forced to do because the interface has to take a long. Now, pDC->m_hDC is a pointer to a HDC struct, so its an address and is unsigned. Casting to a long, can result in a -ve integer if the address's integer value is really an unsigned int (32 bit is 1). In this situation an exception is fired, presumably by TChart and problably because it thinks the DC handle is invalid.
What can I do about this. At the moment I have to create multiple DC handles in a loop until i get a handle that has 0 as the most significant bit (32 bit for a 32 bit int) and is suitable for steema.
Thanks
-Andrzej