我上次发的那个线程创建,已经解决,稍后会结贴。现在 ,又发现在一个新的问题,就是什么都过去了。没有任何错误,程序也正常执行了。但是,执行一段时间后,就变成白屏了。像屏保,但是,动鼠标也没有办法。哎。为什么受伤的总是我。请指教。DWORD WINAPI BallMove(LPVOID lpparameter)
{
LPINFO temp=(LPINFO)lpparameter;
BOOL xadd,yadd;
xadd=yadd=TRUE;
while(TRUE)
{
if((temp->xPos+temp->ballr)>=((LPRECT)temp->rect)->right)
xadd=FALSE;
else if((temp->xPos-temp->ballr)<=((LPRECT)temp->rect)->left)
xadd=TRUE;
if((temp->yPos+temp->ballr)>=((LPRECT)temp->rect)->bottom)
yadd=FALSE;
else if((temp->yPos-temp->ballr)<=((LPRECT)temp->rect)->top)
yadd=TRUE;
if(xadd)
temp->xPos++;
else
temp->xPos--;
if(yadd)
temp->yPos++;
else
temp->yPos--;
CRect rect(temp->xPos-temp->ballr-2,temp->yPos-temp->ballr-2,temp->xPos+temp->ballr+2,temp->yPos+temp->ballr+2);
InvalidateRect(temp->hWnd,rect,TRUE);
Sleep(temp->speed);
}
return 0;
}
省略一些。
m_hGreenThread=CreateThread(NULL,0,BallMove,&m_GreenBall,0,&ThreadID);
{
LPINFO temp=(LPINFO)lpparameter;
BOOL xadd,yadd;
xadd=yadd=TRUE;
while(TRUE)
{
if((temp->xPos+temp->ballr)>=((LPRECT)temp->rect)->right)
xadd=FALSE;
else if((temp->xPos-temp->ballr)<=((LPRECT)temp->rect)->left)
xadd=TRUE;
if((temp->yPos+temp->ballr)>=((LPRECT)temp->rect)->bottom)
yadd=FALSE;
else if((temp->yPos-temp->ballr)<=((LPRECT)temp->rect)->top)
yadd=TRUE;
if(xadd)
temp->xPos++;
else
temp->xPos--;
if(yadd)
temp->yPos++;
else
temp->yPos--;
CRect rect(temp->xPos-temp->ballr-2,temp->yPos-temp->ballr-2,temp->xPos+temp->ballr+2,temp->yPos+temp->ballr+2);
InvalidateRect(temp->hWnd,rect,TRUE);
Sleep(temp->speed);
}
return 0;
}
省略一些。
m_hGreenThread=CreateThread(NULL,0,BallMove,&m_GreenBall,0,&ThreadID);
解决方案 »
- 一个新手概念问题,请问不同IE窗口会有相同的句柄么?或者说:相同的IE窗口会有不同的句柄么?
- 图标
- 安装程序的问题,谢谢大虾啦!!给100分
- 通过ADO访问SQLSERVER问题,win2000系统下为何第一次都连接不上?
- 怎样判断一个文件夹内有没有指定的文件夹?
- 那位侠客知道 pcanywhere 的模块是怎么一回事?
- MDI 问题
- 绝望,加100分,为什么我的try catch 编译总通不过,系统说在try 后要加分号
- 动态记录集只能用只读方式打开吗?——我是菜鸟,所以我很痛苦
- 请教,怎样换墙纸???????????????????
- 由于某种原因,我不能用mfc,但是需要打印,请问怎么对视图窗口的内容进行打印,谢谢
- 如何播放AVI文件???????
动mouse的,有没有响应的窗口函数?