【发布时间】:2010-08-17 07:52:08
【问题描述】:
好吧,我有结构
struct balls {
balls(UINT_PTR const &val) : BALL_ID(val){}
int Ex;
int Ey;
const UINT_PTR BALL_ID;
};
balls ball1(0x1);
我有一个 switch 语句
switch(wParam)
{
case ball1.BALL_ID:
if(ball1.Ex<300)
{
ball1.Ex++;
}
else
{
KillTimer(hWnd, ball1.BALL_ID);
}
InvalidateRect(hWnd, rect, false);
break;
case SCORECOUNTER_ID:
if(life==0)
{
if(scorecounter<1000)
{
scorecounter+=100;
_swprintf(str, _T("Score: %d"), scorecounter);
InvalidateRect(hWnd, rect, false);
}
else
{
_swprintf(level, _T("Level: %d"), 2);
InvalidateRect(hWnd, rect, false);
}
}
break;
}
我得到一个错误,ball1.BALL_ID is not constant 第二行应该解决这个问题,但它不知道?
【问题讨论】:
标签: c++ visual-c++ winapi struct