Click here to Skip to main content
15,895,880 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Working with DB Pin
Jose David Pujo26-Jan-09 4:38
Jose David Pujo26-Jan-09 4:38 
QuestionAfxGetInstanceHandle Crash in MFC Extension dlls Pin
Neptunex25-Jan-09 17:55
Neptunex25-Jan-09 17:55 
AnswerRe: AfxGetInstanceHandle Crash in MFC Extension dlls Pin
Randor 25-Jan-09 18:23
professional Randor 25-Jan-09 18:23 
AnswerRe: AfxGetInstanceHandle Crash in MFC Extension dlls Pin
Neptunex26-Jan-09 0:53
Neptunex26-Jan-09 0:53 
GeneralRe: AfxGetInstanceHandle Crash in MFC Extension dlls Pin
Randor 26-Jan-09 9:21
professional Randor 26-Jan-09 9:21 
GeneralRe: AfxGetInstanceHandle Crash in MFC Extension dlls Pin
Neptunex3-Mar-09 20:27
Neptunex3-Mar-09 20:27 
QuestionCommunication app. using dial-up modem times out Pin
Member 171596825-Jan-09 17:51
Member 171596825-Jan-09 17:51 
AnswerRe: Communication app. using dial-up modem times out Pin
Jonathan Davies25-Jan-09 23:51
Jonathan Davies25-Jan-09 23:51 
I've never used a modem, just a port for serial comms but have seen similar problems.
First I'd recommend if you are not using PortMon or a similar utility to do so to see exectly whats happening at a lower level.
Obviously you could extend the timeout but whilst 2mS might work, there's still (presumably) nothing in your code to handle what to do if it doesn't.
Why read a byte at a time? OK it works, but you could attempt to read the number of bytes expected in the whole expected message and then check the number of bytes read? You could then get, say 28 bytes when you expect 30, buffer them read again and add the first 2 bytes of the second read to the end of the buffer etc.
When using ports I work on the assumption that you may not get what you expect:
while(!bFullMessageReceived)
{
    //// Might read anything: nothing, part of a message or perhaps the end of one message and the beginning of another
    BOOL bRead = ::ReadFile(m_portHandle, static_cast<LPVOID>(ReadBuff), dwMaxBytesToRead,&dwBytesRead,NULL);
    if(FALSE == bRead)
    {
        ...

I would recommend treating a timeout as something that is a valid event, which it is. It's not an error: it happens and it not in your control, so you have to deal with it.
GeneralRe: Communication app. using dial-up modem times out Pin
Member 171596827-Jan-09 20:00
Member 171596827-Jan-09 20:00 
GeneralRe: Communication app. using dial-up modem times out Pin
Jonathan Davies27-Jan-09 21:27
Jonathan Davies27-Jan-09 21:27 
QuestionIs "Create window in Work thread" a bad design? Pin
fitatc25-Jan-09 15:16
fitatc25-Jan-09 15:16 
AnswerRe: Is "Create window in Work thread" a bad design? Pin
«_Superman_»25-Jan-09 16:20
professional«_Superman_»25-Jan-09 16:20 
AnswerRe: Is "Create window in Work thread" a bad design? Pin
Joshua Tully25-Jan-09 16:31
Joshua Tully25-Jan-09 16:31 
GeneralRe: Is "Create window in Work thread" a bad design? Pin
fitatc25-Jan-09 21:17
fitatc25-Jan-09 21:17 
QuestionNeed help to create GUI application form in C++ and create instalation program for it. Pin
hdavari25-Jan-09 3:11
hdavari25-Jan-09 3:11 
AnswerRe: Need help to create GUI application form in C++ and create instalation program for it. Pin
Maximilien25-Jan-09 4:01
Maximilien25-Jan-09 4:01 
QuestionRe: Need help to create GUI application form in C++ and create instalation program for it. Pin
David Crow26-Jan-09 3:00
David Crow26-Jan-09 3:00 
QuestionItems are not visible in a ListBox [modified] Pin
Elsie25-Jan-09 1:45
Elsie25-Jan-09 1:45 
AnswerRe: Items are not visible in a ListBox Pin
Hans Dietrich25-Jan-09 6:25
mentorHans Dietrich25-Jan-09 6:25 
GeneralRe: Items are not visible in a ListBox Pin
Elsie25-Jan-09 17:40
Elsie25-Jan-09 17:40 
QuestionHow to get message when tab is changed in one MDI multiple tab application Pin
fujoey24-Jan-09 22:52
fujoey24-Jan-09 22:52 
QuestionUnable to move slider position using mouse [modified] Pin
John50224-Jan-09 12:29
John50224-Jan-09 12:29 
AnswerRe: Unable to move slider position using mouse Pin
David Crow24-Jan-09 14:08
David Crow24-Jan-09 14:08 
GeneralRe: Unable to move slider position using mouse [modified] Pin
John50225-Jan-09 0:42
John50225-Jan-09 0:42 
AnswerRe: Unable to move slider position using mouse Pin
Mark Salsbery25-Jan-09 7:37
Mark Salsbery25-Jan-09 7:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.