Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Win32 WinCe
Hi,
 
I wrote a code to communicate with serial port ("com1:").
Under win32 API this works properly. In evc4, the same code compile without any error and establishes the link with ("com1:") but when it executes the readfile statement:
 song=ReadFile(
    hComm   ,       // handlePort_: handle of file to read
    (BYTE*)tmpMsg,  // inputData:handle of file to read
    400     ,       // sizeBuffer:number of bytes to read
    BytesRead,     // pointer to number of bytes read
    NULL    );      // pointer to structure for data
it shows that song is true but BytesRead=0.
 
Any hint to how to get it to work properly?
Thanks
Posted 2-Oct-11 7:08am
EsmatB356
Edited 2-Oct-11 7:13am
v2
Comments
André Kraak at 2-Oct-11 13:14pm
   
Edited question:
Added pre tags

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Try
DWORD dwError = ::GetLastError();
and call FormatMessage[^] to get the error details.
  Permalink  
v2
Comments
Albert Holguin at 3-Oct-11 21:52pm
   
OP posted as solution:
the code for GetLastError() is 0, indicates that "the operation completed successfully".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Nirav Prabtani 318
1 OriginalGriff 227
2 Sergey Alexandrovich Kryukov 216
3 Mika Wendelius 185
4 CPallini 170
0 Nirav Prabtani 284
1 OriginalGriff 217
2 Sergey Alexandrovich Kryukov 196
3 Mika Wendelius 185
4 CPallini 170


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 3 Oct 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100