nanogui: DeleteObject() in fatak error


Previous by date: 30 Jan 2007 15:59:06 +0000 Re: GdImageFromFile displays bitmaps incorrectly, Greg Haerr
Next by date: 30 Jan 2007 15:59:06 +0000 Re: GdImageFromFile displays bitmaps incorrectly, Franco Casadei
Previous in thread:
Next in thread: 30 Jan 2007 15:59:06 +0000 Re: DeleteObject() in fatak error, Uwe Klatt

Subject: DeleteObject() in fatak error
From: "Franco Casadei" ####@####.####
Date: 30 Jan 2007 15:59:06 +0000
Message-Id: <002e01c74487$80561f70$0300a8c0@franco>

Sometimes the funciton DeleteObject() crashes the system ;
I get an "External Memory Address Error". 
This  function works fine, but the it crash.


static  MyDrawRect(HDC hdc, int x , int y, int h, int w, int width, int color)
{
 HPEN rectPen;
 POINT p[5];
 
 p[0].x = x;
 p[0].y = y;
 p[1].x = x + w;
 p[1].y = y ;
 p[2].x = x + w;
 p[2].y = y + h ;
 p[3].x = x;
 p[3].y = y + h ;
 p[4].x = x;
 p[4].y = y;
 
    rectPen = CreatePen(1,1,color);
    SelectObject(hdc, rectPen);
    Polyline(hdc,p,5);
 if (width == 2){
  /* rettangolo interno*/
  p[0].x++;
  p[0].y++;
  p[1].x--;
  p[1].y++; 
  p[2].x--;
  p[2].y--;
  p[3].x++;
  p[3].y--;
  p[4].x++;
  p[4].y++;
  Polyline(hdc,p,5);
 }    
 /* This make the system crash */
DeleteObject(SelectObject(hdc, rectPen));
         
}

What happans if I omit to call DeleteObject() ?
Thanks,
Casadei Franco

Previous by date: 30 Jan 2007 15:59:06 +0000 Re: GdImageFromFile displays bitmaps incorrectly, Greg Haerr
Next by date: 30 Jan 2007 15:59:06 +0000 Re: GdImageFromFile displays bitmaps incorrectly, Franco Casadei
Previous in thread:
Next in thread: 30 Jan 2007 15:59:06 +0000 Re: DeleteObject() in fatak error, Uwe Klatt


Powered by ezmlm-browse 0.20.