Jump to content
  • Advertisement

Archived

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

firecast

what's up with my pointers??

This topic is 5400 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi!, i have a problem here. I'm using GDI+ and i declare 2 pointers:
VOID OnPaint(HDC hdc)
{
	Graphics	*myGraphs = NULL;
	Pen		*myPen    = NULL;

	myGraphs = new Graphics(hdc); //myGraphs' value is still 0x000000 despite i initialized it!!

        myPen    = new Pen(Color(0, 0, 255),2); //myPen's value is still 0x000000 despite i initialized it!!


	myGraphs->DrawEllipse(myPen, 50, 50, 50, 50); //So this gets me an error


	delete myPen;
	delete myGraphs;
}
what can i do?? thanks in advance [edited by - firecast on February 6, 2004 12:17:55 AM]

Share this post


Link to post
Share on other sites
Advertisement
I''ve never used GDI+ but I know its calling Win32 under the hood, so check GetLastError() as you normally would (should?) do.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If it''s returning an error after the first call to create Graphics then you can assume that there''s some error with your Device context. Hunt from there

Share this post


Link to post
Share on other sites
Just to note, there's no need to declare it dynamically:

Graphics graphics(hdc);
Pen pen(Color(0, 0, 255), 2);
graphics.DrawEllipse(&pen, 50, 50, 50, 50);

[edited by - petewood on February 7, 2004 7:45:44 PM]

Share this post


Link to post
Share on other sites
BTW that GDI+ API looks beautiful compared to the craptastic naming conventions MS flirted with such as ALLCAPSTYPES and everyone''s favorite CClassname.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!