其中一个函数是这样的
void game::LoadMapBitmap(int x,int y,HWND hWnd,HDC hdc,HINSTANCE hInstance,LPCWSTR lpsBitmapName)
{
CString str = "C:\\Documents and Settings\\sjjwind\\桌面\\象棋\\位图\\";
str += (TCHAR*)lpsBitmapName;
HBITMAP  bimp = (HBITMAP)LoadImage(hInstance,
(LPCWSTR)str,IMAGE_BITMAP,50,52,LR_LOADFROMFILE);
HBITMAP hBitmap = CreateCompatibleBitmap(hdc,1200,800);
HDC hmc = CreateCompatibleDC(hdc);
HDC pOldDC = (HDC)SelectObject(hmc,bimp);
TransparentBlt(hdc,25+y * 52,(int)(20+x * 49.5) ,35,35,hmc,0,0,50,50,RGB(255,255,255));
//SelectObject(pOldDC,bimp);
DeleteObject(hBitmap);
DeleteObject(bimp);
ReleaseDC(hWnd,pOldDC);
ReleaseDC(hWnd,hmc);
}
在WM_LBUTTONDOWN里面这样处理的
void game::DoWithLButton(int x,int y,HWND hWnd)
{
        int y_role = (x - 25) / 52;
int x_role = (int)((y - 20) / 49.5);
map[x][y] = VECANT;
RECT rect;
rect.top = x_role * 49.5 + 22;
rect.left = y_role * 52 + 25;
rect.bottom = rect.top + 60;
rect.right = rect.left + 60;
if(x_role < 0 || x_role >= 10 || y_role < 0 || y_role >= 9)
{
return ;
}
if(lButtonDown == 1)
{
if(map[x_role][y_role] == VECANT)
{
return ;
}
pt.x = x_role;
pt.y = y_role;
//GetClientRect(hWnd,&rect);
//InvalidateRect(hWnd,&rect,false);
}
else 
{
map[x_role][y_role] = map[pt.x][pt.y];
map[pt.x][pt.y] = VECANT;
InvalidateRect(hWnd,&rect,false);
rect.top = pt.x * 49.5 + 22;
rect.left = pt.y * 52 + 25;
rect.bottom = rect.top + 60;
rect.right = rect.left + 60;
InvalidateRect(hWnd,&rect,false);
//Test(hWnd);
}
lButtonDown ++;
lButtonDown %= 2;
}
但是就是这个InvalidateRect刷新使GDI句柄不断增加,改了好半天也没有成功,求大神指教