Advertisement

help me with this, plz

Started by March 31, 2000 12:14 AM
1 comment, last by Zipster 24 years, 8 months ago
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.peRed, palette.peGreen, palette.peBlue); gv.lp.lopnStyle = PS_SOLID; gv.lp.lopnWidth = gv.p; gv.lp.lopnColor = RGB(palette.peRed, palette.peGreen, palette.peBlue); gv.pen = CreatePenIndirect(&gv.lp); gv.brush = CreateSolidBrush(RGB(palette.peRed, palette.peGreen, palette.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.)
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!!! ;(
Advertisement
I gave the answer in your duplicate post.

This topic is closed to new replies.

Advertisement