I am nearing a point of posting code for what started out as "USB Complete" but a heck of a lot easier if not using HID drivers. Although hard, I almost have it, but one more M$ wall has jumped up in front of me again.
This time I hope its something simple to solve, but I do not see it.
What I need to do is the following with a File/Device/Port (does not matter what at the moment)
The getting the number of bytes to read is whats eluding me and re-reading the Win32Api.hlp is just making things worse
If the handle returned from CreateFile was for a file, I could get the bytes needed from the file itself, if memory serves if it were a ComPort, then I could get the bytes by forcing a timeout time with CommTimeout, that in turn would have the number of bytes ready to be read, but if its some other device (like USB) there must be a way to get the number of bytes to be read?????
Since ReadFile is a "Blocking" call that does not return until done, or error I need a better way or could be waiting forever if there is no bytes to be read?
This time I hope its something simple to solve, but I do not see it.
What I need to do is the following with a File/Device/Port (does not matter what at the moment)
- Open using CreateFile '<=== DONE
- Count number of bytes to send '<=== Should be simple since I know what I am sending
- WriteFile '<=== Should be simple
- Count number of bytes to read '<=== NO CLUE
- Read the number of bytes '<=== Should be easy once I have a count
The getting the number of bytes to read is whats eluding me and re-reading the Win32Api.hlp is just making things worse
If the handle returned from CreateFile was for a file, I could get the bytes needed from the file itself, if memory serves if it were a ComPort, then I could get the bytes by forcing a timeout time with CommTimeout, that in turn would have the number of bytes ready to be read, but if its some other device (like USB) there must be a way to get the number of bytes to be read?????
Since ReadFile is a "Blocking" call that does not return until done, or error I need a better way or could be waiting forever if there is no bytes to be read?

Comment