Click here to Skip to main content
16,006,531 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: progressbar and xp themes help Pin
locoone24-May-06 13:25
locoone24-May-06 13:25 
AnswerRe: progressbar and xp themes help Pin
Hamid_RT23-May-06 19:23
Hamid_RT23-May-06 19:23 
GeneralRe: progressbar and xp themes help Pin
locoone24-May-06 13:54
locoone24-May-06 13:54 
QuestionPrinting CEditView Pin
richard stott23-May-06 16:53
richard stott23-May-06 16:53 
AnswerRe: Printing CEditView Pin
bob1697223-May-06 17:24
bob1697223-May-06 17:24 
Questionrecv question Pin
followait23-May-06 16:32
followait23-May-06 16:32 
AnswerRe: recv question [modified] Pin
bob1697223-May-06 17:02
bob1697223-May-06 17:02 
Questionproblems with reading serial port..help!! Pin
Nawar_nrr23-May-06 15:51
Nawar_nrr23-May-06 15:51 
hi I have posted this yesterday but nobody answered I have searched and added some stuff..maybe somebody know something about it..

Im writing a multithreaded program in borland c++ builder 6 that communicate with serial port..readFile function is on a seperate thread and its called ( the thread) by void __fastcall read_thrd::Execute() (which replace the thread function..)..so how can I write a function that reads the serial port automatically when there is something??..(how to get the serial port status(or whatever) and react to it?)

there are some functions like WaitForSingleObject ,SetCommMask and WaitCommEvent, but I dont know how to use them properly(where to use them? in the reading thread or the main thread?and which flag to use?)

Execute() could be controled by Resume() - will resume its execution- and Suspend() - will pause and suspend its execution- and those two functions are the way to communicate with the thread from the main thread -in addition to Terminate() - , so I can write my code in execute() or in other function and then call it.

now my code it as simple as this: (Im using a butten to call resume)



//thread is suspended when created<br />
void __fastcall read_thrd::Execute()<br />
{<br />
FreeOnTerminate = true;<br />
while(!Terminated)<br />
{<br />
ReadFile(Form1->m_hCom, &(Form1->sBuffer), 128, &(Form1->iBytesWritten), &osReader) ;<br />
Suspend();<br />
}<br />
<br />
if(Terminated)<br />
{<br />
void __endthread(void);<br />
}<br />
}

I need to replace it ..so I dont have to click the butten to read the comm port..can you help??please?
AnswerRe: problems with reading serial port..help!! Pin
Steve Echols23-May-06 18:30
Steve Echols23-May-06 18:30 
AnswerRe: problems with reading serial port..help!! Pin
Zac Howland24-May-06 3:30
Zac Howland24-May-06 3:30 
GeneralRe: problems with reading serial port..help!! Pin
Nawar_nrr24-May-06 16:41
Nawar_nrr24-May-06 16:41 
Questionproblem with MessageBox!!! [modified] Pin
Lord_Vader23-May-06 14:27
Lord_Vader23-May-06 14:27 
AnswerRe: problem with MessageBox!!! [modified] Pin
Lord_Vader23-May-06 14:53
Lord_Vader23-May-06 14:53 
AnswerRe: problem with MessageBox!!! [modified] Pin
PJ Arends23-May-06 14:57
professionalPJ Arends23-May-06 14:57 
AnswerRe: problem with MessageBox!!! [modified] Pin
zt978823-May-06 17:13
zt978823-May-06 17:13 
GeneralRe: problem with MessageBox!!! [modified] Pin
toxcct23-May-06 21:31
toxcct23-May-06 21:31 
QuestionVisual Studio 2005 conversion problem/question. Pin
CodeGoose23-May-06 11:09
CodeGoose23-May-06 11:09 
AnswerRe: Visual Studio 2005 conversion problem/question. Pin
georgeraafat23-May-06 13:29
georgeraafat23-May-06 13:29 
QuestionAccessing Cached Credentials Windows XP Pin
ScottDJ23-May-06 10:46
ScottDJ23-May-06 10:46 
Questionoperator = not defined for ostream Pin
Jai Khurana23-May-06 9:34
Jai Khurana23-May-06 9:34 
AnswerRe: operator = not defined for ostream Pin
Zac Howland23-May-06 10:37
Zac Howland23-May-06 10:37 
GeneralRe: operator = not defined for ostream Pin
Jai Khurana23-May-06 16:10
Jai Khurana23-May-06 16:10 
GeneralRe: operator = not defined for ostream Pin
Jai Khurana23-May-06 16:44
Jai Khurana23-May-06 16:44 
GeneralRe: operator = not defined for ostream Pin
Zac Howland24-May-06 3:26
Zac Howland24-May-06 3:26 
GeneralRe: operator = not defined for ostream Pin
Jai Khurana24-May-06 4:28
Jai Khurana24-May-06 4:28 

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.