Click here to Skip to main content
15,901,373 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Control of a List Box [modified] Pin
Nibu babu thomas25-May-06 19:08
Nibu babu thomas25-May-06 19:08 
GeneralRe: Control of a List Box [modified] Pin
Immunity1825-May-06 19:13
Immunity1825-May-06 19:13 
GeneralRe: Control of a List Box [modified] Pin
Nibu babu thomas25-May-06 19:15
Nibu babu thomas25-May-06 19:15 
GeneralRe: Control of a List Box [modified] Pin
Immunity1825-May-06 19:23
Immunity1825-May-06 19:23 
AnswerRe: Control of a List Box Pin
_AnsHUMAN_ 25-May-06 18:29
_AnsHUMAN_ 25-May-06 18:29 
AnswerRe: Control of a List Box Pin
ThatsAlok25-May-06 18:59
ThatsAlok25-May-06 18:59 
QuestionPerformance question about my FTP client app! Pin
wangdave25-May-06 18:07
wangdave25-May-06 18:07 
Questionhow to synchronize read and write threads (to serial port)? Pin
Nawar_nrr25-May-06 17:23
Nawar_nrr25-May-06 17:23 
Hi Ive posted a thread titled: (problem with reading serial port) if that could help you..Im doing a two threads program the main one is in charge of user interface and write toport operations and the second oen is in charge with reading the serial port...
this is the reading thread code

void __fastcall read_thrd::Execute()<br />
{ FreeOnTerminate = true;<br />
<br />
OVERLAPPED osRead = {0};<br />
DWORD dwCommEvent;<br />
DWORD iBytesRead;<br />
DWORD BytesToRead = 128;<br />
<br />
osRead.hEvent= CreateEvent(NULL,TRUE,NULL,NULL);<br />
if (!SetCommMask(Form1->m_hCom, EV_RXCHAR))<br />
{<br />
wsprintfA(Form1->sBuffer, "LastError = %d", GetLastError());<br />
MessageBoxA(0, Form1->sBuffer, "SetCommMask() Failed", MB_OK);<br />
<br />
}<br />
<br />
while(!Terminated)<br />
{ dwCommEvent = NULL;<br />
if (!WaitCommEvent(Form1->m_hCom, &dwCommEvent, 0))<br />
{<br />
wsprintfA(Form1->sBuffer, "LastError = %d", GetLastError());<br />
MessageBoxA(0, Form1->sBuffer, "WaitCommEvent() Failed", MB_OK);<br />
break; <br />
}<br />
<br />
if (dwCommEvent & EV_RXCHAR)<br />
{ ReadFile(Form1->m_hCom, &Form1->sBuffer, BytesToRead, &iBytesRead, &osRead);<br />
<br />
FlushFileBuffers(Form1->m_hCom);<br />
<br />
} <br />
}<br />
void __endthread(void);<br />
}


now lets say that in order to do an operation i need so send a series of commands to serial port and receive answer to each one of them..
how can i synchronize the writing and reading between threads to it doesnt start writing new command untill it gets the answer from the device??
and what do you think about the code above??
AnswerRe: how to synchronize read and write threads (to serial port)? Pin
ThatsAlok25-May-06 19:10
ThatsAlok25-May-06 19:10 
GeneralRe: how to synchronize read and write threads (to serial port)? Pin
Nawar_nrr25-May-06 21:10
Nawar_nrr25-May-06 21:10 
GeneralRe: how to synchronize read and write threads (to serial port)? Pin
ThatsAlok25-May-06 22:24
ThatsAlok25-May-06 22:24 
QuestionIs there any way delete part of what I allocated? Pin
followait25-May-06 17:12
followait25-May-06 17:12 
AnswerRe: Is there any way delete part of what I allocated? [modified] Pin
Nibu babu thomas25-May-06 17:35
Nibu babu thomas25-May-06 17:35 
AnswerRe: Is there any way delete part of what I allocated? Pin
ThatsAlok25-May-06 19:15
ThatsAlok25-May-06 19:15 
QuestionHandling multiple display sizes and keep full screen Pin
Kyle P25-May-06 16:29
Kyle P25-May-06 16:29 
AnswerRe: Handling multiple display sizes and keep full screen Pin
Naveen25-May-06 17:21
Naveen25-May-06 17:21 
GeneralRe: Handling multiple display sizes and keep full screen Pin
anwer_skk26-May-06 3:11
anwer_skk26-May-06 3:11 
GeneralRe: Handling multiple display sizes and keep full screen Pin
Kyle P26-May-06 3:35
Kyle P26-May-06 3:35 
QuestionHow to play a buffer(not a file or url) with window media player? Pin
szcococut25-May-06 15:13
szcococut25-May-06 15:13 
AnswerRe: How to play a buffer(not a file or url) with window media player? Pin
anwer_skk25-May-06 21:30
anwer_skk25-May-06 21:30 
QuestionProblem with enum/struct header file Pin
CoffeeAddict1925-May-06 15:00
CoffeeAddict1925-May-06 15:00 
AnswerRe: Problem with enum/struct header file Pin
bob1697225-May-06 15:53
bob1697225-May-06 15:53 
GeneralRe: Problem with enum/struct header file Pin
CoffeeAddict1925-May-06 16:32
CoffeeAddict1925-May-06 16:32 
QuestionHardware Programming with Visual C++ Pin
Max++25-May-06 14:28
Max++25-May-06 14:28 
AnswerRe: Hardware Programming with Visual C++ Pin
bob1697225-May-06 15:57
bob1697225-May-06 15:57 

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.