Click here to Skip to main content
15,915,869 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Upgrading from VC++ 6.0 to VC++ 2005 Pin
Ganesh_T16-Feb-06 23:24
Ganesh_T16-Feb-06 23:24 
GeneralRe: Upgrading from VC++ 6.0 to VC++ 2005 Pin
toxcct16-Feb-06 23:29
toxcct16-Feb-06 23:29 
GeneralRe: Upgrading from VC++ 6.0 to VC++ 2005 Pin
Ganesh_T16-Feb-06 23:32
Ganesh_T16-Feb-06 23:32 
Questionmultithreading Pin
bolleperdu16-Feb-06 22:05
bolleperdu16-Feb-06 22:05 
AnswerRe: multithreading Pin
Naveen16-Feb-06 22:45
Naveen16-Feb-06 22:45 
AnswerRe: multithreading Pin
Steve S17-Feb-06 0:23
Steve S17-Feb-06 0:23 
AnswerRe: multithreading Pin
ThatsAlok17-Feb-06 21:46
ThatsAlok17-Feb-06 21:46 
QuestionRe: multithreading Pin
bolleperdu27-Feb-06 22:29
bolleperdu27-Feb-06 22:29 
Thanks for the response! The problem is that I want to show how much of the serial data is allready transmitted.

My programming skills are extremely basic: I create my forms using the windows form designer , I don't create them from my own code.

Would using the class "using namespace System::Threading;" for my threading be the easiest way?

<br />
try<br />
 {<br />
  StreamReader^ sr = gcnew StreamReader(teversturen);//teversturen is the full path of the file to be transmitted<br />
  {<br />
   String^ line;<br />
    int lengte = (unsigned int)sr->BaseStream->Length;	<br />
    int percent;				<br />
    while (!(sr->EndOfStream::get()))<br />
    {<br />
      percent = (((unsigned int)sr->BaseStream->Position / lengte) * 100);//calculate how much is done<br />
      toolPCT->Text = percent.ToString() + "%";//make a string of the integer<br />
				<br />
      line = sr->ReadLine();//read a line from the file<br />
      sp->WriteLine(line);//write it in the serial buffers<br />
      Form1::Update();//force the form to update itself<br />
    }<br />
   }<br />
   sr->Close();<br />
		<br />
 }<br />
catch (Exception^ e)<br />
 {<br />
  // Let the user know what went wrong.<br />
  richTextBox1->Text += "The file not be read:\n";<br />
  richTextBox1->Text += e->Message + "\n";<br />
  sp->Close();<br />
 }



Above you can find my code. I would like the percentage to be shown at least with an accuracy of 10 pct, or an update every 2 - 5 seconds. If this could be achieved without multithreading, that would please me even more:p The serial communication takes lots of time and the users would like to be able to cancel, see the status, ...
QuestionHelp me Hook Copy/Paste Action. Pin
huynhnb16-Feb-06 19:22
huynhnb16-Feb-06 19:22 
AnswerRe: Help me Hook Copy/Paste Action. Pin
John R. Shaw16-Feb-06 19:49
John R. Shaw16-Feb-06 19:49 
GeneralRe: Help me Hook Copy/Paste Action. Pin
huynhnb16-Feb-06 20:11
huynhnb16-Feb-06 20:11 
GeneralRe: Help me Hook Copy/Paste Action. Pin
huynhnb16-Feb-06 20:43
huynhnb16-Feb-06 20:43 
GeneralRe: Help me Hook Copy/Paste Action. Pin
John R. Shaw16-Feb-06 21:44
John R. Shaw16-Feb-06 21:44 
Questionwindow design Pin
prabhathgk16-Feb-06 19:05
prabhathgk16-Feb-06 19:05 
AnswerRe: window design Pin
John R. Shaw16-Feb-06 19:31
John R. Shaw16-Feb-06 19:31 
QuestionQuestion about Threads Pin
Aqueel16-Feb-06 18:42
Aqueel16-Feb-06 18:42 
AnswerRe: Question about Threads Pin
Nick_Kisialiou16-Feb-06 19:12
Nick_Kisialiou16-Feb-06 19:12 
AnswerRe: Question about Threads Pin
QuickDeveloper16-Feb-06 19:16
QuickDeveloper16-Feb-06 19:16 
AnswerRe: Question about Threads Pin
Stephen Hewitt16-Feb-06 19:47
Stephen Hewitt16-Feb-06 19:47 
GeneralRe: Question about Threads Pin
Nick_Kisialiou16-Feb-06 19:54
Nick_Kisialiou16-Feb-06 19:54 
GeneralRe: Question about Threads Pin
Stephen Hewitt16-Feb-06 19:58
Stephen Hewitt16-Feb-06 19:58 
GeneralRe: Question about Threads Pin
Nick_Kisialiou16-Feb-06 20:14
Nick_Kisialiou16-Feb-06 20:14 
GeneralRe: Question about Threads Pin
Stephen Hewitt19-Feb-06 11:11
Stephen Hewitt19-Feb-06 11:11 
AnswerRe: Question about Threads Pin
BadKarma16-Feb-06 20:53
BadKarma16-Feb-06 20:53 
GeneralRe: Question about Threads [modified] Pin
BadKarma25-May-06 12:52
BadKarma25-May-06 12:52 

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.