|
OK, based on my timeout settings I would expect a one second timeout. Can you straighten out my thinking? Does the buffer size affect timeout?
Thanks Much.
|
|
|
|
|
AFAIK, if there is no data at all, the read call does not return. The timeout
starts as soon as the first byte is received, no sooner.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Ah ha! Now my assumption becomes that I must create a comm thread, and a watchdog to terminate the thread in the event that no connection is established or at least allow the user to close the app.
Thanks very much!
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Luc Pattyn wrote: AFAIK, if there is no data at all, the read call does not return. The timeout
starts as soon as the first byte is received, no sooner.
Actually this applies only to the ReadIntervalTimeout member.
The following little test (on disconnected serial port):
...
ct.ReadIntervalTimeout = 1000;
ct.ReadTotalTimeoutConstant = 1000;
ct.ReadTotalTimeoutMultiplier = 1000;
ct.WriteTotalTimeoutConstant = 1000;
ct.WriteTotalTimeoutMultiplier = 1000;
fSuccess = SetCommTimeouts(hCom, &ct);
char Buf[0x10];
DWORD dwRead;
DWORD dwStart = timeGetTime();
ReadFile(hCom, Buf, 1, &dwRead, NULL);
DWORD dwEnd = timeGetTime();
printf("elapsed milliseconds %d", dwEnd-dwStart);
outputs elapsed milliseconds 2000 , i.e.
ReadTotalTimeoutConstant + 1 * ReadTotalTimeoutMultiplier
Probably the relatively large value of ReadTotalTimeoutMultiplier (1 second per character) chosen by OP makes the application appear hung on read request for significative number of bytes.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
You may well be right, I do not recall all the details, but several years ago (actually
on Win98( we had some trouble getting both a good response time to incoming messages and a
low overhead when nothing much was coming in.
The solution then consisted of a separate thread performing two calls, one reading a single
character (the first character of a message, with a long timeout), and one reading the
remainder of the message with timeouts set so it would return very soon when no more data
seemed to come in.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Luc Pattyn wrote: You may well be right
Oh, I'm right for sure.
Luc Pattyn wrote: but several years ago (actually
on Win98( we had some trouble getting both a good response time to incoming messages and a
low overhead when nothing much was coming in.
The solution then consisted of a separate thread performing two calls, one reading a single
character (the first character of a message, with a long timeout), and one reading the
remainder of the message with timeouts set so it would return very soon when no more data
seemed to come in.
OMG, what a workaround!
Documentation on COMMTIMEOUTS clearly states what structure members are supposed to do, but, I know, serial communication is tricky (and on Win98 , was possibly even more tricker) and when one finds obstacles on communication his imagination may reach the apex (i.e. I can remember very weird workarounds of mine).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Hi guys
I'm guessing this is a faq so I apologise in advance.
I was going to install a splash screen into an MFC application I've written using VS2005. However, I can't find the component gallery. Is there any way I can get the splash screen or the other components?
Thanks in advance
G
|
|
|
|
|
|
Thanks Dave but have MS taken the component gallery away? If so, why?
|
|
|
|
|
I have no idea what that is. The link I provided is a gallery of components. Just look through there to find one that will suit you.
|
|
|
|
|
Not from the component gallery, but have you seen this?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello guys,
I have a TLB file and it's interface description in Delphi.
But I want to create a C++ project that uses the interfaces exported by that Program.
I extracted the TLB file from the executable and now I want to ask if there is a way to convert this TLB file to an IDL file.
Any ideas?
Don't try it, just do it!
|
|
|
|
|
Alexander wrote: But I want to create a C++ project that uses the interfaces exported by that Program.
You can use the #import directive to generate ATL wrapper classes for the tlb file.
led mike
|
|
|
|
|
Yes, run the MS OLEViewer app (Start>>Run>>oleview.exe). From there, use File>>View Typelib. In the type library view, just use File>>Save As to save it as IDL.
|
|
|
|
|
Thank you guys, both of you
Don't try it, just do it!
|
|
|
|
|
By default there are 8x6 colors for choosing. How to make it more?
This is the need of the customers, they would like the program be easy
to use.
If it is not easy, I'd like to make one myself, but I can't decide how to choose and put colors so that it can look a little good.
modified on Friday, February 01, 2008 12:21:50 PM
|
|
|
|
|
followait wrote: By default there are 8x6 colors for choosing.
No
followait wrote: they would like the program be easy
to use.
And using more than 48 colors makes the program easy to use? Wow, are they brain dead?
led mike
|
|
|
|
|
Especially since it lets the user pick one of 2^24 colors
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
led mike wrote: No
I mean 'basic color' in the title.
|
|
|
|
|
Pretty vague question
Are you referring to the "color dialog box" common dialog?
If so, then like any other dialog, if you need additional
functionality you can write your own.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: Are you referring to the "color dialog box" common dialog?
Yes.
The number of basic colors seems not changable.
I think I should implement one.
|
|
|
|
|
followait wrote: By default there are 8x6 colors...
There are 48 basic colors, but there are 2563 total colors.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Sure.
The key is when the customer is choosing a color for background,
a set of well-selected colors may be better than all here.
|
|
|
|
|
Heh yeah, but if you put 1000 basic colors, I bet you still won't
have my favorite blue.
How do you decide how many is enough?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|