Jump to content
  • Advertisement


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


help me with this, plz

This topic is 6965 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

Heres the deal. I''m working on a paont program, and as of now i have a pencil mode and an ellipse mode for drawing. heres the code that draws the ellipse: int Draw_Circle_GDI(RECT *rect, int color, LPDIRECTDRAWSURFACE7 lpdds) { if(FAILED(lpdds->GetDC(&gv.xdc))) return(0); gv.p.x = 1; gv.lb.lbStyle = BS_SOLID; gv.lb.lbColor = RGB(palette[color].peRed, palette[color].peGreen, palette[color].peBlue); gv.lp.lopnStyle = PS_SOLID; gv.lp.lopnWidth = gv.p; gv.lp.lopnColor = RGB(palette[color].peRed, palette[color].peGreen, palette[color].peBlue); gv.pen = CreatePenIndirect(&gv.lp); gv.brush = CreateSolidBrush(RGB(palette[color].peRed, palette[color].peGreen, palette[color].peBlue)); gv.old_p = SelectObject(gv.xdc, gv.pen); gv.old_b = SelectObject(gv.xdc, gv.brush); Ellipse(gv.xdc, rect->left, rect->top, rect->right, rect->bottom); SelectObject(gv.xdc, gv.old_p); SelectObject(gv.xdc, gv.old_b); DeleteObject(gv.pen); DeleteObject(gv.brush); lpdds->ReleaseDC(gv.xdc); return(1); } ///////////////////////////// To make a long story short, whenver i run my painr program and only draw using the pencil tool (i.e not executing the above code), everything works fine. However once i run the program and draw ellipses (i.e executing the above code), everything works fine until i exit the program, where after i quit i get a "This function has performed an illegal operation...Access Violation.." error message (and it eats up resources like a bitch!). Why is the above code causing this error? (BTW, gv.xdc is a HDC gv.pen is a HPEN gv.old_p is a *HPEN gv.brush is HBRUSH...etv.)

Share this post

Link to post
Share on other sites
im glad to know no one can solve this one!!

makes me feel special!!

what i meant to say:
my god people!! is this really that hard!!! ;(

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!