rect.left=0;
rect.right=0 ;
rect.top=0;
rect.bottom=0;
PlaySound (TEXT ("no.wav"), NULL, SND_FILENAME | SND_ASYNC) ;
}
pSelected[0].x=0;
pSelected[0].y=0;
pSelected[1].x=0;
pSelected[1].y=0;
}
else
{//同一张牌或花色不一致
rect.left = pSelected[0].x *(cxBack-3);
rect.right = rect.left+(cxBack-3)+3;
rect.top = pSelected[0].y *(cyBack-4)-30;
rect.bottom = rect.top + (cyBack-4)+4;
InvalidateRect (hwnd, &rect, true) ;
pSelected[0].x=x;
pSelected[0].y=y;
pSelected[1].x=0;
pSelected[1].y=0;
rect.left = pSelected[0].x *(cxBack-3);
rect.right = rect.left+(cxBack-3)+3;
rect.top = pSelected[0].y *(cyBack-4)-30;
rect.bottom = rect.top + (cyBack-4)+4;
InvalidateRect (hwnd, &rect, true) ;
/*
rect.left=0;
rect.right=0 ;
rect.top=0;
rect.bottom=0;*/
}
}
}
if( iCount==(M-2)*(N-2)/2 )
{
iCount=0;
KillTimer (hwnd, TimerID) ;
MessageBox (hwnd, TEXT ("恭喜你,你赢了!!"),szAppName, MB_OK | MB_ICONQUESTION) ;
SendMessage(hwnd,WM_COMMAND,IDM_APP_START,0);
}
return 0;
case WM_CLOSE://用户关闭程序
if ( IDYES == MessageBox (hwnd, TEXT ("确认关闭程序"),
szAppName, MB_YESNO | MB_ICONQUESTION) )
//弹出确认窗口,按YES退出程序
{
PlaySound (TEXT ("close.wav"), NULL, SND_FILENAME | SND_ASYNC) ;
KillTimer (hwnd, TimerID) ;
DestroyWindow (hwnd) ;
Sleep(2000);
}
return 0 ;
case WM_DESTROY:
PostQuitMessage (0) ;
return 0 ;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
}