problems with chart->Draw

TeeChart for ActiveX, COM and ASP
Post Reply
andrzej
Newbie
Newbie
Posts: 6
Joined: Fri Nov 15, 2002 12:00 am
Location: tucson, AZ

problems with chart->Draw

Post by andrzej » 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

Pep
Site Admin
Site Admin
Posts: 3277
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Apr 20, 2004 6:44 pm

Hi Andrzej,

I’m having difficulty reproducing this. Could you send us an example (you can post it in the steema.public.attachments newsgroup) that reproduces the problem or let me know how to recreate the problem with the Printing example shipped with TeeChart. In my tests I don’t seem to be able to generate handles that cause the method to fail.

With thanks.

Post Reply