Original Post
can anyone tell me what I am doing wrong here? After printing
a number of times (ie going though this code alot) my program crashes.
void Word::ShowChar(CDC *dc, int picX, int picY, char Let)
{
BITMAP info;
HBITMAP bmp;
HDC bmpdc;
HDC dcx;
dcx = dc->m_hDC;
bmp = (HBITMAP)::LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(LETTERS),IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
bmpdc=CreateCompatibleDC(dcx);
SelectObject(bmpdc,bmp);
GetObject(bmp,sizeof(info),&info);
DeleteObject(bmp);
int width,height,srcx,srcy;
width = 19;//with of the letter
height = 30;//height of the letter
srcx = 1; //Starting Value
if ((Let == '' '')||((Let < ''N'')&&(Let >= ''A'')))
{
srcy = 1;
if ((Let > ''A'')||(Let == '' ''))
srcx = srcx + (20 * GetNum(Let));
}
else if ((Let == ''-'')||((Let <= ''Z'')&&(Let >= ''N'')))
{
srcy = 37;
if ((Let > ''N'')||(Let == ''-''))
srcx = srcx + (20 * GetNum(Let));
}
else if ((Let <= ''9'')&&(Let >= ''0''))
{
srcy = 73;
if (Let != ''0'')
srcx = srcx + (20 * GetNum(Let));
}
else
{
srcy = 1;
Let = '' '';
srcx = srcx + (20 * GetNum(Let));
}
BitBlt(dcx,picX,picY,width,height,bmpdc,srcx,srcy,SRCCOPY);
DeleteObject(bmpdc);
DeleteObject(dcx);
}