Problem with Timer application in VC6

Status
Not open for further replies.

Longmcx

Junior Member level 1
Joined
Sep 28, 2004
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
147
i have core for my application
////
void CExbuttonDlg::OnTimer(UINT nIDEvent)
{
char receive ;
DWORD nByte;
ReadFile(hCom, &receive, 1, &nByte, NULL);

if (receive == 'b')
check = true;
}
but if i start my application, it hang up.
i don't know why? please help me
thanks for your attention.
 

timer vc6

hi,
check what have you set the SetTimer to, i,e the time you want the OnTimer to be triggered, the hang you are seeing is due to the reason that when the OnTimer executes the call to ReadFile blocks till the data is read, so the whole app is blocked till anything is read from ReadFile and ReadFile returns, hence i suggest you to use multiple threads in your app, i,e create a new thread and its sole purpose is to read via ReadFile.
hope that clears your issue.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…