为什么我点击相应区域(右下角关闭)没有触发事件?如果注释掉点击事件以外的代码程序就正常了,没检查出其余部分代码有什么问题。
while (1)
{
m = GetMouseMsg();
if (m.x >= 690 && m.x <= 750 && m.y >= 545 && m.y <= 575 && m.uMsg == WM_LBUTTONDOWN)
{
break;
}
if ((ret = recvfrom(sock, recvbuf, BUFSIZE, 0, (struct sockaddr*)&from, &len)) == SOCKET_ERROR)
{
printf("recvfrom failed with:%d\n", WSAGetLastError());
closesocket(sockM);
closesocket(sock);
WSACleanup();
return -1;
}
else
{
flag++;
recvbuf[ret] = '\0';
size = strlen(recvbuf);
if (strcmp(recvbuf, "QUIT") == 0) break;
outtextxy(0, 60 + n * flag, "RECV:");
outtextxy(50, 60 + n * flag, recvbuf);
outtextxy(60 + size * 10, 60 + n * flag, "FROM:");
outtextxy(110 + size * 10, 60 + n * flag, inet_ntoa(from.sin_addr));
}
}